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.
This commit is contained in:
Kevin Redon 2018-06-06 17:03:15 +02:00
parent 86ea4faef6
commit 7f4f8983dd
1 changed files with 8 additions and 2 deletions

View File

@ -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 {