Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
felclef opened this issue Oct 4, 2016 · 15 comments
Closed

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

felclef opened this issue Oct 4, 2016 · 15 comments

Comments

@felclef
Copy link

felclef commented Oct 4, 2016

Anyone else with the same problem?

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

Thanks!

@sorccu
Copy link
Owner

sorccu commented Oct 4, 2016

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
Copy link

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
Copy link
Owner

sorccu commented Mar 16, 2017 via email

@tobiastom
Copy link

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
Copy link
Owner

sorccu commented Mar 16, 2017 via email

@tobiastom
Copy link

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
Copy link
Owner

sorccu commented Mar 16, 2017 via email

@swaroopbalan
Copy link

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

@sorccu
Copy link
Owner

sorccu commented Jul 21, 2017 via email

@swaroopbalan
Copy link

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
Copy link

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

@sorccu
Copy link
Owner

sorccu commented Nov 6, 2017

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

@sorccu sorccu closed this as completed Nov 6, 2017
@Febin-kg
Copy link

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

@sj542484
Copy link

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

@Shosta
Copy link

Shosta commented Oct 26, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants