David,
Pete Zaitcev poked me with your URL because I have played with
the USB device ID issues in the past. You have LPIOC_GET_BUS_ADDRESS in
your medium want list. This is, of course, because there is currently
no way to map /dev/usb/lpX items to USB bus/device entries at runtime.
I ran into this problem for a simple printing frontend for the New
Internet Computer. My solution was an ioctl like LPIOC_GET_BUS_ADDRESS,
but only for the device ID, as our appliance has but one USB bus. The
patch is attached, and surely can be extended to respond with the bus id
as well.
I am sure (because I do it already) that you can already manage
your high/medium _GET_ queries via /proc/bus/usb/devices. I do not know
if the corresponding _SET_ items are available via usbdevfs. I think
the solution here really depends on your taste in the "ioctls are ugly"
vs "/proc is ugly" war.
Doing the converse of LPIOC_GET_BUS_ADDRESS (retriving the lpX
by an ioctl on the /proc/bus/usb/<busid>/<deviceid> file) would require
a code restructure, as the current driver only holds the minor number as
an index into an array. I didn't feel like going that far, when only a
small number of minors were available for printing. I merely run
through all /dev/usb/lpX entries until I find the one matching my
requested device ID. Not the most efficient, but completes quickly
until someone makes this better.
I haven't seen GET_DEVICE_ID caching the value, but I might have
missed that in the code. I don't rely on the HP status values therein
myself, so I don't worry about it. I don't know that caching gains all
that much, as someone asking likely wants to know. If I had to choose
between caching and avoiding an extra ioctl, I'd avoid the ioctl :-)
Joel
--
"The only way to get rid of a temptation is to yield to it."
- Oscar Wilde
Joel Becker
Senior Member of Technical Staff
Oracle Corporation
E-mail: [EMAIL PROTECTED]
Phone: (650) 506-8127
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel