Forums - Access HDK 888 in Docker Container

6 posts / 0 new
Last post
Access HDK 888 in Docker Container
clovett
Join Date: 30 May 16
Posts: 17
Posted: Fri, 2023-02-03 18:21

I'm connecting 4 HDK 888 devices to Azure Arc so I can include SNPE hardware inference latency testing in an Azure ML pipeline. The devices are connected to a Linux machine running Ubuntu 18.04 and they work perfectly there, "adb devices" lists them, etc.  

But I need to create a docker container that can access those same devices, and after much searching I have found "docker run -ti -d --privileged -d -p 4723:4723 -v /dev/bus/usb:/dev/bus/usb name" is the recommended way to give the container access to the host usb devices.  But "adb devices" in the docker container returns empty list.  But "lsusb" shows the devices no problem as shown below.  

Has anyone got past this point to get "adb" to work properly in the docker container with the HDK 888 devkits?

root@25126bbc126f:/home/archai# lsusb

Bus 002 Device 002: ID 8087:8002 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:800a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 097: ID 05c6:901d Qualcomm, Inc.
Bus 004 Device 096: ID 05c6:901d Qualcomm, Inc.
Bus 004 Device 010: ID 0451:8140 Texas Instruments, Inc.
Bus 004 Device 098: ID 05c6:901d Qualcomm, Inc.
Bus 004 Device 099: ID 05c6:901d Qualcomm, Inc.
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 05c6:9501 Qualcomm, Inc.
Bus 003 Device 009: ID 05c6:9500 Qualcomm, Inc.
Bus 003 Device 008: ID 05c6:9501 Qualcomm, Inc.
Bus 003 Device 007: ID 05c6:9500 Qualcomm, Inc.
Bus 003 Device 005: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

  • Up0
  • Down0
handzhu
Join Date: 6 Jun 22
Posts: 54
Posted: Sun, 2023-02-05 18:01
1: in ~/.android/ create adb_usb.ini
2: vi adb_usb.ini
3: add your device usb id here:
   exp:add 0x05c6
4:
sudo service udev restart
sudo adb kill-server
sudo adb devices
  • Up0
  • Down0
clovett
Join Date: 30 May 16
Posts: 17
Posted: Mon, 2023-02-06 16:08

Thanks, yes I saw on stackoverflow much talk about "adb_usb.ini" and I have tried this already, but it doesn't seem to work for me.  When I create this file in ~/.android folder containing the device PID "0x05c6" it still returns an empty list even after running "adb kill-server".  Note, my host computer is Ubuntu 18.04.  I've also tried this from Windows host machine, also, but no luck there either.  

  • Up0
  • Down0
clovett
Join Date: 30 May 16
Posts: 17
Posted: Mon, 2023-02-06 16:30

Wait a minute, my WSL2  Ubuntu distrbution (NOT docker) running on my Windows host CAN see the Qualcomm HDK device once I install the usbip tools as per https://learn.microsoft.com/en-us/windows/wsl/connect-usb.  And this did require the ~/.android/adb_usb.ini file to work.  But I need this to work in a docker container, but so far have been unable to make that work either from Linux or Windows host machine. I  have 4 Qualcomm devices and so I would love to be able to have 4 docker container instances, each with access to one of those devices where each of those docker containers is also connected to an Azure Arc Kubernetes cluster so that I can send jobs to those containers from Azure ML Pipelines where those jobs measure Neural Network performance on the Qualcomm devices.  It's a very compelling scenario for teams at Microsoft that are designing Ai models that run on Android phones and need a way to ensure those models are optimized for the Qualcomm chipset.  I wonder if a Linux host can do a similar usbip trick that the above document describes...

  • Up0
  • Down0
handzhu
Join Date: 6 Jun 22
Posts: 54
Posted: Mon, 2023-02-06 18:21
Hi
 
maybe you can also try this :
 
1:
$ cd /etc/udev/rules.d/ 
$ sudo vim 51-android.rules
 
 
2:add
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"
 
 
3:
adb devices
 
4: if you want connect one of this device, you can do like this:
4.1
adb devices
$ <device id 1>
$<device id 2>
$<device id 3>
$<device id 4>
 
4.2
adb  -s  <devicce id 1> shell
 
 

 

  • Up0
  • Down0
clovett
Join Date: 30 May 16
Posts: 17
Posted: Mon, 2023-02-06 19:53

Thanks, yes "adb -s" is how I'm sending work to individual devices.  The udev rules won't work in the docker container because udev refuses to run in the docker container.  Since I need to use Kubernetes containers for Azure Arc to work, I'm still trying to find a way to make the docker container recognize the adb devices.  It is very weird because "lsusb" in the container can clearly see the devices, like this "Bus 004 Device 097: ID 05c6:901d Qualcomm, Inc." so I wonder why adb can't also see that.  I'm wondering if there's simply some dependent package missing in my docker container that adb requires in order for it to work properly.  I mean "adb" is running, it doesn't blow up, but I wonder.  I wish someone could just point me to a Docker image that is already built and tested and "just works" ;-)

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.