ADB: Modify the serial number of the device.

Source: Internet
Author: User

After debugging multiple mobile phones in the company, two mobile phones are connected to the computer through USB at the same time for comparison. Suddenly I found that the serial numbers of the two mobile phones were identical when I used the ADB devices command. Because this is the same machine in the company .... This makes it impossible to connect at the same time.

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB Devices
List of devices attached
19761202 Device
19761202 Device

You must modify this number to make a difference ....

Based on experience, I searched for "19761202" in the compiled rootfs"

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/out/target/product/xxxxxxx/root $ grep-Nr "19761202" -- color.
./Init. XXXXXXX. USB. RC: 4: Write/sys/class/android_usb/android0/iserial 19761202

It turned out to be like this ....

Then, just modify the Sys File...

Connect to a machine first, and ADB root goes in...

Root @ Android:/sys/class/android_usb/android0 # Cat iserial
19761202

Root @ Android:/sys/class/android_usb/android0 #
Root @ Android:/sys/class/android_usb/android0 # echo 19761203> iserial
Root @ Android:/sys/class/android_usb/android0 # Cat iserial
19761203

Root @ Android:/sys/class/android_usb/android0 #

Modified successfully!

Now connect the two machines, and then ADB devices it!

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB Devices
List of devices attached
19761202 Device
19761202 Device

Why haven't I changed ???

Three seconds later...

Experience tells me... This should be related to ADB's host service... Kill it first!

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB kill-Server
Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB Devices
* Daemon not running. Starting it now on port 5037 *
* Daemon started successfully *
List of devices attached
19761202 Device
19761203 Device

Oh yeah! Done!

Then you can use the-S parameter of ADB to connect to these machines at the same time.

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB-s 19761202 Root
Restarting adbd as root
Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB-s 19761202 Shell
Root @ Android :/#

In another terminal:

Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB-s 19761203 Root
Restarting adbd as root
Apuser @ yaochuanliubt :~ /Mywork/4.1-3.4/kernel/ARCH/ARM/configs $ ADB-s 19761203 Shell
Root @ Android :/#

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.