Skip to content

Commit 46e779b

Browse files
Sandeep C SJiri Kosina
authored andcommitted
HID: samsung: Add Samsung wireless action mouse support
Add support for samsung wireless action mouse with input mapping events. Device a004 (Samsung wireless action mouse). Signed-off-by: Sandeep C S <[email protected]> Signed-off-by: Junwan Cho <[email protected]> Signed-off-by: Jitender Sajwan <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 944536c commit 46e779b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

drivers/hid/hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@
11481148
#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600
11491149
#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD 0x7021
11501150
#define USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD 0xa000
1151+
#define USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE 0xa004
11511152

11521153
#define USB_VENDOR_ID_SEMICO 0x1a2c
11531154
#define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023

drivers/hid/hid-samsung.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,29 @@ static int samsung_gamepad_input_mapping(struct hid_device *hdev,
323323
return 1;
324324
}
325325

326+
static int samsung_actionmouse_input_mapping(struct hid_device *hdev,
327+
struct hid_input *hi, struct hid_field *field, struct hid_usage *usage,
328+
unsigned long **bit, int *max)
329+
{
330+
331+
dbg_hid("samsung wireless actionmouse input mapping event [0x%x], [0x%x], %ld, %ld, [0x%x]\n",
332+
usage->hid, usage->hid & HID_USAGE, hi->input->evbit[0], hi->input->absbit[0],
333+
usage->hid & HID_USAGE_PAGE);
334+
335+
if (((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) && ((usage->hid & HID_USAGE_PAGE) != HID_UP_BUTTON))
336+
return 0;
337+
338+
switch (usage->hid & HID_USAGE) {
339+
case 0x301:
340+
samsung_kbd_mouse_map_key_clear(254);
341+
break;
342+
default:
343+
return 0;
344+
}
345+
346+
return 1;
347+
}
348+
326349
static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc,
327350
unsigned int *rsize)
328351
{
@@ -346,6 +369,9 @@ static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi,
346369
else if (hdev->product == USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD)
347370
ret = samsung_gamepad_input_mapping(hdev,
348371
hi, field, usage, bit, max);
372+
else if (hdev->product == USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE)
373+
ret = samsung_actionmouse_input_mapping(hdev,
374+
hi, field, usage, bit, max);
349375

350376
return ret;
351377
}
@@ -390,6 +416,7 @@ static const struct hid_device_id samsung_devices[] = {
390416
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
391417
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD) },
392418
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_GAMEPAD) },
419+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SAMSUNG_ELECTRONICS, USB_DEVICE_ID_SAMSUNG_WIRELESS_ACTIONMOUSE) },
393420
{ }
394421
};
395422
MODULE_DEVICE_TABLE(hid, samsung_devices);

0 commit comments

Comments
 (0)