diff options
-rw-r--r-- | main.c | 23 | ||||
-rw-r--r-- | usbdrv/usbconfig.h | 6 |
2 files changed, 23 insertions, 6 deletions
@@ -50,8 +50,8 @@ static char buffer[300]; // contains the exploded gamecube bits, i.e. each bit sent/received occupies one byte here. - -PROGMEM const char usbHidReportDescriptor[862] = { +#define floUsbHidReportDescriptorLen 862 +PROGMEM const char floUsbHidReportDescriptor[862] = { 0x05, 0x01, //USAGE_PAGE (Generic Desktop) 0x15, 0x00, //LOGICAL_MINIMUM (0) @@ -526,6 +526,23 @@ typedef struct { report_t reportBuffer; + +usbMsgLen_t usbFunctionDescriptor(struct usbRequest* rq) +{ + if ((rq->bmRequestType & USBRQ_TYPE_MASK) != USBRQ_TYPE_STANDARD) + return 0; + + if (rq->bRequest == USBRQ_GET_DESCRIPTOR && rq->wValue.bytes[1]==USBDESCR_HID_REPORT) + { + usbMsgPtr = (void*)floUsbHidReportDescriptor; + return floUsbHidReportDescriptorLen; + } + + return 0; +} + + + /* device is detected, however unreliably. dunno why. */ @@ -535,7 +552,7 @@ void debug(int i) PORTB = ~i; } -USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) +USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]) { usbRequest_t* rq = (usbRequest_t*) data; diff --git a/usbdrv/usbconfig.h b/usbdrv/usbconfig.h index 0bb8b04..a7c2ddc 100644 --- a/usbdrv/usbconfig.h +++ b/usbdrv/usbconfig.h @@ -123,7 +123,7 @@ section at the end of this file). * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] */ -#define USB_CFG_IMPLEMENT_FN_WRITE 0 +#define USB_CFG_IMPLEMENT_FN_WRITE 0 // TODO FINDMICH /* Set this to 1 if you want usbFunctionWrite() to be called for control-out * transfers. Set it to 0 if you don't need it and want to save a couple of * bytes. @@ -150,7 +150,7 @@ section at the end of this file). * where the driver's constants (descriptors) are located. Or in other words: * Define this to 1 for boot loaders on the ATMega128. */ -#define USB_CFG_LONG_TRANSFERS 0 +#define USB_CFG_LONG_TRANSFERS 1 /* Define this to 1 if you want to send/receive blocks of more than 254 bytes * in a single control-in or control-out transfer. Note that the capability * for long transfers increases the driver size. @@ -352,7 +352,7 @@ section at the end of this file). #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 #define USB_CFG_DESCR_PROPS_HID 0 -#define USB_CFG_DESCR_PROPS_HID_REPORT 0 +#define USB_CFG_DESCR_PROPS_HID_REPORT USB_PROP_IS_DYNAMIC #define USB_CFG_DESCR_PROPS_UNKNOWN 0 |