Re: [PARPORT] LPGETSTATUS

From: Nate (nate@uniwest.com)
Date: Tue Dec 17 2002 - 19:02:58 EST

  • Next message: Pawel Stochlinski: "[PARPORT] Reading from pin - help."

    Tim >If the lp driver is in interrupt-driven mode it holds on to the port
    Tim >too long. Known issue.

    I am not doing anything with interrupts, (that I know of). I don't think
    any other processes are using the parallel port. My program inserts the
    modules and then after a few seconds does a call to check if the printer is
    responsive / ready:::::::::

    int Busy( int fd ) // open'd /dev/lp0 successfully
    {
      int status = 0;
      int error = 0;
      error = ioctl(fd, LPGETSTATUS, &status);
      // program never gets to here
      if( error < 0 )
         return 2; // bad
      status = status & 0xFF; // redundant, I know
      if( 0 == (status & 80) )
        return 1; // not ready, but ok
      return 0; // good
    }

    Tim >You can send a signal to the process holding the port lock, and it
    Tim >will return.

    I wouldn't know of any other processes holding the lock. Would an ioctl
    call using LPGETFLAGS work here to check the bit in question?

    Thanks,

    Nate

    -- 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 Dec 17 2002 - 19:03:29 EST