| Richard Nauber | 64b386e | 2010-06-28 18:54:25 +0200 | [diff] [blame] | 1 | /* | 
 | 2 |  *  HID driver for Elecom BM084 (bluetooth mouse). | 
 | 3 |  *  Removes a non-existing horizontal wheel from | 
 | 4 |  *  the HID descriptor. | 
 | 5 |  *  (This module is based on "hid-ortek".) | 
 | 6 |  * | 
 | 7 |  *  Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com> | 
 | 8 |  */ | 
 | 9 |  | 
 | 10 | /* | 
 | 11 |  * This program is free software; you can redistribute it and/or modify it | 
 | 12 |  * under the terms of the GNU General Public License as published by the Free | 
 | 13 |  * Software Foundation; either version 2 of the License, or (at your option) | 
 | 14 |  * any later version. | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #include <linux/device.h> | 
 | 18 | #include <linux/hid.h> | 
 | 19 | #include <linux/module.h> | 
 | 20 |  | 
 | 21 | #include "hid-ids.h" | 
 | 22 |  | 
| Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 23 | static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 
 | 24 | 		unsigned int *rsize) | 
| Richard Nauber | 64b386e | 2010-06-28 18:54:25 +0200 | [diff] [blame] | 25 | { | 
| Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 26 | 	if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { | 
| Richard Nauber | 64b386e | 2010-06-28 18:54:25 +0200 | [diff] [blame] | 27 | 		dev_info(&hdev->dev, "Fixing up Elecom BM084 " | 
 | 28 | 				"report descriptor.\n"); | 
 | 29 | 		rdesc[47] = 0x00; | 
 | 30 | 	} | 
| Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 31 |     return rdesc; | 
| Richard Nauber | 64b386e | 2010-06-28 18:54:25 +0200 | [diff] [blame] | 32 | } | 
 | 33 |  | 
 | 34 | static const struct hid_device_id elecom_devices[] = { | 
 | 35 | 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084)}, | 
 | 36 | 	{ } | 
 | 37 | }; | 
 | 38 | MODULE_DEVICE_TABLE(hid, elecom_devices); | 
 | 39 |  | 
 | 40 | static struct hid_driver elecom_driver = { | 
 | 41 | 	.name = "elecom", | 
 | 42 | 	.id_table = elecom_devices, | 
 | 43 | 	.report_fixup = elecom_report_fixup | 
 | 44 | }; | 
 | 45 |  | 
 | 46 | static int __init elecom_init(void) | 
 | 47 | { | 
 | 48 | 	return hid_register_driver(&elecom_driver); | 
 | 49 | } | 
 | 50 |  | 
 | 51 | static void __exit elecom_exit(void) | 
 | 52 | { | 
 | 53 | 	hid_unregister_driver(&elecom_driver); | 
 | 54 | } | 
 | 55 |  | 
 | 56 | module_init(elecom_init); | 
 | 57 | module_exit(elecom_exit); | 
 | 58 | MODULE_LICENSE("GPL"); |