Re: [PARPORT] simple parallel device

From: Tim Waugh (twaugh@redhat.com)
Date: Wed May 14 2003 - 04:58:41 EDT

  • Next message: Blaise Gassend: "Re: [PARPORT] custom cabling"

    On Wed, May 14, 2003 at 12:01:30AM -0700, Jason Majors wrote:

    > Very cool! I started reading up on libieee1284. I think
    > ieee1284_wait_status() will do exactly what I need.

    That's certainly one way of doing it. Note that the current
    implementation isn't smart enough to realise that if it's just nAck
    you're after then it can wait for an interrupt. For that optimisation
    you'll have to explicitly select() on the file descriptor from
    ieee1284_get_irq_fd().

    > If I read the man page correctly, it should sit until either tv.tv_sec
    > seconds pass or the appropriate pin goes high, but they're coming back
    > immediately.

    Well, what's the return value? Take a look which one it is and what
    the man page says about it. There are error returns possible.
    Perhaps you forgot to call ieee1284_claim first?

    You could use ieee1284_read_status to find out the current values of
    those pins, of course.

    > Also, which pin is associated with which enum value?

    As described in the man page:

    DESCRIPTION
           There are five status lines, one of which is usually inverted on PC-
           style ports. Where they differ, libieee1284 operates on the IEEE 1284
           values, not the PC-style inverted values. The status lines are repre-
           sented by the following enumeration:
     
           enum ieee1284_status_bits
           {
             S1284_NFAULT = 0x08,
             S1284_SELECT = 0x10,
             S1284_PERROR = 0x20,
             S1284_NACK = 0x40,
             S1284_BUSY = 0x80,
             /* To convert those values into PC-style register values, use this: */
             S1284_INVERTED = S1284_BUSY,
           };

    In other words, if you have an unsigned char val from libieee1284 that
    you want to convert from IEEE 1284 values to PC-style values (where
    some pins are inverted), do this:

    unsigned char pc = val ^ S1284_INVERTED;

    Tim.
    */



    -- 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 : Wed May 14 2003 - 05:07:48 EDT