Ubuntu adb devices : no permissions workaround

After connecting to the Android phone via USB under untun, use adb devices and it will appear as follows:

List of devices attached

???????????? no permissions

Also show the device name in DDMS? ? ? ? , the process name cannot be displayed, and the log cannot be viewed.

1. Tool introduction There are a bunch of tools under
Android -sdk-linux_x86/tools, the one to be used today is: Android Debug Bridge, which is the most used tool in the android development process. (abbreviated adb, a bit like gcc's gdb)

adb start-server - actually it will start an adb fork-server server
adb kill-server - kill
adb devices - list all devices

2. Set usb permissions
Because systems like ubuntu run as non-root by default, to use usb debugging, sudo support is required.

$ lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 413c:2106 Dell Computer Corp.
Bus 002 Device 002: ID 0461:4d81 Primax Electronics, Ltd
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In the list, Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp. This line is the usb port of the htc mobile phone, record it, the id is 0bb4 (based on all the htc above are this ID).

$sudo vim /etc/udev/rules.d/70-android.rules

Add the following:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87",MODE="0666"

where idvendor idProduct refers to the ID of the USB, which can be queried using lsusb.
For example, mine is:
lsusb

Bus 001 Device 010: ID 0bb4:0c87 High Tech Computer Corp

ID 0bb4 is idVendor, 0c87 is idProduct

Run the command to restart udev:

$sudo chmod a+rx /etc/udev/rules.d/70-android.rules
$sudo service udev restart

3. Restart the adb server
(very important) unplug the usb and reconnect it and then execute:

sudo ./adb kill-server
./adb devices
./adb root (this step is very important)

4. Debugging using usb
     The problems in the problem description have been solved so far.

     Select the corresponding devices in DDMS, you can see the log. . . .

5. Knowledge accumulation

       1. Gooogle udev

        2. Unplug usb, use the following command to monitor system information in real time
              sudo tail -f /var/log/messages

6. ubuntu press adb devices and the device list is empty, but lsusb can view the PID and VID

        sudo gedit ~/.android/adb_usb.ini to edit the file

   After adding 0x0bb4, execute the following command

   sudo service udev restart 

   android update adb update service


7. Reference

     1. http://edu.codepub.com/2010/1229/28405.php

     2. http://blog.csdn.net/zhenwenxian/archive/2010/09/23/5901350.aspx

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326693955&siteId=291194637