diff options
author | Kévin Redon <kredon@sysmocom.de> | 2018-06-06 17:03:15 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-06-29 20:07:31 +0200 |
commit | 4136c242a82174555bc66c059a051721d2d2ce71 (patch) | |
tree | 2a33e61cb817f2703ce2880171602b7fbac7e57c /firmware | |
parent | 318309f30f8a799d64d536578c5e6e60f1d61d6a (diff) |
USBD: send empty packet when non-existing descriptor string is requested
Sometimes descriptor string 0xee is requested.
This is a mechanism used by Microsoft Windows to further identify the USB device.
Instead of stalling, as is the original code, leading to an USB reset, we send an empty packet.
I am not sure if sending an empty string would be better, but an empty packet seems sufficient.
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/atmel_softpack_libraries/usb/device/core/USBDDriver.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/firmware/atmel_softpack_libraries/usb/device/core/USBDDriver.c b/firmware/atmel_softpack_libraries/usb/device/core/USBDDriver.c index 058f563..22889cf 100644 --- a/firmware/atmel_softpack_libraries/usb/device/core/USBDDriver.c +++ b/firmware/atmel_softpack_libraries/usb/device/core/USBDDriver.c @@ -2,6 +2,7 @@ * ATMEL Microcontroller Software Support * ---------------------------------------------------------------------------- * Copyright (c) 2008, Atmel Corporation + * Copyright (c) 2018, Kevin Redon <kredon@sysmocom.de> * * All rights reserved. * @@ -331,8 +332,13 @@ static void GetDescriptor( /* Check if descriptor exists */ if (indexRDesc >= numStrings) { - - USBD_Stall(0); + /* Sometimes descriptor string 0xee is requested. + * This is a mechanism used by Microsoft Windows to further identify the USB device. + * Instead of stalling, as is the original code, leading to an USB reset, we send an empty packet. + * I am not sure if sending an empty string would be better, but an empty packet seems sufficient. + */ + //USBD_Stall(0); + USBD_Write(0, NULL, 0, 0, 0); } else { |