7

I have followed various instructions and finally was able to connect my ZTE Blade to my Ubuntu laptop for USB debugging. The same setup does not work when I exchange the phone by my "no-name" i.onik TP10.1-1500DC tablet.

I have tried different cables and different USB ports. Do I need a special type of cable to connect a tablet for USB debugging?

This is what I get from a root shell:

~# adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 

~#

(I know that it should be possible to run adb as non-root, but this test was to rule out permission errors.)

The lsusb output is special for this device, no textual description is shown. The first entry below is from another device, the second entry from the tablet. I have verified this by running lsusb with and without the tablet attached:

Bus 002 Device 005: ID 10d5:5000 Uni Class Technology Co., Ltd 
Bus 002 Device 009: ID 2207:0010  

Of course, USB debugging is enabled in the tablet's settings, and I have already rebooted it.

Any further hints?

krlmlr
  • 173
  • 1
  • 2
  • 12
  • 1
    You might want to check Configuring ADB for Nexus 4 on Ubuntu 11.10. Maybe you omitted the step to make your device known :) – Izzy Jun 25 '13 at 16:02
  • @Izzy: Adding the manufacturer ID to the adb_usb.ini file solved the issue right away. Thanks a lot! Care to write an answer so that I can accept it? – krlmlr Jun 25 '13 at 17:07
  • Sure thing, just did it. As we have the details already in the linked question, I kept it more general. Glad it solved that easily -- but on the other hand, that was just what I expected :) Enjoy! // Btw, for other machines to set up easily, you might also be interested in Is there a minimal installation of ADB? -- which was what finally convinced me to do it: Just copy a few files, and you're done. No need for the entire SDK if you're not a dev :) – Izzy Jun 25 '13 at 18:39
  • @Izzy: In Ubuntu, I can install adb using apt-get install android-tools-adb. No need to ever copy files or adjust PATH settings. The package itself is tiny and contains only adb and a couple of necessary files. – krlmlr Jun 25 '13 at 22:20
  • I know of that (as I'm using Ubuntu as well). But I've also heard it carries with it a bunch of dependencies -- which is why I resorted to the "copy variant". Here the executables are compiled statically, so that always works no matter the distribution. – Izzy Jun 25 '13 at 22:29
  • @Izzy: Right, the dependency on zlib1g will break libxml2 and texlive-binaries. Hm... Heavy. – krlmlr Jun 25 '13 at 22:31
  • See? There it starts. So instead of fiddling around with tricky dependencies to fix a "simple apt-get install", in the end it proves much simpler to download and unpack a file manually :) – Izzy Jun 25 '13 at 22:37
  • @Izzy: Wait, I was wrong. It would only break libxml2 or texlive-binaries if these packages are very old. In practice I'd always go for the apt approach unless an installation tries to uninstall half of my system, but that's not the case here. Anyway, both methods of getting the files are valid and work most of the time :-) – krlmlr Jun 25 '13 at 22:41

3 Answers3

7

Izzy’s answer is misleading. Two unrelated things were mixed up (the vendor ID list in adb on one side and the permission setup in Linux on the other side).

1) devices considered by adb:

Adb has a hard-coded list of USB vendor IDs it tries. E.g. HTC mobile phones use 0xbb4, which is listed (source file usb_vendors.c), while 0x2207 is not.

The only way to add to this list (without patching the source) is to put vendor IDs in the file $HOME/.android/adb_usb.ini, line by line. (HOME is set up right?)

No special cable is needed.

2) permission setup for non-root access:

The udev-fiddling is to give user-access to e.g. /dev/bus/usb/002/009 (bus number/device number change; see lsusb for current values).

The details of this are not relevant to the original poster’s question, as he ran adb as root.

Robert Siemer
  • 1,188
  • 1
  • 14
  • 23
3

As described in Configuring ADB for Nexus 4 on Ubuntu 11.10, under Linux it is important to be listed in either ~/.android/adb_usb.ini (user based) or /etc/udev/rules.d/51-android.rules. Syntax for both files differs: while in the first case it's sufficient to simply add the vendor id (echo 0x18d1 >> ~/.android/adb_usb.ini for a Nexus 4), the entry for the UDEV rule is a bit more complex. Details can be found in the linked question (or rather its answers).

Im krlmlr's case, it was not an "either-or", but seemingly both parts were needed (I never had that before, and I never even used the adb_usb.ini -- but that doesn't mean there are no such exceptions). By adding the device in both places (which cannot hurt anyway), the device finally showed up.

Two additional remarks: After changing the UDEV rules, the UDEV service needs to be restarted to accept the changes. On Ubuntu, this can be done via sudo service udev restart (alternatively, you can simply force UDEV to reload its rules using udevadm control --reload-rules). If your device is still not detected, it most likely was plugged in while you did the changes; you need to disconnect and reconnect the USB cable then. Of course, USB Debugging must be enabled in your device :)

