tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ugen vs interfaces



	Hello.  A couple of items that might help you with your issue.

1.  The way things are supposed to work, I think, is that you open the
control interface, interface 0, and query it for the interfaces the
particular device supports.  Once you get a list of supported interfaces,
you can then open the specific endpoint units for those devices using the
open(2) call.   If you read: /usr/src/sys/dev/usb/usbdi.c and the include
files it references, you'll begin to get the idea.  If you want to see how
all this machinery works from the userland side of the house, I suggest
reading the NetBSD code from the libusb1-1 package.  there is some coverage
of this topic in the usb(4) man pages, and some web searches will turn up
additional notes as well.  

2.  If you're interested, I have a heavily re-worked ugen(4) driver for
NetBSD-5 which I've not yet ported to NetBSD-current which fixes a number
of issues with the ugen(4) driver.  Specifically, the stock ugen(4) driver
coalesses reads and writes from userland into fewer reads and writes to and
from the devices themselves.  For libraries, such as the libimobiledevice
library for Apple products, this behavior is fatal, in that libusb wants to
be able to control, precisely, what's read from and written to devices and
when.  Also, my changes allow poll(2)/select(2) to actually work on ugen
devices.
If you're interested, I'm happy to make my patches available.  I've been
using them heavily for about 6 months, but more testing is always good.

-thanks
-Brian

On Nov 15,  3:18pm, Mouse wrote:
} Subject: ugen vs interfaces
} I'm trying to use ugen - on 5.2, but a look at cvsweb (ugen.4 and
} ugen.c) makes me think current is identical in these regards.  I've
} forced the device of interest to configure as ugen ("flags 1") and my
} code can find it (bus 3 device 3, at the moment, for example).
} 
} The example code I'm working from was designed (of course :-þ) for
} Linux, and seems to use interface 2.  But I can't see how to tell
} NetBSD I want to use interface 2.  I can _find_ interface 2, by walking
} interfaces and endpoints on the control endpoint.  But I can't figure
} out how to tell the kernel I want to do bulk I/O on endpoint 3 of
} interface 2.  The ugen device name specifies the bus and device (via
} the ugen instance, in the high bits) and the endpoint number (in the
} low four bits).  But I can't see anywhere I can set the interface
} number.  I can't see any way to set anything on the control endpoint so
} that opening the /dev/ugen* devices will come up using the interface I
} want and I can't see anything I can do with the endpoint file
} descriptor once opened that will cause it to switch to using the
} interface I want.
} 
} Surely I'm just missing something...but what?
} 
} I can, of course, give more details if they'd help.  But I suspect
} there's just something simple I'm not getting....
} 
} /~\ The ASCII				  Mouse
} \ / Ribbon Campaign
}  X  Against HTML		mouse%rodents-montreal.org@localhost
} / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
>-- End of excerpt from Mouse




Home | Main Index | Thread Index | Old Index