title: Linux: How to assign USB driver to device
body: <p>This question is two-fold: </p>
  
  <p>1- How do you manually detach a driver from a USB device and attach a different one? For example, I have a device that when connected automatically uses the usb-storage driver. </p>
  
  <p>// usbview output</p>
  
  <pre><code>Vendor Id: xxxx
  Product Id: xxxx
  ...
      Number of Interfaces: 2
      Interface Number: 0
          Name: usb-storage
          Number of Endpoints: 2
          ...
      Interface Number: 1
          Name: (none)
          Number of Endpoints: 2
          ...
  </code></pre>
  
  <p>I do not want to use the usb-storage driver, so I have an application running on the host in which I use the libusb library to detach the usb-storage driver and then I claim the interface. I then can send data to and from the applications running on my USB device and on my host Linux system.</p>
  
  <p>How do you detach a driver manually outside of an application? </p>
  
  <p>2- How do I automatically assign the driver to attach on device plugin. I currently have a udev rule setup to set the device permissions automatically.</p>
  
  <pre><code>SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", MODE="0666"
  </code></pre>
  
  <p>Can I use udev rules to assign drivers to specific interfaces on the USB device? For example, if I wanted the usbnet module to be used on automatically on interface 0 instead of usb-storage, is that possible in udev?</p>
  
  <p>Thanks,</p>
  
  <p><em>(I'm a little confused about how StackExchange works with it's different sites or if they are all the same. This is a Linux question so it was also posted on Unix &amp; Linux. Forgive me if it shouldn't be posted here too, but StackOverflow also handles Linux, so...)</em></p>