[PARPORT] new ppdev operations

From: Ronnie Arosa (infrac00@des.fi.udc.es)
Date: Tue Jun 19 2001 - 10:51:50 EDT

  • Next message: Tim Waugh: "Re: [PARPORT] new ppdev operations"

    I would like to read and write ECR register from user-space. I've tried
    to add two new ioctl operations to ppdev.c
       case PPWECONTROL:
           if (copy_from_user (&reg, (unsigned char *) arg, sizeof (reg)))
               return -EFAULT;
           parport_write_ecr (port, reg);
           return 0;
       case PPRECONTROL:
           reg = parport_read_ecr (port);
           if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
               return -EFAULT;
           return 0;

    I've change at ppdev.h from:
    #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char)
    #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char)
    to
    #define PPRECONTROL _IOR(PP_IOCTL, 0x87, unsigned char)
    #define PPWECONTROL _IOW(PP_IOCTL, 0x88, unsigned char)

    I've added this lines to parport.h

    #define parport_read_status(p) parport_pc_read_status(p)
    #define parport_write_status(p) parport_pc_write_status(p)
    unsigned char parport_pc_read_ecr(struct parport *p)
    {
      return inb (ECONTROL (p));
    }
    void parport_pc_write_ecr(struct parport *p, unsigned char d)
    {
      outb (d, ECONTROL(p));
    }

    And I've defined this functions in parport_pc.c as

    unsigned char parport_pc_read_ecr(struct parport *p)
    {
      return inb (ECONTROL (p));
    }
    void parport_pc_write_ecr(struct parport *p, unsigned char d)
    {
      outb (d, ECONTROL(p));
    }

    When I do make modules I receive an error:
    ppdev.c: In function `pp_ioctl':
    ppdev.c:392: warning: implicit declaration of function `parport_pc_read_ecr'
    ppdev.c:420: warning: implicit declaration of function
    `parport_pc_write_ecr'

    Should I do anything more? Am I doing anything wrong?

    Thanks in advance.

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Tue Jun 19 2001 - 11:06:00 EDT