Skip to content

Commit

Permalink
ci(esp_tinyusb): readme minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-marcisovsky committed Nov 13, 2024
1 parent 482869d commit c6784db
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions device/esp_tinyusb/test_apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ The main idea, comes from this reply on [stackoverflow](https://stackoverflow.co

## UDEV rules

This UDEV rule, will trigger a `docker_tty.sh` script, every time a USB device is connected, or disconnected from a host machine (CI target runner). Also, when a new USB device is enumerated by the host machine.

Location: `/etc/udev/rules.d/99-docker-tty.rules`

`99-docker-tty.rules` file content:
- This UDEV rule, will trigger a `docker_tty.sh` script, every time a USB device is connected, or disconnected from a host machine (CI target runner). Also, when a new USB device is enumerated by the host machine.
- Location: `/etc/udev/rules.d/99-docker-tty.rules`
- `99-docker-tty.rules` file content:

```
ACTION=="add", SUBSYSTEM=="tty", RUN+="/usr/local/bin/docker_tty.sh 'added' '%E{DEVNAME}' '%M' '%m'"
Expand All @@ -27,11 +25,9 @@ ACTION=="remove", SUBSYSTEM=="tty", RUN+="/usr/local/bin/docker_tty.sh 'removed'

## Docker tty script

This `.sh` script (triggered by the UDEV rule above) will propagate a USB devices to a running docker container

Location: `/usr/local/bin/docker_tty.sh`

`docker_tty.sh` file content:
- This `.sh` script (triggered by the UDEV rule above) will propagate a USB devices to a running docker container
- Location: `/usr/local/bin/docker_tty.sh`
- `docker_tty.sh` file content:

```
#!/usr/bin/env bash
Expand Down Expand Up @@ -66,11 +62,9 @@ root@~$ chmod +x /usr/local/bin/docker_tty.sh

## Logging

The `docker_tty.sh` script logs information about the USB devices, it processes.

Location: `/tmp/docker_tty.log`

An example of log from the `docker_tty.log` file showing a flow of `pytest_usb_device.py` test
- The `docker_tty.sh` script logs information about the USB devices, it processes.
- Location: `/tmp/docker_tty.log`
- An example of log from the `docker_tty.log` file showing a flow of `pytest_usb_device.py` test
```
USB event: added /dev/ttyACM0 166 0
USB event: added /dev/ttyACM1 166 1
Expand Down Expand Up @@ -107,4 +101,7 @@ Run a docker container with following extra options:
```
docker run --device-cgroup-rule='c 188:* rmw' --device-cgroup-rule='c 166:* rmw' --group-add plugdev --privileged ..
```
This way, we allow the docker container to access devices with Major numbers 188 and 166 and with all Minor numbers.
- `--device-cgroup-rule='c 188:* rmw'`: allow access to `ttyUSBx` (Major 188, all Minor)
- `--device-cgroup-rule='c 166:* rmw'`: allow access to `ttyACMx` (Major 166, all Minor)
- `--group-add plugdev`: add plugdev group

0 comments on commit c6784db

Please sign in to comment.