Thursday, November 13, 2014

How to make the truly universal adb and fastboot drivers for Windows

There are many internet sites out there offering so-called universal adb driver packs for Windows. Usually it's a repacked Google USB Driver package for Nexus devices with its android_winusb.inf file updated to include various USB VendorID and ProductID combinations. Why it is not truly universal? Because if your device's combination is not included - it obviously will not be supported by such driver package.

Yet Microsoft has made it quite easy to make a truly universal driver. When looking for a proper driver for the new device Windows can match not only by the HardwareID (i.e. combination of USB VendorID, ProductID and optionally InterfaceNumber) but also by CompatibleID (i.e. combination of InterfaceClassID, InterfaceSubClassID and InterfaceProtocolID) which is fortunately the same for all android adb and fastboot interfaces for both simple and composite USB devices.

A few years ago I have made such driver and I have been successfully using it with many different Android devices before I completely switched to linux environment for all my development. Here's how you can make one for yourself:

  • Download the latest Google USB driver package from the link above
  • Unzip the usb_driver folder
  • Open the usb_driver\android_winusb.inf file in a text editor (the Notepad will work)
  • Replace the [Google.NTx86] and [Google.NTamd64] sections with the lines below:

  • [Google.NTx86]
    %SingleAdbInterface% = USB_Install, USB\Class_ff&SubClass_42&Prot_01
    %SingleBootLoaderInterface% = USB_Install, USB\Class_ff&SubClass_42&Prot_03

    [Google.NTamd64]
    %SingleAdbInterface% = USB_Install, USB\Class_ff&SubClass_42&Prot_01
    %SingleBootLoaderInterface% = USB_Install, USB\Class_ff&SubClass_42&Prot_03

  • Save the file and you got yourself a truly universal adb driver!


Do not forget to update %USERPROFILE%\.android\adb_usb.ini if needed.

After installing properly modified driver the following command should say WinUSB in the Service line:

powershell "gwmi Win32_USBControllerDevice | %{[wmi]($_.Dependent)} |
?{$_.CompatibleID -like \"USB\Class_ff^&SubClass_42^&Prot_0?\"} | fl Name,DeviceID,Service"


And here is the whole inf file already modified:

8 comments:

  1. This is awesome! I was searching all over trying to discover why my Nexus 7 would communicate just fine with adb until I entered recovery mode, at which point adb wouldn't not recognize my device. This solved it! [This was encountered while sideloading Nexus 7 5.0.1 OTA package]. Thank you so so very much!!!

    ReplyDelete
  2. Super fricking awesome Alex, top marks to you!! :)

    ReplyDelete
  3. Install Error

    The hash for the file is not present in the specified catalog file. The file is likely corrupt or the victim of tampering.

    ReplyDelete
    Replies
    1. You need to disable Driver Signature Verification to use unsigned drivers in Windows 8

      Delete
    2. Yeah, I got it already, but thanks.

      Delete
  4. Where do you save the file after modifying

    ReplyDelete
  5. Excellent - at long last adb is working on my Hudl2.
    Thanks a lot.

    ReplyDelete
  6. Very interesting! Good job! Just a question: isn't there any need to configure the CompositeAdbInterface too? Or is it just a matter of identification/description strings, non-relevant for the protocol? At https://github.com/koush/UniversalAdbDriver/pull/23 it is proposed to use:

    %CompositeAdbInterface% = USB_Install, USB\Class_FF&SubClass_42&Prot_01
    %SingleAdbInterface% = USB_Install, USB\Class_FF&SubClass_42&Prot_03

    suggesting about that Prot_01 is (always?) used. How did you chose the interface name for a protocol?

    By the way, I'm willing to try the android usb driver with an old smartphone, in place of an old (vendor) driver. This phone, with its driver, is recognized as Adb Composite Interface in 'normal' mode and is found compatible with USB\Class_FF&SubClass_42&Prot_01, while in bootloader mode (adb reboot bootloader) that's not recognized properly, but is found compatible with USB\Class_FF&SubClass_42&Prot_03 (its hardware id in this case is USB\VID_18D1&PID_D00D&REV_0100 that should be (according to its old driver .inf file) an "Android Sooner Single ADB Interface". Thus, Prot_03 should be specific for bootloader interface, which in turn should be a single interface, but what about Prot_01? Must it be set properly to either Composite or Single or does an arbitrary choise make no difference?

    ReplyDelete