|
From: Xiaofan C. <xia...@gm...> - 2010-10-06 10:58:09
|
On Wed, Oct 6, 2010 at 6:55 PM, Xiaofan Chen <xia...@gm...> wrote: > On Wed, Oct 6, 2010 at 5:08 PM, Peter Stuge <pe...@st...> wrote: >> Xiaofan Chen wrote: >>> > It is really analogous to libusb0.sys in Windows. >>> >>> Totally different. If I need to use libusb0.sys, then I need to >>> attach it to the device (as a device driver or a filter). >> >> Exactly the same! usbfs must be attached to the device (well, to the >> interface) in order for libusb to work. >> >> The only difference is that Linux includes a generic USB driver >> (usbfs) already and Windows does not, and that when calling >> libusb_claim_interface() on Linux the driver is bound to the >> interface by the kernel. Windows binds the driver much more >> statically. >> > > Okay this is a good point and I can agree with you it is > a kernel driver after all, albeit a generic one. > > However, let's go back to the context of libusb. Say, > for libusb-0.1, what do you expect to return for the > usb_get_driver_np()? > http://libusb.sourceforge.net/doc/ref.nonportable.html > > The typical code to call usb_detach_kernel_driver_np() > is to call usb_get_driver_np() first to see if there are > another driver is attached to the interface. If the existing > kernel driver (not usbfs) is already detached, you do > not need to detach the kernel driver. > > Similar for libusb-1.0, I expect libusb_kernel_driver_active > to return one is only usbfs is bound to the interface. Typo. I expect libusb_kernel_driver_active to return 0 if only "usbfs" is bound to the interface. 0 if no kernel driver is active 1 if a kernel driver is active LIBUSB_ERROR_NO_DEVICE if the device has been disconnected another LIBUSB_ERROR code on other failure > http://libusb.sourceforge.net/api-1.0/group__dev.html#ga76e047ca95da2b32d0e7455da1804a49 > And it is clear not the intention of libusb developers > to ask the user to attach the "usbfs" driver to the interface > for the libusb_attach_kernel_driver(). > > So my conclusion is still "usbfs" kernel driver is > equivalent to no kernel driver in the context of libusb. > > Daniel: if I am wrong, please point out. Thanks. > -- Xiaofan |