Add request 14 returning a STALL condition. At least I think how it is

done. Unable to find out how this really works and how to check for this
condition in libusb
This commit is contained in:
Klaus Reimer 2013-02-24 20:13:04 +01:00
parent e196b52de6
commit a659d6b059
2 changed files with 9 additions and 3 deletions

View File

@ -29,6 +29,8 @@ static unsigned usbWriteLength;
/** The blinks memory */
static unsigned char buffer[512];
static int buffer_size;
static int buffer_read_index = 0;
static int buffer_write_index = 0;
@ -101,18 +103,22 @@ usbMsgLen_t usbFunctionSetup(uchar setupData[8])
switch (usbData->bRequest)
{
case 0x14:
return 0xff;
case 0xb0:
if (usbData->bmRequestType & USBRQ_DIR_DEVICE_TO_HOST)
{
/* Read mode */
usbMsgPtr = &buffer[usbData->wIndex.word];
return usbData->wLength.word;
usbMsgPtr = &buffer[usbData->wIndex.word];
return usbData->wLength.word > buffer_size ? buffer_size : usbData->wLength.word;
}
else
{
/* Write mode */
usbWriteIndex = usbData->wIndex.word;
usbWriteLength = usbData->wLength.word;
buffer_size = usbData->wLength.word;
return USB_NO_MSG;
}
break;

View File

@ -95,7 +95,7 @@ section at the end of this file).
* Since the token is toggled BEFORE sending any data, the first packet is
* sent with the oposite value of this configuration!
*/
#define USB_CFG_IMPLEMENT_HALT 0
#define USB_CFG_IMPLEMENT_HALT 1
/* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
* for endpoint 1 (interrupt endpoint). Although you may not need this feature,
* it is required by the standard. We have made it a config option because it