[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: libusb-1.0 for NetBSD
On Thu, May 31, 2012 at 1:26 AM, Eric Haszlakiewicz
> On Wed, May 30, 2012 at 04:45:13PM +0100, Stephen Borrill wrote:
>> On Wed, 30 May 2012, Xiaofan Chen wrote:
>> >libusb-1.0 under OpenBSD/NetBSD use ugen, so only
>> >ugen device are supported.
>> One of the problems with libusb with NetBSD is that it cannot detach a
>> driver and reattach ugen. So if uhid has attached, you are stuck with it.
The kernel detaching and attaching function of libusb is
only implemented under Linux where the usbfs driver
can be the fall back driver if you detach the existing
device driver and usbfs is what libusb is based on under
For Windows, it is possible to switching driver manually
or using program but it is an expensive operation and thus
it is out of libusb.
I am not so sure if NetBSD can borrow the idea from
FreeBSD's USB stack written by HPS.
It is a very nice feature that FreeBSD 9 loads ugen along
with uhid for generic USB HID device like my Microchip
PICKit 2. With that, I can use libusb based program on
generic HID device without the need to do anything.
ugen0.2: <Microchip Technology Inc.> at usbus0
uhid0: <Microchip Technology Inc. PICkit 2 Microcontroller Programmer,
class 0/0, rev 2.00/0.02, addr 2> on usbus0
uhid0: at uhub0, port 1, addr 2 (disconnected)
But of course this will be quite a bit of work since it
involve kernel modification.
The other possibility is to learn from Mac OS X where
you can use a code-less kext to prevent the existing
kernel driver from attaching to a device (or a class
of device) based on certain criteria.
> I just ran into this problem myself. I was thinking of adjusting the usb
> code so all devices can support the same ioctl's that ugen supports, but
> things got a bit trickier than I expected.
> One of the problems is that not all usb devices have a device node in /dev,
> and there's no way to walk the device tree by (e.g.) operating on a hub
> device (/dev/usb0) so there doesn't seem to be a way to indicate that you
> want to do something with a particular usb device. :(
Main Index |
Thread Index |