ArticleDirectory
- Overview
- Procedure
- Supplement
- References
[Excerpted from] http://blog.csdn.net/zhenwenxian/archive/2010/09/23/5901350.aspx
How to install the android ADB driver in Linux
Overview
Recently, due to the large number of built-in partners, many Android mobile phones of many manufacturers in my Ubuntu system cannot be correctly identified. After some hard work, I checked the SDK, now we have sorted out the ADB driver configuration methods in Linux and solutions to the problems encountered in them and contributed them to you.
Connect to ADB for Android in Mobile USB debugging mode in LinuxProgramThe configuration driver is not intuitive in windows.
Procedure
First confirm that the mobile phone is connected to the computer, lsusb to view the device records.
Matthew @ Matthew- 1230 -Laptop :~ $ Lsusb
Bus 007 device 009: Id 18d1: 4e12
Bus 007 device 001: Id 1d6b: 0002 Linux Foundation2.0 Root Hub
Bus 006 device 001: Id 1d6b: 0001 Linux Foundation 1.1 Root Hub
Bus 005 device 001: Id 1d6b: 0001 Linux Foundation 1.1 Root Hub
Bus 003 device 001: Id 1d6b: 0002 Linux Foundation 2.0 Root Hub
Bus 002 device 001: Id 1d6b: 0001 Linux Foundation 1.1 Root Hub
Bus 001 device 001: Id 1d6b: 0001 Linux Foundation 1.1 Root Hub
Bus 004 device 004: Id 093a:2510 Pixart imaging, Inc.
Bus 004 device 001: Id 1d6b: 0001 Linux Foundation 1.1 Root Hub
Here I am:
Bus 007 device 009: Id 18d1: 4e12
Create a configuration file 51-android.rules under/etc/udev/rules. d /.
Sudo Vim /Etc/Udev/Rules. d/50-Android. Rules
Add the following configuration parameters to the file:
Subsystem="USB", Sysfs{"High Tech Computer Corp ."}="0bb4",Mode="0666"
Save, Set permissions for the configuration file
Sudo ChmodA + RX/Etc/Udev/Rules. d/50-Android. Rules
Restart
Sudo /Etc/Init. d/Udev restart
Then restart the ADB service. (If NO environment variable is configured, go to the android SDK tools directory and run sudo./ADB kill-server./ADB devices)
SudoADB kill-ServerSudoADB Devices
Supplement
Sysfs parameters:
Sysfs{"Idvendor"}="XXX"
The sysfs parameter in the Linux ADB driver configuration file refers to the device vendor. Because it was a mobile phone made by HTC for Google, "High Tech Computer Corp." was first written on the official website .". But now, a group of mobile phone manufacturers, such as Moto, Sony Ericsson, and Samsung, have joined more than HTC. What should I do if the device model is not 0bb4?
When reading the SDK help documentation, I found that the SDK has provided instructions:
(For details, see Docs/GUIDE/developing/device.html)
if you're developing on Ubuntu Linux, you need to add a rules file that contains a USB configuration for each type of device you want to use for development. each device manufacturer uses a different vendor ID. the example rules files below show how to add an entry for a single vendor ID (the HTC vendor ID ). in order to support more devices, you will need additional lines of the same format that provide a different value for the sysfs {idvendor} property. for other IDs, see the Table of USB vendor IDs, below.
1. log in as root and create this file:/etc/udev/rules. d/51-android.rules.
for gusty/hard, edit the file to read: [Note: Ubuntu 7.10 and later versions]
subsystem = "USB ", sysfs {idvendor }== "0bb4", mode = "0666"
for dapper, edit the file to read: [Note: Ubuntu 6.06 and earlier versions]
subsystem = "usb_device ", sysfs {idvendor }== "0bb4", mode = "0666"
2. now execute:
chmod A + R/etc/udev/rules. d/51-android.rules
Follow the instructions to change 0bb4 in the 51-android.rules file to the corresponding USB vendor ID.
For example, my mobile phone is Motorola and idvender is 22b8.
So this line is
Subsystem="USB", Sysfs{Idvendor}="22b8",Mode="0666"
However, you can write multiple lines to use various devices. For example, I wrote all the following:
# ACS 0502 Subsystem = "USB" , Sysfs { Idvendor} = "0502" , Mode = "0666"
# Dell 413c Subsystem = "USB" , Sysfs { Idvendor } = "413c" , Mode = "0666"
# Foxconn 0489 Subsystem = "USB" , Sysfs { Idvendor } = "0489" , Mode = "0666"
# Garmin-Asus 091e Subsystem = "USB" , Sysfs { Idvendor} = "091e" , Mode = "0666"
# HTC 0bb4 Subsystem = "USB" , Sysfs { Idvendor } = "0bb4" , Mode = "0666"
# Huawei 12d1 Subsystem = "USB" , Sysfs { Idvendor } = "12d1" , Mode = "0666"
# Kyocera 0482 Subsystem = "USB" , Sysfs { Idvendor} = "0482" , Mode = "0666"
# LG 1004 Subsystem = "USB" , Sysfs { Idvendor } = "1004" , Mode = "0666"
# Motorola 22b8 Subsystem = "USB" , Sysfs { Idvendor } = "22b8" , Mode = "0666"
# NVIDIA 0955 Subsystem = "USB" , Sysfs { Idvendor} = "0955" , Mode = "0666"
# Pantech 10a9 Subsystem = "USB" , Sysfs { Idvendor } = "10a9" , Mode = "0666"
# Samsung 04e8 Subsystem = "USB" , Sysfs { Idvendor } = "04e8" , Mode = "0666"
# Sharp 04dd Subsystem = "USB" , Sysfs { Idvendor} = "04dd" , Mode = "0666"
# Sony Ericsson 0fce Subsystem = "USB" , Sysfs { Idvendor } = "0fce" , Mode = "0666"
# ZTE 19d2 Subsystem = "USB" , Sysfs { Idvendor } = "19d2" , Mode = "0666"
However, the above IDs cannot include all of them. The usb id of a device is not listed above.
You can use the lsusb command to view your usb id.
Matthew@Matthew-1230-Laptop :~ $ Lsusb
Bus 002 device 003: Id 413c:2003Dell Computer Corp. keyboard
Bus 002 device 002: Id 0461: 4d22 primax electronics, Ltd
Bus 002 device 001: Id 1d6b: 0001 Linux Foundation1.1Root Hub
Bus 001 device 010: Id 18a1: 0002
Bus 001 device 001: Id 1d6b: 0002 Linux Foundation2.0Root Hub
Find the above ID as 18a1 and add the device to the file.
Subsystem="USB", Sysfs{Idvendor}="18a1",Mode="0666"
Modify/etc/udev/rules. d/51-android.rules. You do not need to restart the Linux machine and re-plug the device. Run ADB devices again to see that your device is connected.
Matthew@Matthew-1230-Laptop:/OPT/Android/Android-sdk-linux_86/Tools $Sudo./ADB devices list of devices attached 0403502001011000 Device
Before that, you may see
Matthew@Matthew-1230-Laptop:/OPT/Android/Android-sdk-linux_86/Tools $Sudo./ADB devices list of devices attached ???????????? No Permissions
References
Http://androidappdocs.appspot.com/guide/developing/device.html
Http://androidappdocs.appspot.com/guide/developing/device.html#VendorIds