linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] HID: driver for BTC "Emprex 3009URF III Vista MCE Remote" quirky remote
@ 2010-02-27 11:32 Ben Hardill
  2010-03-15 16:03 ` Jiri Kosina
  0 siblings, 1 reply; 13+ messages in thread
From: Ben Hardill @ 2010-02-27 11:32 UTC (permalink / raw)
  To: linux-input, jkosina; +Cc: Wayne Thomas

> > are using this usage page as standard.  I was going to fiddle
> > around with this but instead will wait to see how this will be
> > implemented in udev. Sorry I couldn't relieve some of your
> > work-load.
>
>  udev keymaps are described in README.keymap.txt in udev package. You
>  can find current version on
> 
http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=extras/keymap/README.keymap.txt;h=9c2d5dc16a151d57720b1dfe39e784f1b1d47367;hb=HEAD
>
>
>
Thanks,

Jiri,

I've tried to follow the instructions in the README.keymap but when I 
run /lib/udev/keymap -i input/eventX against both of the event devices I 
get nothing out, not even the "unknown" message mentioned in the doc.

I'm not totally up to speed with this yet, but I think i may be down to 
the "e0x0ffbc0000 HID usage page" that Wayne mentioned earlier not being 
read by the input layer and passed to the udev layer. If this is the 
case then before udev can be used to make hardware like this work the 
input layer will need to add support for this page.

Thanks,

Ben


^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH] HID: driver for BTC "Emprex 3009URF III Vista MCE Remote" quirky remote
@ 2009-12-31  8:13 Wayne Thomas
  2010-01-02  2:53 ` Dmitry Torokhov
  0 siblings, 1 reply; 13+ messages in thread
From: Wayne Thomas @ 2009-12-31  8:13 UTC (permalink / raw)
  To: jkosina, linux-input; +Cc: linux-kernel

HID: driver for BTC "Emprex 3009URF III Vista MCE Remote" quirky remote

The Behavior Tech. Computer Corp. (BTC) remote branded as "Emprex 3009URF III
Vista Remote Controller" uses non-standard mappings for all of its 'special
purpose' keys (0xffbc usage page).  Applies cleanly to 2.6.30 and 2.6.32
(other versions not tested).
scripts/scriptpatch.pl reports 13 styling errors in hid-btc.c
("break;" should be on trailing lines)
but have not changed them to maintain styling consistency with existing drivers.

Signed-off-by: Wayne Thomas <waynethomas69@gmail.com>

