From f014217288927246f92ee876afbbf9de8ba707be Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sat, 8 Aug 2026 22:36:04 +0200 Subject: use an unsigned 16-bit type for gain + Gain is documented and sent to the hardware as a value in the range 0 to 65535, but the module parameter and sysfs attribute accept wider integer values. Store gain as a u16 and parse sysfs writes with kstrtou16 so out-of-range values are rejected instead of being silently changed. + This constrains only the configured value. Calculations combining gain values still require a wider intermediate to cover the product of two full-range 16-bit values. --- src/hid-tmff2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/hid-tmff2.h') diff --git a/src/hid-tmff2.h b/src/hid-tmff2.h index 6ad1d82..58ab8f3 100644 --- a/src/hid-tmff2.h +++ b/src/hid-tmff2.h @@ -11,7 +11,7 @@ extern int spring_level; extern int damper_level; extern int friction_level; extern int range; -extern int gain; +extern u16 gain; extern int alt_mode; #define USB_VENDOR_ID_THRUSTMASTER 0x044f -- cgit v1.3