Blame view

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