fix(usb_host): Run esp-usb pre-commit:

- trailing whitespaces
    - end-of-file-fixer
    - codespell
    - astyle_py: align pointer name
This commit is contained in:
peter.marcisovsky
2025-07-28 18:52:51 +02:00
parent 844dc17b43
commit 4deccbc4a6
28 changed files with 105 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -33,7 +33,7 @@ const uint8_t hid_report_descriptor[] = {
/**
* @brief String descriptor
*/
const char* hid_string_descriptor[5] = {
const char *hid_string_descriptor[5] = {
// array of pointer to string descriptors
(char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
"TinyUSB", // 1: Manufacturer
@@ -68,7 +68,7 @@ uint8_t const *tud_hid_descriptor_report_cb(uint8_t instance)
// Invoked when received GET_REPORT control request
// Application must fill buffer report's content and return its length.
// Return zero will cause the stack to STALL request
uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t *buffer, uint16_t reqlen)
{
(void) instance;
(void) report_id;
@@ -81,7 +81,7 @@ uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_t
// Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
void tud_hid_set_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t const *buffer, uint16_t bufsize)
{
}

View File

@@ -42,7 +42,7 @@ enum usb_endpoints {
/**
* @brief String descriptor
*/
static const char* s_str_desc[5] = {
static const char *s_str_desc[5] = {
// array of pointer to string descriptors
(char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
"TinyUSB", // 1: Manufacturer

View File

@@ -24,7 +24,7 @@ As a USB stack, a TinyUSB component is used.
1. USB which accesses the ESP MSC Partition is unplugged initially and the board is powered-on.
- Result: Host PC can't access the partition over USB MSC. Application example can perform operations (read, write) on partition.
2. USB which accesses the ESP MSC Partition is already plugged-in at boot time.
- Result: Host PC recongnize it as removable device and can access the partition over USB MSC. Application example can't perform any operation on partition.
- Result: Host PC recognize it as removable device and can access the partition over USB MSC. Application example can't perform any operation on partition.
3. USB which accesses the ESP MSC Partition is plugged-in at boot-up. After boot-up, it is ejected on Host PC manually by user.
- Result: Host PC can't access the partition over USB MSC. Application example can perform operations (read, write) on partition.
4. USB which accesses the ESP MSC Partition is plugged-in at boot-up. It is then unplugged(removed) from Host PC manually by user.
@@ -145,30 +145,30 @@ Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (724) main_task: Returned from app_main()
esp32s3>
esp32s3>
esp32s3> help
help
help
Print the list of registered commands
read
read
read BASE_PATH/README.MD and print its contents
write
write
create file BASE_PATH/README.MD if it does not exist
size
size
show storage size and sector size
expose
expose
Expose Storage to Host
status
status
Status of storage exposure over USB
exit
exit
exit from application
esp32s3>
esp32s3>
esp32s3> read
E (80054) example_main: storage exposed over USB. Application can't read from storage.
Command returned non-zero error code: 0xffffffff (ESP_FAIL)
@@ -183,8 +183,8 @@ storage exposed over USB: Yes
esp32s3> expose
E (108344) example_main: storage is already exposed
Command returned non-zero error code: 0xffffffff (ESP_FAIL)
esp32s3>
esp32s3>
esp32s3>
esp32s3>
esp32s3> read
Mass Storage Devices are one of the most common USB devices. It use Mass Storage Class (MSC) that allow access to their internal data storage.
In this example, ESP chip will be recognised by host (PC) as Mass Storage Device.
@@ -198,6 +198,6 @@ esp32s3> expose
I (181224) example_main: Unmount storage...
esp32s3> status
storage exposed over USB: Yes
esp32s3>
esp32s3>
esp32s3>
```

View File

@@ -11,7 +11,7 @@ This example shows how to use the CDC-ACM Host Driver to allow an ESP chip to co
### Hardware Required
Two development boards with USB-OTG support. One will act as USB host and the other as USB device.
Two development boards with USB-OTG support. One will act as USB host and the other as USB device.
#### Pin Assignment

View File

@@ -37,25 +37,25 @@ Mouse
X: 000883 Y: 000058 | |o|
```
Where every keyboard key printed as char symbol if it is possible and a Hex value for any other key.
Where every keyboard key printed as char symbol if it is possible and a Hex value for any other key.
#### Keyboard input data
Keyboard input data starts with the word "Keyboard" and every pressed key is printed to the serial debug.
Left or right Shift modifier is also supported.
Left or right Shift modifier is also supported.
```
Keyboard
Hello, ESP32 USB HID Keyboard is here!
```
#### Mouse input data
Mouse input data starts with the word "Mouse" and has the following structure.
#### Mouse input data
Mouse input data starts with the word "Mouse" and has the following structure.
```
Mouse
X: -00343 Y: 000183 | |o|
| | | |
| | | +- Right mouse button pressed status ("o" - pressed, " " - not pressed)
| | +--- Left mouse button pressed status ("o" - pressed, " " - not pressed)
| +---------- Y relative coordinate of the cursor
+----------------------- X relative coordinate of the cursor
| +---------- Y relative coordinate of the cursor
+----------------------- X relative coordinate of the cursor
```

View File

@@ -27,7 +27,7 @@ The example is run in a loop so that it can demonstrate USB connection and recon
### USB Host Limitations
#### ESP32-S2 & ESP32-S3
The USB OTG peripheral on ESP32-S2 and ESP32-S3 in host mode supports **up to 8 bidirectional endpoints**. Each of these endpoints can be configured as either IN or OUT.
The USB OTG peripheral on ESP32-S2 and ESP32-S3 in host mode supports **up to 8 bidirectional endpoints**. Each of these endpoints can be configured as either IN or OUT.
Since each USB Mass Storage Class (MSC) device typically requires **3 endpoints** (Control, BULK IN, and BULK OUT), and USB hubs also consume endpoints (Control, INTERRUPT IN), this limits the theoretical maximum number of connected MSC devices to **2**.

View File

@@ -64,7 +64,7 @@ See the Getting Started Guide for full steps to configure and use ESP-IDF to bui
I (305) main_task: Started on CPU0
I (315) main_task: Calling app_main()
I (315) USB host lib: USB host library example
I (315) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (315) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
I (325) USB host lib: Installing USB Host Library
I (365) CLASS: Registering Client
I (745) CLASS: Opening device at address 1