// SPDX-License-Identifier: GPL-2.0-or-later /* * HID driver for ELECOM devices: * - BM084 Bluetooth Mouse * - EX-G Trackballs (M-XT3DRBK, M-XT3URBK, M-XT4DRBK) * - DEFT Trackballs (M-DT1DRBK, M-DT1URBK, M-DT2DRBK, M-DT2URBK) * - HUGE Trackballs (M-HT1DRBK, M-HT1URBK) * * Copyright (c) 2010 Richard Nauber <[email protected]> * Copyright (c) 2016 Yuxuan Shui <[email protected]> * Copyright (c) 2017 Diego Elio Pettenò <[email protected]> * Copyright (c) 2017 Alex Manoussakis <[email protected]> * Copyright (c) 2017 Tomasz Kramkowski <[email protected]> * Copyright (c) 2020 YOSHIOKA Takuma <[email protected]> * Copyright (c) 2022 Takahiro Fujii <[email protected]> */ /* */ #include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" /* * Certain ELECOM mice misreport their button count meaning that they only work * correctly with the ELECOM mouse assistant software which is unavailable for * Linux. A four extra INPUT reports and a FEATURE report are described by the * report descriptor but it does not appear that these enable software to * control what the extra buttons map to. The only simple and straightforward * solution seems to involve fixing up the report descriptor. */ #define MOUSE_BUTTONS_MAX … static void mouse_button_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int rsize, unsigned int button_bit_count, unsigned int padding_bit, unsigned int button_report_size, unsigned int button_usage_maximum, int nbuttons) { … } static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { … } static const struct hid_device_id elecom_devices[] = …; MODULE_DEVICE_TABLE(hid, elecom_devices); static struct hid_driver elecom_driver = …; module_hid_driver(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;