[PARPORT] unsuccessfull try of the example. of the doc

From: Frederic Corne (frederic.corne@idealx.com)
Date: Thu Jul 12 2001 - 08:25:24 EDT

  • Next message: Tim Waugh: "Re: [PARPORT] unsuccessfull try of the example. of the doc"

    Hi,

    I have to realize for a client, an unified api (open/read/write/select) for
    IEEE1284 communication between 2 machines.

    I am trying to do the example of the doc "the linux2.4 Parallel Port
    subsystem" of Tim Waugh

    I have two 2.2.18 machines with the ppdev patch, linked with a parallel
    cable. I have tryed plip and it works.
    the module ppdev.o is correctly loaded.

    but i am unable to do the example.

    a target machine mimics the printer with :

    fd = open (DEVICE_ECP0, O_RDWR);
    ioctl (fd, PPCLAIM)
    mode = IEEE1284_MODE_COMPAT
    ioctl (fd, PPNEGOT, &mode)
    for (;;) {
       ioctl (fd, PPWCTLONIRQ, &busy);
       ioctl (fd, PPWCONTROL, &ready);
       (...)
            select (fd + 1, &rfds, NULL, NULL, NULL))

    (etc)

    and a client that send something to the "printer"

    fd = open (DEVICE_ECP0, O_RDWR);
    ioctl (fd, PPCLAIM)
    mode = IEEE1284_MODE_COMPAT
    ioctl (fd, PPNEGOT, &mode)
    my_write (fd, buffer, sz)

    my_write () { /* as in the doc , page 23 */
            for (;;) {
                ioctl (fd, PPRSTATUS, &status) ;
                    if ((status & mask) == val)
                      break;

                    ioctl (fd, PPRELEASE);
                    sleep (1);
                     ioctl (fd, PPCLAIM);
             }
    }

    the target machine is always into the select() and the the client get always
    0 for status from ioctl (fd, PPRSTATUS, &status) ;

    ??? what is wrong ??

    any help appreciated !

    Thnk you in advance

    FC
    (I am an experienced c/c++ programmer , but a newbie for ioctl stuff , so
    excuse me for these very sample questions)

    -- 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 : Thu Jul 12 2001 - 08:32:15 EDT