Skip to content

Commit 94c62d5

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 e21bd7d commit 94c62d5

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,
@@ -142,8 +144,8 @@ struct magicmouse_sc {
142144
u8 size;
143145
bool scroll_x_active;
144146
bool scroll_y_active;
145-
} touches[16];
146-
int tracking_ids[16];
147+
} touches[MAX_CONTACTS];
148+
int tracking_ids[MAX_CONTACTS];
147149

148150
struct hid_device *hdev;
149151
struct delayed_work work;
@@ -595,7 +597,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
595597

596598
__set_bit(EV_ABS, input->evbit);
597599

598-
error = input_mt_init_slots(input, 16, mt_flags);
600+
error = input_mt_init_slots(input, MAX_CONTACTS, mt_flags);
599601
if (error)
600602
return error;
601603
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,

0 commit comments

Comments
 (0)