From: BinaryFrost on
I have a USB-to-Parallel cable which successfully shows up as /dev/
usblp0 under Ubuntu:

Apr 7 14:45:50 lapfrost kernel: [ 1476.746966] usb 4-1: new full
speed USB device using uhci_hcd and address 3
Apr 7 14:45:50 lapfrost kernel: [ 1476.896270] usb 4-1: configuration
#1 chosen from 1 choice
Apr 7 14:45:50 lapfrost kernel: [ 1476.938188] usblp0: USB
Bidirectional printer dev 3 if 0 alt 0 proto 2 vid 0x4348 pid 0x5584

With standard parallel ports I can access the IO lines with inb/outb
and a base address.

How do I achieve this with the USB-to-parallel cable? Are there calls
to the usblp subsystem then I can make to get direct access to the IO
lines?

I've had a look through the kernel source, which mentions
usblp_open(), the usblp struct etc - but I'm not sure how to call
these.

Any suggestions or (even better) examples would be appreciated.

Many thanks in advance.
From: Dances With Crows on
BinaryFrost staggered into the Black Sun and said:
> I have a USB-to-Parallel cable which successfully shows up as /dev/
> usblp0 under Ubuntu. With standard parallel ports I can access the IO
> lines with inb/outb and a base address. How do I achieve this with
> the USB-to-parallel cable?

If you want to use this device at a low level (turning individual pins
on and off, etc.) then I think usblp is the wrong thing to use. From
the comments in the source, usblp is for driving printers, and has a
number of structs and functions for that purpose. I think you may want
the uss720 module instead.

> Are there calls to the usblp subsystem then I can make to get direct
> access to the IO lines?

Not from userspace. From what I can tell, if you can put the device
into manual mode, you can open /dev/parportN and issue various ioctl()s,
read()s, and write()s to that parport device. It might be worth looking
at the "parapin" library for how to do that in a reasonably efficient
way.

--
"Dreams? Best leave dreams to those that can afford them."
--Aunt Cordelia, _Wizard and Glass_, Stephen King
My blog and resume: http://crow202.dyndns.org:8080/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
From: BinaryFrost on
On Apr 7, 4:25 pm, Dances With Crows <danceswithcr...(a)usa.net> wrote:
> BinaryFrost staggered into the Black Sun and said:
>
> > I have a USB-to-Parallel cable which successfully shows up as /dev/
> > usblp0 under Ubuntu.  With standard parallel ports I can access the IO
> > lines with inb/outb and a base address.  How do I achieve this with
> > the USB-to-parallel cable?
>
> If you want to use this device at a low level (turning individual pins
> on and off, etc.) then I think usblp is the wrong thing to use.  From
> the comments in the source, usblp is for driving printers, and has a
> number of structs and functions for that purpose.  I think you may want
> the uss720 module instead.
>

Thanks - although having a look at the uss720 driver it appears that
it will only work for those USB-to-printer cables based around the
USS720 chips - unsurprisingly really (http://www.linux-usb.org/USB-
guide/x532.html).

Does anyone know how I fond out which chip my cable is based on?

> > Are there calls to the usblp subsystem then I can make to get direct
> > access to the IO lines?
>
> Not from userspace.  From what I can tell, if you can put the device
> into manual mode, you can open /dev/parportN and issue various ioctl()s,
> read()s, and write()s to that parport device.  It might be worth looking
> at the "parapin" library for how to do that in a reasonably efficient
> way.
>

Yes parapin looks good - and this is what I want to use it for
(controlling individual pins on the port) - although I was just going
to achieve this with some creative bit-masking. It looks as though
parapins access to the device is still based on base addresses 0x378
etc (from parapin.h).

> --
>    "Dreams?  Best leave dreams to those that can afford them."
>    --Aunt Cordelia, _Wizard and Glass_, Stephen King
>   My blog and resume:http://crow202.dyndns.org:8080/wordpress/
> Matt G|There is no Darkness in Eternity/But only Light too dim for us to see