Re: Bind usb device to another class driver
On Sun, 31 Aug 2014, vichy wrote: > >> My questions: > >> 1. is there anything I need to do, such as PCI driver, before bind to > >> usb-storage driver? > > > > Normally, if uas will bind to a device then usb-storage won't. You can > > change this by using a module paramter for usb-storage: > > > > modprobe usb-storage quirks=1759:5002:u > > > > (1759 and 5002 are the vendor and product IDs for this device.) > Is there any interface priority written in driver to let uas instead > of usb-storage bind the device? Yes. If a device supports both transports then the kernel will use uas instead of usb-storage, because it is more efficient. The quirk overrides this behavior. > BTW, if we try not let uas bind the device, why don't we add the quirk > in uas but usb-storage? What is the "u" at the end of command mean? In fact, uas uses usb-storage for quirk handling. So if you add the quirk to usb-storage then it will apply to both drivers. The 'u' means: Don't use the uas driver. This is supposed to be explained in Documentation/kernel-parameters.txt, but it got left out. I will have to add it. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Bind usb device to another class driver
hi Greg: 2014-08-30 2:31 GMT+08:00 Greg KH : > On Fri, Aug 29, 2014 at 11:18:39AM +0800, vichy wrote: >> hi all: >> I have read the article below and try to do the same operation on my device. >> http://lwn.net/Articles/143397/ >> >> My environment: >> 1. my kernel is 3.16 >> 2. device descriptor is attached. >> 3. below are my operation logs: >># echo -n "4-2:1.0" > /sys/bus/usb/drivers/uas/unbind >># echo -n "4-2:1.0" > /sys/bus/usb/drivers/usb-storage/unbind >>bash: echo: write error: No such device > > You unbound your device from two different drivers? Of course the > second one doesn't work, it's not bound there :) sorry for my typo ^^ BTW, is bind/unbind a part of bus driver call backs, since I only find them in /sys/bus. If so, # pwd /sys # find ./ -name 'unbind' ./bus/cpu/drivers/processor/unbind ./bus/i2c/drivers/rc5t583/unbind ./bus/i2c/drivers/smsc/unbind ./bus/i2c/drivers/88PM860x/unbind ./bus/i2c/drivers/dummy/unbind .. appreciate all your kind help, -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Bind usb device to another class driver
hi alan: 2014-08-29 22:54 GMT+08:00 Alan Stern : > On Fri, 29 Aug 2014, vichy wrote: > >> hi all: >> I have read the article below and try to do the same operation on my device. >> http://lwn.net/Articles/143397/ >> >> My environment: >> 1. my kernel is 3.16 >> 2. device descriptor is attached. >> 3. below are my operation logs: >># echo -n "4-2:1.0" > /sys/bus/usb/drivers/uas/unbind >># echo -n "4-2:1.0" > /sys/bus/usb/drivers/usb-storage/unbind >>bash: echo: write error: No such device >># > > Why do you want to bind your drive to usb-storage instead of uas? I read the article from the web but have no real test case to try on my pc until I found there are both usb-storage and uas interface on my external hard disk. > >> My questions: >> 1. is there anything I need to do, such as PCI driver, before bind to >> usb-storage driver? > > Normally, if uas will bind to a device then usb-storage won't. You can > change this by using a module paramter for usb-storage: > > modprobe usb-storage quirks=1759:5002:u > > (1759 and 5002 are the vendor and product IDs for this device.) Is there any interface priority written in driver to let uas instead of usb-storage bind the device? BTW, if we try not let uas bind the device, why don't we add the quirk in uas but usb-storage? What is the "u" at the end of command mean? > >> 2. I can check whether the usb device is bound to specific driver >> through "cat /sys/kernel/debug/usb/devices". >>is there any alternative way to do so? how about other drivers, >> except usb, to let user know whether the binding/unbinding >> successfully and which device is bound to which driver? > > ls -l /sys/bus/usb/devices/.../driver > > where you fill in the "..." with the path for the interface you are > interested in, such as 1-4:1.0. Alternatively, > > ls /sys/bus/usb/drivers/.../ > > where you fill in the "..." with the name of the driver you are > interested in. > I found what you mentioned ^^ appreciate your help, -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Bind usb device to another class driver
On Fri, Aug 29, 2014 at 11:18:39AM +0800, vichy wrote: > hi all: > I have read the article below and try to do the same operation on my device. > http://lwn.net/Articles/143397/ > > My environment: > 1. my kernel is 3.16 > 2. device descriptor is attached. > 3. below are my operation logs: ># echo -n "4-2:1.0" > /sys/bus/usb/drivers/uas/unbind ># echo -n "4-2:1.0" > /sys/bus/usb/drivers/usb-storage/unbind >bash: echo: write error: No such device You unbound your device from two different drivers? Of course the second one doesn't work, it's not bound there :) See Alan's response for a better explanation of how to do this properly. thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Bind usb device to another class driver
On Fri, 29 Aug 2014, vichy wrote: > hi all: > I have read the article below and try to do the same operation on my device. > http://lwn.net/Articles/143397/ > > My environment: > 1. my kernel is 3.16 > 2. device descriptor is attached. > 3. below are my operation logs: ># echo -n "4-2:1.0" > /sys/bus/usb/drivers/uas/unbind ># echo -n "4-2:1.0" > /sys/bus/usb/drivers/usb-storage/unbind >bash: echo: write error: No such device ># Why do you want to bind your drive to usb-storage instead of uas? > My questions: > 1. is there anything I need to do, such as PCI driver, before bind to > usb-storage driver? Normally, if uas will bind to a device then usb-storage won't. You can change this by using a module paramter for usb-storage: modprobe usb-storage quirks=1759:5002:u (1759 and 5002 are the vendor and product IDs for this device.) > 2. I can check whether the usb device is bound to specific driver > through "cat /sys/kernel/debug/usb/devices". >is there any alternative way to do so? how about other drivers, > except usb, to let user know whether the binding/unbinding > successfully and which device is bound to which driver? ls -l /sys/bus/usb/devices/.../driver where you fill in the "..." with the path for the interface you are interested in, such as 1-4:1.0. Alternatively, ls /sys/bus/usb/drivers/.../ where you fill in the "..." with the name of the driver you are interested in. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Bind usb device to another class driver
hi all: I have read the article below and try to do the same operation on my device. http://lwn.net/Articles/143397/ My environment: 1. my kernel is 3.16 2. device descriptor is attached. 3. below are my operation logs: # echo -n "4-2:1.0" > /sys/bus/usb/drivers/uas/unbind # echo -n "4-2:1.0" > /sys/bus/usb/drivers/usb-storage/unbind bash: echo: write error: No such device # My questions: 1. is there anything I need to do, such as PCI driver, before bind to usb-storage driver? 2. I can check whether the usb device is bound to specific driver through "cat /sys/kernel/debug/usb/devices". is there any alternative way to do so? how about other drivers, except usb, to let user know whether the binding/unbinding successfully and which device is bound to which driver? thanks for your help in advance, usb_hd_desc.tar.bz2 Description: BZip2 compressed data