docker-adb icon indicating copy to clipboard operation
docker-adb copied to clipboard

How to auto connect devices on container restart

Open mkono87 opened this issue 5 years ago • 2 comments

I set this up on my unraid machine. All my containers shutdown for backups over night so I need a way to have it auto connect again to my devices. Possible?

mkono87 avatar Mar 28 '19 17:03 mkono87

Interested in this too. I am connecting via network, not USB. I have to run 'adb connect 192.168.x.x' after container is started, or it's not connected to my device. I'm hoping this can happen automatically on container start

ajobbins avatar Apr 01 '19 11:04 ajobbins

@ajobbins See with this script it connects on startup

#!/bin/sh

sleep 5

DEVICES="192.168.0.206"

echo "Connecting to devices."
for device in $DEVICES; do
   adb connect $device
done
echo "Done."

while true; do
  for device in $DEVICES; do
    adb connect $device > /dev/null 2>&1
  done
  sleep 60
done

When I start he container is auto connects

Connecting to devices.
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.0.206:5555
Done.

But HA is unable to connect to it. So I cant catch a break.

Mon Apr 01 2019 11:29:16 GMT-0400 (Eastern Daylight Time)
Could not connect to mike firetv at 192.168.0.206:5555 using ADB server at 192.168.0.50:5037

mkono87 avatar Apr 01 '19 15:04 mkono87