Sunday, November 27, 2016

usb - How to connect to multiple devices at the same time using adb?


Things I'm using:




  • PC: MacBook Pro (Late 2013), OS X Yosemite version 10.10.4




  • USB: ORICO H7928-U2/U3 USB 3.0





  • Smartphones: LG G4, Samsung Galaxy Note 2




  • ADB version: 1.0.32




I'm trying to connect multiple devices and run at the same time under Eclipse IDE by using ADB, but when I connect two devices, one device status is offline or not listed.





  • Connection status:


    pc right usb port ---------- usb hub ---------------- LG G4
    └--------------------- galgaxy note2


  • Command line in terminal:


    nice7285@SJLIMsMacBook13:/Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools$ ./adb devices
    adb server is out of date. killing...
    * daemon started successfully *
    List of devices attached
    LGxxxxxxxxxxxxxx device



  • Output when disconnecting all devices from USB hub and reconnecting them:


    nice7285@SJLIMsMacBook13:/Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools$ ./adb kill-server 
    nice7285@SJLIMsMacBook13:/Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools$ ./adb devices
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached
    Galaxyxxxxxxxxxxx device


    or


    nice7285@SJLIMsMacBook13:/Applications/adt-bundle-mac-x86_64-20140702/sdk/platform-tools$ ./adb devices 
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached
    LGxxxxxxxxxxxxxx offline
    Galaxyxxxxxxxxxx offline


What is best way to connect to multiple devices simultaneously?




Answer



This is one example, you have to make the split, it's doesn't seem to be an option,


root@kali:# adb devices
List of devices attached
4fddcdd8054fc421 device
5cf4b0890675d95c device

root@kali:# export DEVA=4fddcdd8054fc421 && export DEVB=5cf4b0890675d95c

root@kali:# adb -s $DEVA shell uname -a && adb -s $DEVB shell uname -a


Linux localhost 3.4.0-Mina-my-love-53x--gae7828f #1 SMP PREEMPT Sun May 31 00:41:26 EDT 2015 armv7l GNU/Linux
Linux kali 3.4.0-Mina-my-love-33x--gdba1771-dirty #1 SMP PREEMPT Thu Aug 6 18:05:16 EDT 2015 armv7l GNU/Linux
root@kali:#


  • Export a variable for each device serial.

  • adb -s $VAR1 shell && adb -s $VAR2 shell


Note this is done without a hub. It might be the hub throwing things off?



Also apparently you dont need to && when exporting/echoing variables


root@kali:# export DEVA=4fddcdd8054fc421 DEVB=5cf4b0890675d95c
root@kali:# echo $DEVA $DEVB
4fddcdd8054fc421 5cf4b0890675d95c

No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...