Linux under the ADB drive problem Linux using mobile phone USB debugging mode to connect ADB for Android program debugging

Source: Internet
Author: User

Linux under the ADB drive problem
Linux under the use of mobile phone USB debugging mode to connect ADB to the Android program debugging, configuration driver without windows to intuitive.
The first step is to confirm that the phone is connected to the computer, LSUSB check the device record.
[Email protected]:~$ Lsusb
Bus 007 Device 009:id 18d1:4e12
Bus 007 Device 001:id 1d6b:0002 Linux Foundation 2.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

I am here:
Bus 007 Device 009:id 18d1:4e12

Then create a configuration file under/etc/udev/rules.d/: 51-android.rules
sudo vim/etc/udev/rules.d/50-android.rules

The following configuration parameters are added to the file:
subsystem== "USB", sysfs{"high Tech computer Corp."} = = "0bb4", mode= "0666"

Save, set permissions under Configuration file
sudo chmod a+rx/etc/udev/rules.d/50-android.rules

Restart
Sudo/etc/init.d/udev restart

Finally restart the next ADB service, you can (do not configure the environment variable to go to the Android SDK tools directory to execute sudo./adb kill-server./ADB devices)
sudo adb kill-server
sudo adb devices

Add
Sysfs Parameters:
sysfs{"Idvendor"}= "xxx"

The SYSFS parameter in the Linux adb driver configuration file refers to the device manufacturer. The original use case on the official website was "high Tech computer Corp" because HTC helped Google make the phone. But now moto, Sony Ericsson, Samsung and other mobile phone manufacturers to join, Android manufacturers have not only HTC a home. And what if the device model is not 0BB4?
When reading the SDK Help documentation, I found that the SDK has provided instructions:
(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 Devi Ce 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'll 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 the This file:/etc/udev/rules.d/51-android.rules.
For Gusty/hardy, edit the file to read: [Note: Ubuntu 7.10 and later]
subsystem== "USB", sysfs{idvendor}== "0bb4″, mode=" 0666″
For Dapper, edit the file to read: [Note: Ubuntu 6.06 and previous versions]
subsystem== "Usb_device", sysfs{idvendor}== "0bb4″, mode=" 0666″
2. Now execute:
chmod a+r/etc/udev/rules.d/51-android.rules
Just follow the instructions to modify the 0bb4 in the created 51-android.rules file to the appropriate USB vendor ID information.
Like my cell phone is motorola,idvender, it's 22b8.
So this line is
subsystem== "USB", sysfs{idvendor}== "22b8", mode= "0666"

However, you can write multiple lines to use a variety of devices. For example I wrote all of them, as follows:
#Acer 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"

But this above ID, does not include all, I have a device on the hand of the USB ID is not in the above list.
The workaround is that you can use the LSUSB command to view your USB ID
[Email protected]:~$ Lsusb
Bus 002 Device 003:id 413c:2003 Dell Computer Corp. Keyboard
Bus 002 Device 002:id 0461:4d22 Primax Electronics, LTD
Bus 002 Device 001:id 1d6b:0001 Linux Foundation 1.1 root Hub
Bus 001 Device 010:id 18a1:0002
Bus 001 Device 001:id 1d6b:0002 Linux Foundation 2.0 root Hub

Locate the ID 18a1 above and add the device to the file.
subsystem== "USB", sysfs{idvendor}== "18a1", mode= "0666"

Modify/etc/udev/rules.d/51-android.rules do not need to restart the Linux machine, Plug and unplug the device is ready. Run ADB devices again to see that your device is connected
[Email protected]:/opt/android/android-sdk-linux_86/tools$ sudo./ADB devices
List of devices attached
0403502001011000 Device

Linux under the ADB drive problem Linux using mobile phone USB debugging mode to connect ADB for Android program debugging

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.