sorccu / docker-adb

Dockerfile and instructions for ADB.
Other
200 stars 74 forks source link

No /dev/bus/usb virtualization on Mac OS Sierra #8

Closed felclef closed 7 years ago

felclef commented 8 years ago

Anyone else with the same problem?

Without the device's virtual representation, how can I forward it to docker??

Thanks!

sorccu commented 8 years ago

Unfortunately Docker on Mac does not support USB, since the underlying xhyve doesn't support it. The old boot2docker may have worked by tweaking VM settings.

I think the easiest (perhaps only?) way to get it to work would be to use a Linux VM and run docker there instead.

tobiastom commented 7 years ago

When you are talking about xhyve, are you talking about Hypervisor.Framework? Veertu uses this as well and seems to support USB. Maybe things did change in the meantime?

Having this working on Mac OS Sierra would be very very great because I don't have to install Java into the host system.

sorccu commented 7 years ago

Please let me know if that's the case and we can update the instructions.

On Fri, Mar 17, 2017 at 1:28 Tobias Tom notifications@github.com wrote:

When you are talking about xhyve, are you talking about Hypervisor.Framework? Veertu uses this as well and seems to support USB. Maybe things did change in the meantime?

Having this working on Mac OS Sierra would be very very great because I don't have to install Java into the host system.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sorccu/docker-adb/issues/8#issuecomment-287113358, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_TLF0kKn1t-vzFRxhDl33yWPbpqPks5rmWNHgaJpZM4KNzO8 .

tobiastom commented 7 years ago

I'm very glad to help here, but unfortunately I have no idea how to confirm it.

A linux inside a Virtual machine can see the device with adb device. docker-adb can't on the same host system.

Any recommendations on how to debug it?

sorccu commented 7 years ago

Try gaining access to the tiny vm docker for mac uses, see if it's there at least. On Fri, Mar 17, 2017 at 2:07 Tobias Tom notifications@github.com wrote:

I'm very glad to help here, but unfortunately I have no idea how to confirm it.

A linux inside a Virtual machine can see the device with adb device. docker-adb can't on the same host system.

Any recommendations on how to debug it?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sorccu/docker-adb/issues/8#issuecomment-287125391, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_XXvq4TBo67IjU8Su3xPo4Wsh-jBks5rmWwugaJpZM4KNzO8 .

tobiastom commented 7 years ago

Stopping the machine, enabling USB manually in the VirtualBox interface (the machine is based on VirtualBox), and starting it again makes the device appear in lsusb when plugged in:

$ docker-compose run adbd lsusb -v
Bus 001 Device 002: ID 18d1:4ee2
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003

Removing the device will result in this result:

$ docker-compose run adbd lsusb -v
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003

Unfortunately adb devices is not able to see it:

$ docker-compose run adbd adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
sorccu commented 7 years ago

I don't follow 100%, are you saying that you're modifying the Docker for Mac xhyve vm with VirtualBox? Or a separate VM?

Also, I would suggest sharing actual docker run commands instead of docker-compose. Hard to tell what options you are using.

On Fri, Mar 17, 2017 at 2:31 Tobias Tom notifications@github.com wrote:

Stopping the machine, enabling USB manually in the VirtualBox interface (the machine is based on VirtualBox), and starting it again makes the device appear in lsusb when plugged in:

$ docker-compose run adbd lsusb -v Bus 001 Device 002: ID 18d1:4ee2 Bus 001 Device 001: ID 1d6b:0002 Bus 002 Device 001: ID 1d6b:0003

Removing the device will result in this result:

$ docker-compose run adbd lsusb -v Bus 001 Device 001: ID 1d6b:0002 Bus 002 Device 001: ID 1d6b:0003

Unfortunately adb devices is not able to see it:

$ docker-compose run adbd adb devices List of devices attached

  • daemon not running. starting it now on port 5037 *
  • daemon started successfully *

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sorccu/docker-adb/issues/8#issuecomment-287132871, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_Xpi7rbS_fuwsbT8XkrFOnompzdMks5rmXHVgaJpZM4KNzO8 .

swaroopbalan commented 7 years ago

the adb devices is not working in 2nd containers . only works in one container ALl devices are taken by the first container

sorccu commented 7 years ago

That's how it works. Only one adb server can be online at the same time. You should link to that container in order to run commands in other containers.

On Fri, Jul 21, 2017 at 13:34 swaroopbalan notifications@github.com wrote:

the adb devices is not working in 2nd containers . only works in one container ALl devices are taken by the first container

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/sorccu/docker-adb/issues/8#issuecomment-316900230, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-_aBQX2gGpKl9TZaPnET5ckVtm-Peks5sQCpbgaJpZM4KNzO8 .

swaroopbalan commented 7 years ago

thanks for the response .. Now the issue is i have 2 devices connected and i am using below command to docker ,The device connected would be disconnected during flashing so that i have used below command to always show . Now issue with this is that i am not able to see any adb device in another container . So the issue is the device usb port changes when it is disconnected so i am doing this . Hope i am clear in telling the problem i am facing

docker run -it -h basispost101l --name 'basispost101l' -d --privileged -v /dev/bus/usb:/dev/bus/usb --device=/dev/ttyACM0:/dev/ttyRelayCard -p 5001:22 testbench /bin/bash

swaroopbalan commented 7 years ago

I want adb to show all devices in all containers i am not sure if its possible .please let me know

sorccu commented 7 years ago

Closing, since this is more of a Docker for Mac issue.

Febin-kg commented 6 years ago

As mentioned above, using Linux VM seems to the only way. This post was of help

sj542484 commented 5 years ago

What is the situation now? I have the same problem,I don't know how to solve it

Shosta commented 4 years ago

Hi,

I am adding a way to solve this as it is indeed a Mac OS issue and not a docker adb issue.

Following these steps, you should be able to connect to your Android Device, through adb within a Docker Container on a Mac host machine.

You can connect wirelessly to your device through adb. So you just have to connect wirelessly and then connect to your device from your container. It works on Linux, Mac and Windows, so it is pretty consistent if you want to develop on a bunch of different OS.

The way to achieve it is :

  1. Connect your Android device to your host machine with a USB cable.
  2. On your host machine run : adb devices
  3. You should see your device
  4. On your host machine run, to connect wirelessly to your device :
    1. adb tcpip 5555
    2. adb connect 192.168.0.5:5555 (replace the ip address with your android devices)
    3. adb devices
  5. You should see your device connected through USB and wirelessly
  6. Disconnect the USB cable, run adb devices and check that the wireless connection is still active
  7. Launch your Docker container
  8. On your Docker Container, run the following commands :
    1. adb connect 192.168.0.5:5555
    2. adb devices

If you see and unauthorized device, try these commands to fix the issue :

  1. adb kill-server
  2. adb connect 192.168.0.5:5555
  3. adb devices

I hope that will help some people.