Re: [PARPORT] Simple EPP PPNEGOT?

From: Nate Jenkins (nate@uniwest.com)
Date: Mon Feb 10 2003 - 18:09:33 EST

  • Next message: sumanth vidyadhara: "[PARPORT] How to issue device id ioctl"

    To use a LapLink cable, you must have "parport", "parport_pc" and "ppdev"
    already compiled into the kernel or insert via 'insmod' into the kernel.

    #insmod parport
    #insmod parport_pc
    #insmod ppdev

    Then in the c program....
    //////////////////////////////////////////////////////////////
    unsigned char ucData;
    int nPort;

    nPort = open("/dev/parport0", O_RDWR);
    ioctl(nPort, PPCLAIM, 0);

    // ... do stuff

    // to write 5 bits
    ioctl(nPort, PPWDATA, &ucData);

    // ... do stuff

    // to read 8 bits
    ioctl(m_nPort, PPRSTATUS, ucData);

    // ... do stuff

    close(nPort);
    //////////////////////////////////////////////////////////////

    The pin out the LapLink cable is very important... This is why you can read
    8 (although they are really 5 bits and shifted) and why you can only write 5
    bits at a time.

    D7 - xx
    D6 - xx
    D5 - xx
    D4 - ~S7 Remember the "active low verses active high" thing
    D3 - S6
    D2 - S5
    D1 - S4
    D0 - S3
    xx - S2
    xx - S1
    xx - S0

    Good picture of pins to bits
    http://www.doc.ic.ac.uk/~ih/doc/par/

    If you can claim the port after opening it, then you can write anything to
    D4-D0 you want the other end to see in S7-S3 and vice-versa...

    Nate

    ----- Original Message -----
    From: "Bob Tanner" <tanner@real-time.com>
    To: "Nate Jenkins" <nate@uniwest.com>
    Cc: <linux-parport@torque.net>
    Sent: Monday, February 10, 2003 2:10 PM
    Subject: Re: [PARPORT] Simple EPP PPNEGOT?

    > Quoting Nate Jenkins (nate@uniwest.com):
    > > I have had success with using ppdev with a LapLink cable between two PCs
    but
    > > not with the negotiation code you referenced. I ended up having to
    control
    > > it myself on the pin by pin basis.
    > >
    > > So are you trying to talk "to a PC from a PC" or "to Peripheral from
    PC"? I
    > > thought your email said both. Maybe just practicing with PC for now?
    >
    > Can you control the port pin-by-pin in user-space using parport?
    >
    > I can't seem to figure that out.
    > --
    > Bob Tanner <tanner@real-time.com> | Phone : (952)943-8700
    > http://www.mn-linux.org, Minnesota, Linux | Fax : (952)943-8500
    > http://www.tcwug.org, Minnesota, Wireless | Coding isn't a crime.
    > Fingerprint: 02E0 2734 A1A1 DBA1 0E15 623D 0036 7327 93D9 7DA3
    >

    -- 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 Feb 10 2003 - 18:08:23 EST