From 419190fdc21f9f103115cda581e3049881f09c53 Mon Sep 17 00:00:00 2001 From: Jeroen Oortwijn Date: Sun, 20 Sep 2015 19:35:55 +0200 Subject: [PATCH] usb_hid: Use In Range data instead of state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the HID Usage Tables document (Hut1_12.pdf), the In Range usage is a Momentary Control (MC) (par. 16.3.1). A MC has a Logical Minimum of 0 and a Logical Maximum of 1 (par. 3.4.1.3). As the In Range usage is a bit quantity, the value can't be outside the Logical Minimum and Maximum and therefore can't be in an invalid state. Now the inRange boolean value properly changes. The pointer still moves to the upper left corner when the pen is out of range, though. Maybe the input_server add-on doesn't use this value? Change-Id: Idf511ac237158e90eb2e8f01422757655a7eea3a Reviewed-on: https://review.haiku-os.org/c/1449 Reviewed-by: waddlesplash Reviewed-by: Stephan Aßmus --- .../kernel/drivers/input/usb_hid/TabletProtocolHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/TabletProtocolHandler.cpp b/src/add-ons/kernel/drivers/input/usb_hid/TabletProtocolHandler.cpp index d6c02b2160..af67fa33f9 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/TabletProtocolHandler.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/TabletProtocolHandler.cpp @@ -289,8 +289,8 @@ TabletProtocolHandler::_ReadReport(void *buffer, uint32 *cookie) yTilt = fYTilt->ScaledFloatData(); bool inRange = true; - if (fRange != NULL) - inRange = fRange->Extract() == B_OK && fRange->Valid(); + if (fRange != NULL && fRange->Extract() == B_OK && fRange->Valid()) + inRange = fRange->Data() & 1 != 0; bool eraser = false; if (fEraser != NULL && fEraser->Extract() == B_OK && fEraser->Valid())