Example

by krlmlr

Based on the following output of lsusb for the Android device in question:

Bus 002 Device 009: ID 2207:0010  

it was necessary to create /etc/udev/rules.d/51-android.rules as root with the following contents:

SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0010", MODE="0660", GROUP="plugdev"

and to create ~/.android/adb_usb.ini with the following contents:

0x2207

The first is required to allow regular users (that belong to the group plugdev) to access the device. Note the permission mask 0660 instead of the frequently seen 0666 which is weaker from a point of view of security (the latter allows "world" access, while the former only allows "user and group" access). The second is required so that adb attempts to talk to the device in the first place. After that:

sudo chmod a+r /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
adb kill-server

and unplug+plug your Android device. Then,

adb devices

finally showed the Android device.

Remark by Izzy:

For my LG Optimus 4X HD, it was sufficient to add one line to /etc/udev/rules.d/51-android.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="1004", ATTRS{idProduct}=="61a6", MODE="0666" GROUP="androiddev", SYMLINK+="android%n"

Maybe the SYMLINK option makes the difference that I didn't need the extra entry in ~/.android/adb_usb.ini.

Izzy
  • 91,166
  • 73
  • 343
  • 943
  • Note that I have already added my tablet to a file in rules.d. From my understanding, I had to do both: The setting in the .ini file is required for "no-name" devices of which adb does not know that they run Android, while the rules.d setting is required in order to access the device without root privileges. – krlmlr Jun 25 '13 at 22:23
  • I've never added a device to that ini file, always only to the UDEV rules file. Maybe you missed something when doing that? To my knowledge, one of the two variants is sufficient. In my case the UDEV part works fine, and I've read many reports where the Ini-file variant did it without any special UDEV adjustments. – Izzy Jun 25 '13 at 22:30
  • No, after your comment the only thing I did was patching the .ini file, and it worked without even having to restart udev, as regular user. (I had to restart the adb server, though.) I had already added the device to the rules with no avail. This particular piece of information about the .ini file is very difficult to find, let's create a Q&A that finally sorts things out :-) – krlmlr Jun 25 '13 at 22:34
  • Try removing (or commenting out) the changes to UDEV, restart the UDEV service, and you will find it still works. And I agree with you: I was surprised to read about the Ini file solution as well. As for your Q&A suggestion: just check the ADB tag-wiki :) – Izzy Jun 25 '13 at 22:40
  • No, it doesn't. I need both the rules and the .ini. Really. I have just checked all combinations. Moreover, as you have stated correctly, the .ini must live in the home of the corresponding user -- so, if you intend to run adb as root, you have to add it to root's .android directory. – krlmlr Jun 25 '13 at 22:51
  • Perhaps one subtle detail: For changed udev rules to have an effect, you must restart udev (or run udevadm control --reload-rules) and unplug+plug your USB device. – krlmlr Jun 25 '13 at 22:55
  • OK -- again learned something new: There are cases where both is needed. Never had that before. And yes, good hint with "restart and unplug/plug", I can confirm that one. – Izzy Jun 25 '13 at 22:56
  • The rules are not needed if you run adb as root and (if necessary) have the adb_usb.ini in root's .android directory. Just checked that, too. – krlmlr Jun 25 '13 at 23:00
  • So this answer is not acceptable to you anymore? Shall I integrate some of the comments? :) – Izzy Jun 26 '13 at 06:48
  • Your hint was crucial and helped me fix my problem. But so far the answer is imprecise, and it would be great if it included the essence of our findings for later reference, especially concerning the difference between ini and rules. – krlmlr Jun 26 '13 at 07:23
  • You've made your point -- and I've made my edit :) Full ack to congregate important information from comments and have them included with the answer itself -- that's what I also encourage many times, as nobody goes through all the comments (especially when there are that many). – Izzy Jun 26 '13 at 07:37
  • I have added an example with actual file contents that shows how I got this to fly. – krlmlr Jun 26 '13 at 08:04
  • No, the SYMLINK option didn't help, I still need the .ini file. – krlmlr Jun 26 '13 at 11:13
0

Try to edit adb_usb.ini and add your device id you can find it by going to the device manager find the "Android ADB Interface" double click on it go to the details tab, and on the "Property" drop down menu select "Hardware Ids" on the box below it labeled "Values" You should see something like "USB\VID_2207&PID_0010&MI_01" The numbers maybe different based on your device vendor id, for example my vendor id is "2207" No open the adb_usb.ini located on the folders below and add your device id in hex format

for example my device id is "2207" I'll put it there as "0x2207"

It is usually located in

  1. XP: \Documents and Settings.android\
  2. Windows 7: \Users.android\
  3. Windows 7: \Users.android\

But if the folder doesnt exist try to create it by using cmd. And if the file adb_usb.ini also doesnt exist you can create it using notepad and only pasting only your device id and save it on the .android folder.

mlclopez
  • 1
  • 1