Skip to content

Commit b55bf21

Browse files
jannaumarcan
authored andcommitted
HID: magicmouse: use a define of the max number of touch contacts
Signed-off-by: Janne Grunau <[email protected]>
1 parent 7e1be65 commit b55bf21

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
@@ -61,6 +61,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
6161
#define DOUBLE_REPORT_ID 0xf7
6262
#define USB_BATTERY_TIMEOUT_MS 60000
6363

64+
#define MAX_CONTACTS 16
65+
6466
/* These definitions are not precise, but they're close enough. (Bits
6567
* 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem
6668
* to be some kind of bit mask -- 0x20 may be a near-field reading,
@@ -139,8 +141,8 @@ struct magicmouse_sc {
139141
u8 size;
140142
bool scroll_x_active;
141143
bool scroll_y_active;
142-
} touches[16];
143-
int tracking_ids[16];
144+
} touches[MAX_CONTACTS];
145+
int tracking_ids[MAX_CONTACTS];
144146

145147
struct hid_device *hdev;
146148
struct delayed_work work;
@@ -592,7 +594,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
592594

593595
__set_bit(EV_ABS, input->evbit);
594596

595-
error = input_mt_init_slots(input, 16, mt_flags);
597+
error = input_mt_init_slots(input, MAX_CONTACTS, mt_flags);
596598
if (error)
597599
return error;
598600
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,

0 commit comments

Comments
 (0)