correct USB descriptor
This commit is contained in:
parent
0e2f87ed41
commit
f21120aa0c
@ -30,14 +30,16 @@
|
||||
|
||||
#include "usb_cdcacm.h" // USB CDC ACM header and definitions
|
||||
|
||||
/* USB descriptor */
|
||||
/* USB devices descriptor
|
||||
* as defined in USB CDC specification section 5
|
||||
*/
|
||||
static const struct usb_device_descriptor device_descriptor = {
|
||||
.bLength = USB_DT_DEVICE_SIZE, // the size of this header in bytes, 18
|
||||
.bDescriptorType = USB_DT_DEVICE, // a value of 1 indicates that this is a device descriptor
|
||||
.bcdUSB = 0x0200, // this device supports USB 2.0
|
||||
.bDeviceClass = USB_CLASS_CDC, // use the CDC device class
|
||||
.bDeviceSubClass = USB_CDC_SUBCLASS_ACM, // use the ACM sub-class
|
||||
.bDeviceProtocol = USB_CDC_PROTOCOL_NONE, // use no specific protocol
|
||||
.bDeviceSubClass = 0, // unused
|
||||
.bDeviceProtocol = 0, // unused
|
||||
.bMaxPacketSize0 = 64, // packet size for endpoint zero in bytes
|
||||
.idVendor = 0xc440, // Vendor ID (CuVo...)
|
||||
.idProduct = 0x0d00, // product ID within the Vendor ID space (...odoo)
|
||||
@ -77,6 +79,9 @@ static const struct usb_endpoint_descriptor communication_endpoints[] = {{
|
||||
.bInterval = 255, // the frequency, in number of frames, that we're going to be sending data
|
||||
}};
|
||||
|
||||
/* functional descriptor
|
||||
* as defined in USB CDC specification section 5.2.3
|
||||
*/
|
||||
static const struct {
|
||||
struct usb_cdc_header_descriptor header;
|
||||
struct usb_cdc_call_management_descriptor call_mgmt;
|
||||
@ -90,8 +95,7 @@ static const struct {
|
||||
.bcdCDC = 0x0110,
|
||||
},
|
||||
.call_mgmt = {
|
||||
.bFunctionLength =
|
||||
sizeof(struct usb_cdc_call_management_descriptor),
|
||||
.bFunctionLength = sizeof(struct usb_cdc_call_management_descriptor),
|
||||
.bDescriptorType = CS_INTERFACE,
|
||||
.bDescriptorSubtype = USB_CDC_TYPE_CALL_MANAGEMENT,
|
||||
.bmCapabilities = 0,
|
||||
@ -112,6 +116,9 @@ static const struct {
|
||||
},
|
||||
};
|
||||
|
||||
/* communication class interface descriptor
|
||||
* as defined in USB CDC specification section 5.1.3
|
||||
*/
|
||||
static const struct usb_interface_descriptor communication_interface[] = {{
|
||||
.bLength = USB_DT_INTERFACE_SIZE,
|
||||
.bDescriptorType = USB_DT_INTERFACE,
|
||||
@ -129,6 +136,9 @@ static const struct usb_interface_descriptor communication_interface[] = {{
|
||||
.extralen = sizeof(cdcacm_functional_descriptors),
|
||||
}};
|
||||
|
||||
/* data class interface descriptor
|
||||
* as defined in USB CDC specification section 5.1.3
|
||||
*/
|
||||
static const struct usb_interface_descriptor data_interface[] = {{
|
||||
.bLength = USB_DT_INTERFACE_SIZE,
|
||||
.bDescriptorType = USB_DT_INTERFACE,
|
||||
@ -203,7 +213,7 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *
|
||||
char local_buf[10];
|
||||
struct usb_cdc_notification *notif = (void *)local_buf;
|
||||
|
||||
/* We echo signals back to host as notification. */
|
||||
/* we echo signals back to host as notification. */
|
||||
notif->bmRequestType = 0xA1;
|
||||
notif->bNotification = USB_CDC_NOTIFY_SERIAL_STATE;
|
||||
notif->wValue = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user