diff -uprN linux/drivers/hid/hid-btc.c linux-working/drivers/hid/hid-btc.c
--- linux/drivers/hid/hid-btc.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-working/drivers/hid/hid-btc.c	2009-12-13 13:41:34.000000000 +0100
@@ -0,0 +1,75 @@
+/*
+ *  HID driver for BTC Emprex remote
+ *
+ *  Copyright (c) 2009 Wayne Thomas
+ *  based on hid-topseed driver
+ */
+
+/*
+ * 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"
+
+#define btc_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
+					EV_KEY, (c))
+static int btc_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max)
+{
+	if ((usage->hid & HID_USAGE_PAGE) != 0x0ffbc0000)
+		return 0;
+
+	switch (usage->hid & HID_USAGE) {
+	case 0x00d: btc_map_key_clear(KEY_MEDIA);	break;
+	case 0x024: btc_map_key_clear(KEY_MENU);	break;
+	case 0x048: btc_map_key_clear(KEY_TV2);		break;
+	case 0x025: btc_map_key_clear(KEY_TV);		break;
+	case 0x047: btc_map_key_clear(KEY_MP3);		break;
+	case 0x049: btc_map_key_clear(KEY_CAMERA);	break;
+	case 0x04a: btc_map_key_clear(KEY_VIDEO);	break;
+	case 0x050: btc_map_key_clear(KEY_RADIO);	break;
+	case 0x05b: btc_map_key_clear(KEY_RED);		break;
+	case 0x05c: btc_map_key_clear(KEY_GREEN);	break;
+	case 0x05d: btc_map_key_clear(KEY_YELLOW);	break;
+	case 0x05e: btc_map_key_clear(KEY_BLUE);	break;
+	case 0x05a: btc_map_key_clear(KEY_TEXT);	break;
+	default:
+		return 0;
+	}
+
+	return 1;
+}
+
+static const struct hid_device_id btc_devices[] = {
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
+	{ }
+};
+MODULE_DEVICE_TABLE(hid, btc_devices);
+
+static struct hid_driver btc_driver = {
+	.name = "btc",
+	.id_table = btc_devices,
+	.input_mapping = btc_input_mapping,
+};
+
+static int btc_init(void)
+{
+	return hid_register_driver(&btc_driver);
+}
+
+static void btc_exit(void)
+{
+	hid_unregister_driver(&btc_driver);
+}
+
+module_init(btc_init);
+module_exit(btc_exit);
+MODULE_LICENSE("GPL");
diff -uprN linux/drivers/hid/hid-core.c linux-working/drivers/hid/hid-core.c
--- linux/drivers/hid/hid-core.c	2009-12-03 04:51:21.000000000 +0100
+++ linux-working/drivers/hid/hid-core.c	2009-12-13 13:44:19.000000000 +0100
@@ -1290,6 +1290,7 @@ static const struct hid_device_id hid_bl
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
diff -uprN linux/drivers/hid/hid-ids.h linux-working/drivers/hid/hid-ids.h
--- linux/drivers/hid/hid-ids.h	2009-12-03 04:51:21.000000000 +0100
+++ linux-working/drivers/hid/hid-ids.h	2009-12-13 13:45:06.000000000 +0100
@@ -113,6 +113,9 @@
 #define USB_VENDOR_ID_BERKSHIRE		0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD	0x1140

+#define USB_VENDOR_ID_BTC		0x046e
+#define USB_DEVICE_ID_BTC_EMPREX_REMOTE	0x5578
+
 #define USB_VENDOR_ID_CH		0x068e
 #define USB_DEVICE_ID_CH_PRO_PEDALS	0x00f2
 #define USB_DEVICE_ID_CH_COMBATSTICK	0x00f4
diff -uprN linux/drivers/hid/Kconfig linux-working/drivers/hid/Kconfig
--- linux/drivers/hid/Kconfig	2009-12-03 04:51:21.000000000 +0100
+++ linux-working/drivers/hid/Kconfig	2009-12-13 13:46:58.000000000 +0100
@@ -80,6 +80,13 @@ config HID_BELKIN
 	---help---
 	Support for Belkin Flip KVM and Wireless keyboard.

+config HID_BTC
+	tristate "BTC Emprex remote control support" if EMBEDDED
+	depends on USB_HID
+	default y
+	---help---
+	Say Y if you have a BTC Emprex remote control.
+
 config HID_CHERRY
 	tristate "Cherry" if EMBEDDED
 	depends on USB_HID
diff -uprN linux/drivers/hid/Makefile linux-working/drivers/hid/Makefile
--- linux/drivers/hid/Makefile	2009-12-03 04:51:21.000000000 +0100
+++ linux-working/drivers/hid/Makefile	2009-12-13 13:48:21.000000000 +0100
@@ -22,6 +22,7 @@ endif
 obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.o
 obj-$(CONFIG_HID_APPLE)		+= hid-apple.o
 obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
+obj-$(CONFIG_HID_BTC)		+= hid-btc.o
 obj-$(CONFIG_HID_CHERRY)	+= hid-cherry.o
 obj-$(CONFIG_HID_CHICONY)	+= hid-chicony.o
 obj-$(CONFIG_HID_CYPRESS)	+= hid-cypress.o

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-04-20 18:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 11:32 [PATCH] HID: driver for BTC "Emprex 3009URF III Vista MCE Remote" quirky remote Ben Hardill
2010-03-15 16:03 ` Jiri Kosina
2010-03-17 19:18   ` Wayne Thomas
2010-03-18 10:51     ` Jiri Kosina
2010-03-18 11:00       ` Jiri Kosina
2010-03-18 20:03         ` Wayne Thomas
2010-04-20 18:29           ` Wayne Thomas
  -- strict thread matches above, loose matches on Subject: below --
2009-12-31  8:13 Wayne Thomas
2010-01-02  2:53 ` Dmitry Torokhov
2010-01-02  9:52   ` Wayne Thomas
2010-01-02 21:25     ` Jiri Kosina
2010-01-18 10:33       ` Wayne Thomas
2010-02-17 15:20         ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).