labgrid-project / labgrid-project/labgrid

Support for USB devices through Docker?

Open
#1,780 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
528
Forks
278
Avg merge
2d 19h
Merged PRs (30d)
4

Description

I have a docker container where my USB devices are accessible through the docker device option (--device /dev/bus/usb:/dev/bus/usb). The sispmctl application can then be used to control the powerstrip inside docker. This container is managed by our CI/CD system in a fairly standard setup.

However labgrid does not detect the powerstrip and so instead of using the intended driver SiSPMPowerDriver, my workaround is to create a custom ExternalPowerDriver.

What is the better approach? Is docker not intended to be supported the way I am using it?

sispmctl -s
Gembird #0
USB information: bus 002, device 014
device type: 4-socket SiS-PM
serial number: 01:01:3c:73:09

Output from labgrid-suggest:

labgrid-suggest
=== existing device ===
USBSerialPort for /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7:1.0/ttyUSB0/tty/ttyUSB0
=== device properties ===
device node: /dev/ttyUSB0
=== no suggested matches found ===

=== existing device ===
USBNetworkInterface for /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0/net/enxbc0f9a2b2ba9
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1a.0/usb1/1-0:1.0
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1:1.0
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1c.2/0000:07:00.0/usb3/3-0:1.0
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1c.2/0000:07:00.0/usb4/4-0:1.0
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1d.0/usb2/2-0:1.0
=== no suggested matches found ===

=== existing device ===
USBPowerPort for /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0
=== no suggested matches found ===

Not working inside Docker:
env.yaml:
resources:
SiSPMPowerPort:
match:
ID_SERIAL: 'Gembird_EG-PMS2'
index: 1

driver:
  SiSPMPowerDriver: {}

Working inside Docker:
env.yaml:
ExternalPowerDriver:
cmd_on: 'sispmctl -o 1'
cmd_off: 'sispmctl -f 1'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the env.yaml resource match and the labgrid-suggest output, then reproduce the SiSPMPowerDriver setup using Docker with /dev/bus/usb exposed. Compare it with the working ExternalPowerDriver configuration; done means the SiSPMPowerDriver detects and controls the Gembird powerstrip, or the Docker limitation and supported approach are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
devops, embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.