Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: input: calculate resolution for pressure

Assume that if the pressure is given in newtons it should be normalized
to grams. If the pressure has no unit do not calculate resolution.

Signed-off-by: Angela Czubak <aczubak@google.com>
Co-developed-by: Jonathan Denose <jdenose@google.com>
Signed-off-by: Jonathan Denose <jdenose@google.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

authored by

Angela Czubak and committed by
Benjamin Tissoires
7657bf0b 344ff358

+13
+13
drivers/hid/hid-input.c
··· 303 303 } 304 304 break; 305 305 306 + case ABS_PRESSURE: 307 + case ABS_MT_PRESSURE: 308 + if (field->unit == HID_UNIT_NEWTON) { 309 + /* Convert to grams, 1 newton is 101.97 grams */ 310 + prev = physical_extents; 311 + physical_extents *= 10197; 312 + if (physical_extents < prev) 313 + return 0; 314 + unit_exponent -= 2; 315 + } else if (field->unit != HID_UNIT_GRAM) { 316 + return 0; 317 + } 318 + break; 306 319 default: 307 320 return 0; 308 321 }