You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/espressif/esp-usb/actions/workflows/build_and_run_test_app_usb.yml)
[](https://github.com/pre-commit/pre-commit)[](https://github.com/espressif/esp-usb/actions/workflows/build_and_run_test_app_usb.yml)[](https://github.com/espressif/esp-usb/security/code-scanning?query=is%3Aopen+branch%3Amaster)
4
2
5
3
# Espressif ESP-USB
6
4
7
-
This repository aims to store [ESP-IDF](https://github.com/espressif/esp-idf) USB host and device class drivers
8
-
which have been separated and uploaded into [IDF Component Manager](https://components.espressif.com/).
5
+
This repository aims to store [ESP-IDF](https://github.com/espressif/esp-idf) USB host and device class drivers which have been separated and uploaded into [IDF Component Manager](https://components.espressif.com/).
9
6
10
7
## Important note
8
+
11
9
This repository is used only for Espressif components, it is not mean to store third party components.
Copy file name to clipboardExpand all lines: device/esp_tinyusb/README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,13 +42,14 @@ Configure the Device Stack using `menuconfig`:
42
42
43
43
This component is distributed via [IDF component manager](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html). Just add `idf_component.yml` file to your main component with the following content:
44
44
45
-
```yaml
45
+
```yaml
46
46
## IDF Component Manager Manifest File
47
47
dependencies:
48
48
esp_tinyusb: "~2.0.0"
49
49
```
50
50
51
51
Or simply run:
52
+
52
53
```
53
54
idf.py add-dependency esp_tinyusb~2.0.0
54
55
```
@@ -187,8 +188,7 @@ Configure USB descriptors using the `tinyusb_config_t` structure:
187
188
- `descriptor.high_speed_config`
188
189
- `descriptor.qualifier`
189
190
190
-
If any descriptor field is set to `NULL`, default descriptor will be assigned during installation.
191
-
Values of default descriptors could be configured via `menuconfig`.
191
+
If any descriptor field is set to `NULL`, default descriptor will be assigned during installation. Values of default descriptors could be configured via `menuconfig`.
192
192
193
193
```c
194
194
#include "tinyusb_default_config.h"
@@ -226,6 +226,7 @@ For self-powered devices, monitoring the VBUS voltage is required. To do this:
226
226
tinyusb_driver_install(&tusb_cfg);
227
227
}
228
228
```
229
+
229
230
If external PHY is used:
230
231
231
232
```c
@@ -369,10 +370,10 @@ void main(void)
369
370
}
370
371
```
371
372
372
-
373
373
**Storage callback**
374
374
375
375
Storage event callback is called, when one of the following events occurred:
376
+
376
377
-`TINYUSB_MSC_EVENT_MOUNT_START`: Start mount from APP to USB or from USB to APP
377
378
-`TINYUSB_MSC_EVENT_MOUNT_COMPLETE`: Complete mount from USB to APP or from APP to USB
378
379
-`TINYUSB_MSC_EVENT_FORMAT_REQUIRED`: Filesystem not found, format needed
@@ -437,26 +438,27 @@ void main(void)
437
438
**Performance Table (ESP32-S3):**
438
439
439
440
| FIFO Size | Read Speed | Write Speed |
440
-
|-----------|------------|-------------|
441
+
|---------|----------|-----------|
441
442
| 512 B | 0.566 MB/s | 0.236 MB/s |
442
443
| 8192 B | 0.925 MB/s | 0.928 MB/s |
443
444
444
445
**Performance Table (ESP32-P4):**
445
446
446
447
| FIFO Size | Read Speed | Write Speed |
447
-
|-----------|------------|-------------|
448
+
|---------|----------|-----------|
448
449
| 512 B | 1.174 MB/s | 0.238 MB/s |
449
450
| 8192 B | 4.744 MB/s | 2.157 MB/s |
450
451
| 32768 B | 5.998 MB/s | 4.485 MB/s |
451
452
452
453
**Performance Table (ESP32-S2, SPI Flash):**
453
454
454
455
| FIFO Size | Write Speed |
455
-
|-----------|-------------|
456
+
|---------|-----------|
456
457
| 512 B | 5.59 KB/s |
457
458
| 8192 B | 21.54 KB/s |
458
459
459
460
**Note:** Internal SPI flash is for demonstration only; use SD cards or external flash for higher performance.
460
461
461
462
## Examples
463
+
462
464
You can find examples in [ESP-IDF on GitHub](https://github.com/espressif/esp-idf/tree/master/examples/peripherals/usb/device).
Copy file name to clipboardExpand all lines: device/esp_tinyusb/test_apps/README.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,9 @@
1
1
# CI target runner setup
2
2
3
-
To allow a Docker container, running on a CI target runner, to access USB devices connected to the CI target runner, some modifications must be made.
4
-
In our case, it's an `RPI` target runner.
3
+
To allow a Docker container, running on a CI target runner, to access USB devices connected to the CI target runner, some modifications must be made. In our case, it's an `RPI` target runner.
5
4
6
5
The main idea comes from this response on [stackoverflow](https://stackoverflow.com/a/66427245/19840830). The same approach is also recommended in the official Docker [documentation](https://docs.docker.com/reference/cli/docker/container/run/#device-cgroup-rule)
7
6
8
-
9
7
### Following changes shall be made on a CI target runner
10
8
11
9
-[`UDEV rules`](#udev-rules)
@@ -21,7 +19,7 @@ The main idea comes from this response on [stackoverflow](https://stackoverflow.
Don't forget to make the created script executable:
62
-
```sh
60
+
61
+
```sh
63
62
root@~$ chmod +x /usr/local/bin/docker_tty.sh
64
63
```
65
64
@@ -82,17 +81,18 @@ USB event: removed /dev/ttyACM1 166 1
82
81
83
82
### Check Major and Minor numbers of connected devices
84
83
85
-
Check the Major and Minor numbers assigned by the Linux kernel to devices that you want the Docker container to access.
86
-
In our case, we want to access `/dev/ttyUSB0`, `/dev/ttyACM0` and `/dev/ttyACM1`
84
+
Check the Major and Minor numbers assigned by the Linux kernel to devices that you want the Docker container to access. In our case, we want to access `/dev/ttyUSB0`, `/dev/ttyACM0` and `/dev/ttyACM1`
87
85
88
86
`/dev/ttyUSB0`: Major 188, Minor 0
89
-
```sh
87
+
88
+
```sh
90
89
peter@BrnoRPIG007:~ $ ls -l /dev/ttyUSB0
91
90
crw-rw-rw- 1 root dialout 188, 0 Nov 12 11:08 /dev/ttyUSB0
92
91
```
93
92
94
93
`/dev/ttyACM0` and `/dev/ttyACM1`: Major 166, Minor 0 (1)
95
-
```sh
94
+
95
+
```sh
96
96
peter@BrnoRPIG007:~ $ ls -l /dev/ttyACM0
97
97
crw-rw---- 1 root dialout 166, 0 Nov 13 10:26 /dev/ttyACM0
Run a Docker container with the following extra options:
105
-
```sh
105
+
106
+
```sh
106
107
docker run --device-cgroup-rule='c 188:* rmw' --device-cgroup-rule='c 166:* rmw' --privileged ..
107
108
```
109
+
108
110
-`--device-cgroup-rule='c 188:* rmw'`: allow access to `ttyUSBx` (Major 188, all Minors)
109
111
-`--device-cgroup-rule='c 166:* rmw'`: allow access to `ttyACMx` (Major 166, all Minors)
110
112
111
113
## GitHub CI target runner setup
112
114
113
115
To apply these changes to a GitHub target runner a `.yml` file used to run a Docker container for pytest must be modified. The Docker container is then run with the following options:
@@ -124,7 +126,7 @@ To apply these changes to a GitLab runner the `config.toml` file located at `/et
124
126
125
127
According to GitLab's [documentation](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section) the `[runners.docker]` section of the `config.toml` file should include the `device_cgroup_rules` parameter:
0 commit comments