~$ find -L /sys/bus/usb/devices -maxdepth 2 -path "*/modalias" -printf "%h\t" -exec cat {} \; | \
awk -F: '/icFFisc42ip0/ {print $1}' | xargs -i cat {}/idVendor | awk '{print"0x"$1}' | sort -u >> ~/.android/adb_usb.ini
awk -F: '/icFFisc42ip0/ {print $1}' | xargs -i cat {}/idVendor | awk '{print"0x"$1}' | sort -u >> ~/.android/adb_usb.ini
But many people also have found this command to be extremely useful for ADB connection trouble-shooting. The command is obviously linux only. And some of my colleagues who still use Windows asked me if I happened to know a similar command for Windows. I gave it some thought and decided to use powershell for the task and here is what I have come up with:
powershell "gwmi Win32_USBControllerDevice | %{[wmi]($_.Dependent)} |
?{$_.CompatibleID -like \"USB\Class_ff^&SubClass_42^&Prot_0?\"} |
%{write \"0x$([regex]::match($_.deviceid.tolower(), 'vid_(\w+)').groups[1].value)\"} |
sort -u" >> %USERPROFILE%\.android\adb_usb.ini
?{$_.CompatibleID -like \"USB\Class_ff^&SubClass_42^&Prot_0?\"} |
%{write \"0x$([regex]::match($_.deviceid.tolower(), 'vid_(\w+)').groups[1].value)\"} |
sort -u" >> %USERPROFILE%\.android\adb_usb.ini
That was a single line I had to split for better readability.
Also if ANDROID_SDK_HOME is set, adb will use %ANDROID_SDK_HOME%\.android\adb_usb.ini instead.
And the best part of it is that to work (i.e. properly detect ADB devices) it does not need any drivers. You will need to install drivers to be able to use adb but not for the detection!
Here is how to use this command for troubleshooting:
Disconnect all other adb devices you might have other than the one you want to troubleshoot. First thing you want to make sure that adb is properly configured on the device side (i.e. "USB debugging" is enabled, etc). Some manufacturers do not test their devices thoroughly which sometimes results in situations when adb works only when combined with other specific interface. I have seen a device which would only enumerate adb interface when in MTP mode but not in PTP or Mass Storage modes. So check different combinations and run the following command after every change:
powershell "gwmi Win32_USBControllerDevice | %{[wmi]($_.Dependent)} |
?{$_.CompatibleID -like \"USB\Class_ff^&SubClass_42^&Prot_0?\"} | fl Name,DeviceID,Service"
?{$_.CompatibleID -like \"USB\Class_ff^&SubClass_42^&Prot_0?\"} | fl Name,DeviceID,Service"
Again that was a single line. The point I am trying to make is that you can not do anything on your PC side to make adb work until this command shows some output. If it shows nothing - the problem is not with your PC software configuration. It is with either your device software configuration or hardware (including PC, android device and everything in between - like USB cables, hubs, etc)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.