Skip to content

Commit 9ecde8b

Browse files
committed
HID: magicmouse: use a define of the max number of touch contacts
Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 892727d commit 9ecde8b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/hid/hid-magicmouse.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
6262
#define DOUBLE_REPORT_ID 0xf7
6363
#define USB_BATTERY_TIMEOUT_SEC 60
6464

65+
#define MAX_CONTACTS 16
66+
6567
/* These definitions are not precise, but they're close enough. (Bits
6668
* 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem
6769
* to be some kind of bit mask -- 0x20 may be a near-field reading,
@@ -143,8 +145,8 @@ struct magicmouse_sc {
143145
u8 size;
144146
bool scroll_x_active;
145147
bool scroll_y_active;
146-
} touches[16];
147-
int tracking_ids[16];
148+
} touches[MAX_CONTACTS];
149+
int tracking_ids[MAX_CONTACTS];
148150

149151
struct hid_device *hdev;
150152
struct delayed_work work;
@@ -615,7 +617,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
615617

616618
__set_bit(EV_ABS, input->evbit);
617619

618-
error = input_mt_init_slots(input, 16, mt_flags);
620+
error = input_mt_init_slots(input, MAX_CONTACTS, mt_flags);
619621
if (error)
620622
return error;
621623
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,

0 commit comments

Comments
 (0)