usb_hid: Use In Range data instead of state

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 <waddlesplash@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
This commit is contained in:
Jeroen Oortwijn 2015-09-20 19:35:55 +02:00 committed by Stephan Aßmus
parent 7625dca0e9
commit 419190fdc2

View File

@ -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())