|
From: Xiaofan C. <xia...@gm...> - 2010-10-07 02:15:35
|
On Thu, Oct 7, 2010 at 2:31 AM, Alan Stern <st...@ro...> wrote: > As far as Linux goes, that's sort of right. One driver isn't > considered "better" than another in any particular way. When the > system looks for a driver for a device, it probes all the drivers it > can find that match the device's or interface's descriptors, until one > of the probes succeeds. This is done in the order the drivers were > registered with the kernel's driver core, complicated by the fact that > drivers can be loaded dynamically in response to device-detection > events and unloaded manually by the user. > > Thus the "best" driver isn't necessarily _better_ than any other, in > any meaningful sense. It simply is the one that was registered > earliest. > > Of course, this means that if you detach a device's driver and then > tell the kernel to reattach a driver, under normal conditions you will > get the same driver as before -- which means the overall effect is the > same as what Tim described. In that case, I think it is better to have the option of attaching a driver which the user wants. I mean it would be good to extend the following two API or new APIs. 1) libusb_kernel_driver_active() can have options to return the driver name, just like the 0.1 API usb_get_driver_np(). Or we can have new API for this purpose. I think extending this API is probably better. 2) libusb_attach_kernel_driver() can be extended to take the driver name as a parameter so that user can specify the driver they want the kernel to attach. -- Xiaofan |