Detach USB Device Driver and Attach it to ugen driver at runtime

Hans Petter Selasky hselasky at c2i.net
Mon Sep 5 13:44:23 UTC 2011


On Monday 05 September 2011 15:40:44 Daniel Grech wrote:
> Hi, I'm using libusb to gain access to raw USB Data from userspace. My
> problem is that this library only works with devices which are treated as
> generic devices ("handled by the ugen driver"). I need a mechanism that
> will allow me to detach any device specific drivers that are attached to a
> device and attach the ugen driver instead. I want to do this without
> re-compiling the FreeBSD Kernel. Thanks in advance for your help.

Hi,

The following functions should be implemented:

     int
     libusb20_dev_detach_kernel_driver(struct libusb20_device *pdev,
         uint8_t iface_index);


     int libusb_detach_kernel_driver(libusb_device_handle *devh, int
     interface) or int libusb_detach_kernel_driver_np(libusb_device_handle
     *devh, int interface) Detach a kernel driver from an interface.  This is
     needed to claim an interface required by a kernel driver.  Returns 0 on
     success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,
     LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
     LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a
     LIBUSB_ERROR code on failure. This function is non-portable.

man libusb20

man libusb

--HPS


More information about the freebsd-hackers mailing list