The ultimate solution for the ADB to connect to Android phones under Linux

Source: Internet
Author: User
Tags lenovo

Turn from:

http://blog.csdn.net/liuqz2009/article/details/7942569

1, the process of doing Android development, encountered the Linux under the ADB can not identify the problem of Android devices, just started on the internet Google, found to be under the Ubuntu some instructions: such as Google provides methods:/HTTP Developer.android.com/tools/device.html, but found by doing these or some Android devices are not connected, so by reading the ADB source code, came up with a number of methods, and everyone together under the encouragement:

A, Google mentioned the method of modifying the/etc/udev/rules.d/51-android.rules:

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

In fact, the purpose of this is to enable ADB to access the created USB node, in fact, as long as the use of root to start the ADB server does not exist this problem. This is done as follows: Run adb start-server on root, and if you already have an ADB command, you need to kill ADB server and run PS aux | grep adb, find the PID of the ADB server and kill it, as on my machine:

Root 2795 0.0 0.0 30556 1244 PTS/2 SL-0:03 adb fo Rk-server Server

Kill the ADB server by executing kill 2795.

b, through the above method or can not identify the Android device, it may be your Android vid could not join the ADB, you need to manually add.

The file location you added is related to the first time you started ADB server, if you started ADB server on root, its location is

/root/.android/adb_usb.ini, otherwise its position under $home/.android/adb_usb.ini, if $home is empty, then under/tmp/.android/adb_usb.ini. If there are no files or directories, please add them manually. Here is an example of a adb_usb.ini:

#for OKWAP C900

0x14b4

#for K-touch W606

0x0525

#for Lenovo Speic

0x2006

Where # starts with a table comment, others represent the vid of Android, and each vid requires a separate line.

Get the Vid method: Plug in the device before running LSUSB, plug in the device, run Lsusb again, the more that is your device, and vid in which such as:

Bus 001 Device 034:id 2006:5,010

2006 of them are the vid.

After adding it in Adb_usb.ini, kill the ADB server and start adb server (refer to the method mentioned in a).

C, if the above two steps to execute the above is not enough, then encountered a headache problem.

Some USB devices are now called "CD-free" devices. Specifically, some of the new USB devices currently contain Windows drivers inside, and when you first plug it in, it acts as a flash and prompts you to install the driver. After the driver is installed, the driver automatically switches the mode of the USB device, and the storage device will disappear (in most cases), and the new device will be generated (such as a USB-type modem). This feature is referred to by the manufacturer of the wireless device as a "CD-free" device. Under Linux, it is automatically switched through the Usb_modeswitch tool. You read here that your device is definitely not in the Usb_modeswitch supported list. At this point you are either waiting for their support, or you are supporting yourself.

To manually support yourself, this is a complex process, you can refer to: http://www.draisberghof.de/usb_modeswitch/

In simple terms, if you want to support yourself, you want to crawl what's going on in windows and let it switch mode. Then you refer to the existing file under the/etc/usb_modeswitch.d/directory and create your own profile, such as: 2006:5,010, where you can add the information you crawled.

Note: Under Windows not too much research, generally installed on the driver, recognized the ADB interface can be recognized. The tablet is similar to Linux, but its $home is empty, so the added directory is in/tmp/.android/adb_usb.ini.

Connect the Golden phone Gionee GN9005. Finally, the second method in the paper

(1) before and after inserting USB, run LSUSB, get device vid

[email protected]:~$ lsusb
bus 002 Device 002:id 8087:0024 Intel Corp Integrated rate Matching Hub
bus 002 Device 0 01:id 1d6b:0002 Linux Foundation 2.0 root hub
bus 001 Device 003:id 17ef:6019 Le Novo
bus 001 Device 002:id 8087:0024 Intel Corp. Integrated rate Matching hub
bus 001 Device 001:id 1d6b:0002 Linux Foundation 2.0 root hub

[Email protected]:~$ Lsusb
Bus 002 Device 018:id 271d:c011
Bus 002 Device 002:id 8087:0024 Intel Corp Integrated rate Matching Hub
Bus 002 Device 001:id 1d6b:0002 Linux Foundation 2.0 root Hub
Bus 001 Device 003:id 17ef:6019 Lenovo
Bus 001 Device 002:id 8087:0024 Intel Corp Integrated rate Matching Hub
Bus 001 Device 001:id 1d6b:0002 Linux Foundation 2.0 root Hub

Get the device vid to 271d

(2) Then create a new file under the/.android path under the home path Adb_usb.ini

The contents are:

#for Gionee GN9005
0x271d

(3) then adb kill-server adb start-server

Succeed in connecting

The ultimate solution for the ADB to connect to Android phones under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.