[PARPORT] ppdev and select() woes

From: Jeff Murphy (jeff@www.exonet.com.au)
Date: Mon Sep 03 2001 - 05:01:19 EDT

  • Next message: Tim Waugh: "Re: [PARPORT] ppdev and select() woes"

    Reply-to: <jeff@exxen.com.au>

    Hi,

    Sorry for such a lame-o question, but this is driving me nuts..

    It's a simple scenario: some switches hooked up to the parallel
    port, using the PARPORT_STATUS_PAPEROUT and PARPORT_STATUS_ERROR
    lines looped back to ground.

    Polling mode using usleep() works OK, but i actually need
    select() or poll() functionality. Unfortunately, replacing
    the polling part with select() never returns, as in the
    following snippet:

      /* assume open, ioctl( PPCLAIM ), etc was successful */

      /* lines i'm interested in - is that what PPWCTLONIRQ means?? */
      int busy = PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ERROR;
      int ready = PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ERROR;

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

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

    Where have i gone wrong? i'm only after the status register
    contents (at this stage, anyway). Kernel version 2.4.4 if
    that matters.

    regards
    jeff

    -- 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 : Mon Sep 03 2001 - 12:42:10 EDT