From 4136c242a82174555bc66c059a051721d2d2ce71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Redon?= Date: Wed, 6 Jun 2018 17:03:15 +0200 Subject: [PATCH] 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. --- .../usb/device/core/USBDDriver.c | 10 ++++++++-- 1 file 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 058f5634..22889cf2 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 * * 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 {