From fa9de82da48c31c99616a2185ca91f0031188a78 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Sun, 24 Feb 2013 21:59:43 +0100 Subject: [PATCH] Add control endpoints to test firmware --- src/firmware/c/descriptor.h | 18 ++++++++++++++++-- src/firmware/c/main.c | 3 ++- src/firmware/c/usbconfig.h | 4 ++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/firmware/c/descriptor.h b/src/firmware/c/descriptor.h index 65c8f7e..2263b3d 100644 --- a/src/firmware/c/descriptor.h +++ b/src/firmware/c/descriptor.h @@ -3,7 +3,7 @@ char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 9, /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */ USBDESCR_CONFIG, /* descriptor type */ - 18 + 10 * 7, 0, + 18 + 12 * 7, 0, /* total length of data returned (including inlined descriptors) */ 1, /* number of interfaces in this configuration */ 1, /* index of this configuration */ @@ -15,7 +15,7 @@ char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ USBDESCR_INTERFACE, /* descriptor type */ 0, /* index of this interface */ 0, /* alternate setting for this interface */ - 10, /* endpoints excl 0: number of endpoint descriptors to follow */ + 12, /* endpoints excl 0: number of endpoint descriptors to follow */ USB_CFG_INTERFACE_CLASS, USB_CFG_INTERFACE_SUBCLASS, USB_CFG_INTERFACE_PROTOCOL, @@ -90,6 +90,20 @@ char usbDescriptorConfiguration[] = { /* USB configuration descriptor */ 0x01, /* attrib: Interrupt endpoint */ 8, 0, /* maximum packet size */ 1, /* in ms */ + + 7, /* sizeof(usbDescrEndpoint) */ + USBDESCR_ENDPOINT, /* descriptor type = endpoint */ + (char)0x09, /* OUT endpoint number 2 */ + 0x00, /* attrib: Interrupt endpoint */ + 8, 0, /* maximum packet size */ + 0, /* in ms */ + + 7, /* sizeof(usbDescrEndpoint) */ + USBDESCR_ENDPOINT, /* descriptor type = endpoint */ + (char)0x89, /* OUT endpoint number 2 */ + 0x00, /* attrib: Interrupt endpoint */ + 8, 0, /* maximum packet size */ + 0, /* in ms */ }; #endif diff --git a/src/firmware/c/main.c b/src/firmware/c/main.c index 787d613..89317c4 100644 --- a/src/firmware/c/main.c +++ b/src/firmware/c/main.c @@ -105,7 +105,8 @@ usbMsgLen_t usbFunctionSetup(uchar setupData[8]) { case 0x14: return 0xff; - + + case 0x1: case 0xb0: if (usbData->bmRequestType & USBRQ_DIR_DEVICE_TO_HOST) { diff --git a/src/firmware/c/usbconfig.h b/src/firmware/c/usbconfig.h index e779c31..6336a05 100644 --- a/src/firmware/c/usbconfig.h +++ b/src/firmware/c/usbconfig.h @@ -266,7 +266,7 @@ section at the end of this file). * to fine tune control over USB descriptors such as the string descriptor * for the serial number. */ -#define USB_CFG_DEVICE_CLASS 0 /* set to 0 if deferred to interface */ +#define USB_CFG_DEVICE_CLASS 0xff /* set to 0 if deferred to interface */ #define USB_CFG_DEVICE_SUBCLASS 0 /* See USB specification if you want to conform to an existing device class. * Class 0xff is "vendor specific". @@ -345,7 +345,7 @@ section at the end of this file). */ #define USB_CFG_DESCR_PROPS_DEVICE 0 -#define USB_CFG_DESCR_PROPS_CONFIGURATION (USB_PROP_IS_RAM | USB_PROP_LENGTH(18 + 10 * 7)) +#define USB_CFG_DESCR_PROPS_CONFIGURATION (USB_PROP_IS_RAM | USB_PROP_LENGTH(18 + 12 * 7)) #define USB_CFG_DESCR_PROPS_STRINGS 0 #define USB_CFG_DESCR_PROPS_STRING_0 0 #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0