HID: add proper support for Elecom BM084 bluetooth mouse
authorRichard Nauber <richard.nauber@googlemail.com>
Mon, 28 Jun 2010 16:54:25 +0000 (18:54 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 28 Jun 2010 17:02:47 +0000 (19:02 +0200)
This patch removes the annoying feature of Elecoms BM084 to constantly scroll to the right.
The device can be found at:
http://www.dealextreme.com/details.dx/sku.15402

Signed-off-by: Richard Nauber <Richard.Nauber@gmail.com>
[jkosina@suse.cz: fix build error]
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-core.c
drivers/hid/hid-elecom.c [new file with mode: 0644]
drivers/hid/hid-ids.h

index 76ba59b9fea1bd37595c3e3a7cfc30a2c8e8a06c..ecc11405922a4bf3681030d7c4258b4e92700cbb 100644 (file)
@@ -148,6 +148,12 @@ config HID_EGALAX
        ---help---
        Support for the eGalax dual-touch panel.
 
+config HID_ELECOM
+       tristate "ELECOM"
+       depends on BT_HIDP
+       ---help---
+       Support for the ELECOM BM084 (bluetooth mouse).
+
 config HID_EZKEY
        tristate "Ezkey" if EMBEDDED
        depends on USB_HID
index 22e47eaeea322ffd4e64c329e0e7be6139e9321b..3a6eb7ec42e2103bff4c69f491a64f5f88a8557a 100644 (file)
@@ -32,6 +32,7 @@ obj-$(CONFIG_HID_CHICONY)     += hid-chicony.o
 obj-$(CONFIG_HID_CYPRESS)      += hid-cypress.o
 obj-$(CONFIG_HID_DRAGONRISE)   += hid-drff.o
 obj-$(CONFIG_HID_EGALAX)       += hid-egalax.o
+obj-$(CONFIG_HID_ELECOM)       += hid-elecom.o
 obj-$(CONFIG_HID_EZKEY)                += hid-ezkey.o
 obj-$(CONFIG_HID_GYRATION)     += hid-gyration.o
 obj-$(CONFIG_HID_KENSINGTON)   += hid-kensington.o
index e10e314d38cc8e620e2bc75ee3a3a3899d0e837b..20bccd4d488afbd2c54b88b333e58bc04eb1b1bd 100644 (file)
@@ -1294,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
        { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
+       { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
        { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
diff --git a/drivers/hid/hid-elecom.c b/drivers/hid/hid-elecom.c
new file mode 100644 (file)
index 0000000..7a40878
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *  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"
+
+static void elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+               unsigned int rsize)
+{
+       if (rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) {
+               dev_info(&hdev->dev, "Fixing up Elecom BM084 "
+                               "report descriptor.\n");
+               rdesc[47] = 0x00;
+       }
+}
+
+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");
index 9776896cc4fc2eab0f654ffaa7ec96593c89d8ea..69778c5cd4d4126958390da90669020dc538c250 100644 (file)
 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER   0x0001
 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH   0x480d
 
+#define USB_VENDOR_ID_ELECOM           0x056e
+#define USB_DEVICE_ID_ELECOM_BM084     0x0061
+
 #define USB_VENDOR_ID_ELO              0x04E7
 #define USB_DEVICE_ID_ELO_TS2700       0x0020