From a5f17c46fc3d7a22b2a547236aa576e4326b934c Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 15:39:14 +0100 Subject: [PATCH] Use a variable large enough to hold the Set Idle duration in ms without overflow. --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 88ced493..40014575 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -146,7 +146,7 @@ XUD_Result_t HidInterfaceClassRequests( The Set Idle request xIndex field contains the interface number. */ - uint8_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform into units of 1ms. + uint16_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform from units of 4ms into units of 1ms. uint8_t reportId = sp.wValue & 0x00FF; uint16_t interfaceNum = sp.wIndex;