Re: [PARPORT] newbie questions

From: Tim Waugh (twaugh@redhat.com)
Date: Wed Oct 18 2000 - 07:00:22 EDT

  • Next message: Nordic Boy: "[PARPORT] ATEN AS-152/AS-154 drivers"

    On Mon, Oct 09, 2000 at 11:32:17PM -0500, Peter Keller wrote:

    > However, I looked through ppdev.h and noticed that there isn't a clearly
    > defined interface for me to tell the parport to read/write an address cycle
    > or a data cycle. There is in parport.h, but it looks like I need to be in
    > a kernel driver to use it correctly. Is that the case?

    No, you just need to do something like this:

    mode = IEEE1284_MODE_EPP | IEEE1284_ADDR;
    ioctl (fd, PPNEGOT, mode);
    ...
    mode = IEEE1284_MODE_EPP | IEEE1284_DATA;
    ioctl (fd, PPNEGOT, mode0;
    ...

    If you're already in EPP mode, all the 'negotiation' does is tell
    parport to use address or data mode for future i/o operations.

    > int mode2 = IEEE1284_MODE_EPP;
    > fd = open ("/dev/parport0", O_RDWR | O_NOCTTY);
    > ret = ioctl (fd, PPCLAIM);
    > ret = ioctl (fd, PPNEGOT, &mode2); //negotiates to EPP
    > ret = ioctl (fd, PPSETMODE, &mode2); // sets the driver states
    > ch=0x57;
    > num=1;
    > ret = write (fd, &ch, num); // writes out 0x57 on the port in EPP mode
    >
    > In what context is the data being written out? Data or Address? Also,

    Data.

    > Also, what does PPDATADIR do? I set it to output mode when I write, and

    It _just_ sets the DIRECTION bit of the CTR: if it's 0, you can set
    the data lines; if it's 1, you can read them.

    When you do (e.g.) read() on a ppdev fd it does all that stuff for
    you.

    > I'm sorry for the rapid fire of questions, but ppdev looks very cool, and
    > I seem to be hampered merely by a lack of documentation. :) The archive
    > was very helpful to getting me as far as I've got and I appreciate the
    > imformation in it.

    Did you take a look at
    <URL:http://people.redhat.com/twaugh/parport/html/>? Send patches for
    the bits you don't think are good enough (it's under the GNU
    FDL).. ;-)

    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 Oct 18 2000 - 07:08:58 EDT