[PARPORT] PPDEV - ECP Negotiation problem but not at the first time...

From: Martin Miller (ivx1@sympatico.ca)
Date: Fri May 18 2001 - 01:39:10 EDT

  • Next message: Tim Waugh: "Re: [PARPORT] PPDEV - ECP Negotiation problem but not at the first time..."

    Hi,

    I'm using the ppdev driver in a program to communicate with a mp3
    player (Nomad I).

    The first time I run the program, I don't have any problems sending
    or receiving data to/from the device. At each communication with the
    device, I open, claim and negociate the port in ECP mode. After some
    reads and write, when i'm finished (and there is no data waiting on
    the port for me to read it), I release and close the port.

    My problem is that it works the first time, but not a second time!

    I'm getting from my perror():

    PPNEGOT: Input/Output error

    If I close my gtk program to run it again, It work the first time
    again...

    I don't use IRQs and I also don't do anything more than use the
    read and write kernel functions.

    I would like to know what I'm not doing correctly or if I missed
    something in closing the port; Because I assume that when my gtk
    program ends, the ppdev driver cleanup something so it works again
    at the next program execution...

    By the way, do anyone can direct me to some code that does something
    similar ? I'm having a hard time finding some ppdev code !

    I'm using Kernel 2.4.4 with ppdev and parport as modules, on a RedHat
    7.1 distribution. The system is a Toshiba 1750 laptop.

    Here is a summary of the steps I'm doing in a menu callback:

    Open:
     open the device
     claim PPEXCL (I tried without it, same thing)
     claim
     negociate IEEE1284_MODE_ECP

     send a probe command to the device:
      write 3 bytes, read 3 bytes.
      (result are what I expected for whatever commands I sent to it)

     Close:
      PPRELEASE
      close(filedescriptor);

     (gtk_main loop).

    I'm not using anymore PPRDATA and PPWDATA as I know I don't have
    to use them with read() and write().

    Help! ;-)

    Martin Miller
    ivx1@sympatico.ca

    -- 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 : Fri May 18 2001 - 01:47:10 EDT