From 7f3f39b5750b9ac877798f41efcf82d931d657f8 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 28 Jul 2009 15:14:54 +0000 Subject: Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movement data size is not a multiple of 8 bits. Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered. --- Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c') diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index 63fce0dcb..8ea5e7201 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -260,12 +260,7 @@ void ProcessMouseReport(uint8_t* MouseReport) if (!(FoundData)) continue; - int16_t DeltaMovement; - - if (ReportItem->Attributes.BitSize > 8) - DeltaMovement = (int16_t)ReportItem->Value; - else - DeltaMovement = (int8_t)ReportItem->Value; + int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); /* Determine if the report is for the X or Y delta movement */ if (ReportItem->Attributes.Usage.Usage == USAGE_X) -- cgit v1.2.3