1# USB Host CDC-ACM Class Driver 2 3This directory contains an implementation of a USB CDC-ACM Host Class Driver that is implemented on top of the [USB Host Library](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/usb_host.html). 4 5## Supported Devices 6 7The CDC-ACM Host driver supports the following types of CDC devices: 8 91. CDC-ACM devices 102. CDC-like vendor specific devices (usually found on USB to UART bridge devices) 11 12### CDC-ACM Devices 13 14The CDC-ACM Class driver supports CDC-ACM devices that meet the following requirements: 15- The device class code must be set to the CDC class `0x02` or implement Interface Association Descriptor (IAD) 16- The CDC-ACM must contain the following interfaces: 17 - A Communication Class Interface containing a management element (EP0) and may also contain a notification element (an interrupt endpoint). The driver will check this interface for CDC Functional Descriptors. 18 - A Data Class Interface with two BULK endpoints (IN and OUT). Other transfer types are not supported by the driver 19 20### CDC-Like Vendor Specific Devices 21 22The CDC-ACM Class driver supports CDC-like devices that meet the following requirements: 23- The device class code must be set to the vendor specific class code `0xFF` 24- The device needs to provide and interface containing the following endpoints: 25 - (Mandatory) Two Bulk endpoints (IN and OUT) for data 26 - (Optional) An interrupt endpoint (IN) for the notification element 27 28For CDC-like devices, users are responsible for ensuring that they only call APIs (e.g., `cdc_acm_host_send_break()`) that are supported by the target device. 29 30 31## Usage 32 33The following steps outline the typical API call pattern of the CDC-ACM Class Driver 34 351. Install the USB Host Library via `usb_host_install()` 362. Install the CDC-ACM driver via `cdc_acm_host_install()` 373. Call `cdc_acm_host_open()`/`cdc_acm_host_open_vendor_specific()` to open a target CDC-ACM/CDC-like device. These functions will block until the target device is connected 384. To transmit data, call `cdc_acm_host_data_tx_blocking()` 395. When data is received, the driver will automatically run the receive data callback 406. An opened device can be closed via `cdc_acm_host_close()` 417. The CDC-ACM driver can be uninstalled via `cdc_acm_host_uninstall()` 42 43## Examples 44 45- For an example with a CDC-ACM device, refer to [cdc_acm_host](../../cdc_acm_host) 46- For an example with a CDC-like device, refer to [cdc_acm_host_bg96](../../cdc_acm_bg96) 47