Re: [PARPORT] ppdev and select() woes

From: Tim Waugh (
Date: Mon Sep 03 2001 - 13:06:51 EDT

  • Next message: Angela: "[PARPORT] status register problem.."
  • Next message: Batalov Grigory: "[PARPORT] 'loss of streaming' error"

    On Mon, Sep 03, 2001 at 05:01:19PM +0800, Jeff Murphy wrote:

    > /* lines i'm interested in - is that what PPWCTLONIRQ means?? */

    No. It means 'write this to the control port the next time an
    interrupt happens'.

    > ioctl( fd, PPWCTLONIRQ, &busy );
    > ioctl( fd, PPWCONTROL, &ready );

    So what you're doing here is writing a value to the control port with
    PPWCONTROL, and queuing up a response to an interrupt: but the
    response is 'no change'.

    > res = select( fd+1, &readfds, NULL, NULL, NULL );

    And then you're waiting for the interrupt, which never comes since
    it's tied to nAck (which presumably your device doesn't touch).

    The point about PPWCTLONIRQ is that it's for implementing handshakes.
    You write control lines to say 'give me data and then shake nAck', the
    peripheral writes data and shakes nAck to trigger an interrupt, and
    then the kernel driver (since it's faster than user space) writes the
    control lines to say 'okay, thanks, now hold on while I deal with
    it'. Then, if user space is in select() it can wake it up.

    Does that make sense?


    -- To unsubscribe, send mail to: --
    -- with the single word "unsubscribe" in the body of the message. --

    This archive was generated by hypermail 2b29 : Mon Sep 03 2001 - 13:07:56 EDT