linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Map MS Presenter 8000 bottom-side buttons
@ 2007-10-15 17:35 Jan Kiszka
  2007-10-16 10:16 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2007-10-15 17:35 UTC (permalink / raw)
  To: linux-input

The MS Presenter 8000 bluetooth mouse is a "dual-use" device: If you press a button on the top, you can turn it around and find special keys on the other side, useful for presentations. This patch maps those three bottom-keys that are not already detected to the intended functions. The magic bottom on the top is mapped to F5 when we switch from mouse to presenter mode in order to activate the presentation mode in the related software (e.g. OpenOffice).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

---
 drivers/hid/hid-input.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Index: linux-2.6.23.1/drivers/hid/hid-input.c
===================================================================
--- linux-2.6.23.1.orig/drivers/hid/hid-input.c
+++ linux-2.6.23.1/drivers/hid/hid-input.c
@@ -737,9 +737,19 @@ static void hidinput_configure_usage(str
 					case 0xff0b: map_key_clear(BTN_B);		break;
 					default:    goto ignore;
 				}
-			} else {
+			} else if (device->vendor == 0x045e && device->product == 0x0713) {
+				set_bit(EV_REP, input->evbit);
+				switch(usage->hid & HID_USAGE) {
+					/* Make MS Presenter 8000 bottom-side keys useful,
+					 * e.g. under OOffice */
+					case 0xfd08: map_key_clear(KEY_RIGHT);		break;
+					case 0xfd09: map_key_clear(KEY_LEFT);		break;
+					case 0xfd0b: map_key_clear(KEY_PAUSE);		break;
+					case 0xfd0f: map_key_clear(KEY_F5);		break;
+					default:    goto ignore;
+				}
+			} else
 				goto ignore;
-			}
 			break;
 
 		case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */

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

* Re: [PATCH] Map MS Presenter 8000 bottom-side buttons
  2007-10-15 17:35 [PATCH] Map MS Presenter 8000 bottom-side buttons Jan Kiszka
@ 2007-10-16 10:16 ` Jiri Kosina
  2007-10-16 17:12   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2007-10-16 10:16 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: linux-input

On Mon, 15 Oct 2007, Jan Kiszka wrote:

> +			} else if (device->vendor == 0x045e && device->product == 0x0713) {
> +				set_bit(EV_REP, input->evbit);
> +				switch(usage->hid & HID_USAGE) {
> +					/* Make MS Presenter 8000 bottom-side keys useful,
> +					 * e.g. under OOffice */
> +					case 0xfd08: map_key_clear(KEY_RIGHT);		break;
> +					case 0xfd09: map_key_clear(KEY_LEFT);		break;
> +					case 0xfd0b: map_key_clear(KEY_PAUSE);		break;
> +					case 0xfd0f: map_key_clear(KEY_F5);		break;
> +					default:    goto ignore;
> +				}
> +			} else

Hi Jan,

could you please take a short look at current Linus' git tree - there are 
some more devices using MSVENDOR page, and we have introduced macros to 
match them. It would be great if you could redo the patch to fit into this 
picture and send it to me again.

Thanks,

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH] Map MS Presenter 8000 bottom-side buttons
  2007-10-16 10:16 ` Jiri Kosina
@ 2007-10-16 17:12   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2007-10-16 17:12 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input

Jiri Kosina wrote:
> On Mon, 15 Oct 2007, Jan Kiszka wrote:
> 
>> +			} else if (device->vendor == 0x045e && device->product == 0x0713) {
>> +				set_bit(EV_REP, input->evbit);
>> +				switch(usage->hid & HID_USAGE) {
>> +					/* Make MS Presenter 8000 bottom-side keys useful,
>> +					 * e.g. under OOffice */
>> +					case 0xfd08: map_key_clear(KEY_RIGHT);		break;
>> +					case 0xfd09: map_key_clear(KEY_LEFT);		break;
>> +					case 0xfd0b: map_key_clear(KEY_PAUSE);		break;
>> +					case 0xfd0f: map_key_clear(KEY_F5);		break;
>> +					default:    goto ignore;
>> +				}
>> +			} else
> 
> Hi Jan,
> 
> could you please take a short look at current Linus' git tree - there are 
> some more devices using MSVENDOR page, and we have introduced macros to 
> match them. It would be great if you could redo the patch to fit into this 
> picture and send it to me again.

OK. Do you mean something like this? Sorry, in a hurry, not even
compile-tested...

--snip--

The MS Presenter 8000 bluetooth mouse is a "dual-use" device: If you
press a button on the top, you can turn it around and find special keys
on the other side, useful for presentations. This patch maps those three
bottom-keys that are not already detected to the intended functions. The
magic bottom on the top is mapped to F5 when we switch from mouse to
presenter mode in order to activate the presentation mode in the related
software (e.g. OpenOffice).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

---
 drivers/hid/hid-input.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/hid/hid-input.c
===================================================================
--- linux-2.6.orig/drivers/hid/hid-input.c
+++ linux-2.6/drivers/hid/hid-input.c
@@ -89,6 +89,7 @@ static const struct {
 /* hardware needing special handling due to colliding MSVENDOR page usages */
 #define IS_CHICONY_TACTICAL_PAD(x) (x->vendor == 0x04f2 && device->product == 0x0418)
 #define IS_MS_KB(x) (x->vendor == 0x045e && (x->product == 0x00db || x->product == 0x00f9))
+#define IS_MS_PRESENTER_8000(x) (x->vendor == 0x045e && x->product == 0x0713)
 
 #ifdef CONFIG_USB_HIDINPUT_POWERBOOK
 
@@ -780,9 +781,20 @@ static void hidinput_configure_usage(str
 						set_bit(KEY_F18, input->keybit);
 					default:	goto ignore;
 				}
-			} else {
+
+			/* Microsoft Wireless Notebook Presenter Mouse 8000 */
+			} else if (IS_MS_PRESENTER_8000(device)) {
+				set_bit(EV_REP, input->evbit);
+				switch(usage->hid & HID_USAGE) {
+					/* Useful mappings of bottom-side keys for presentations */
+					case 0xfd08: map_key_clear(KEY_RIGHT);		break;
+					case 0xfd09: map_key_clear(KEY_LEFT);		break;
+					case 0xfd0b: map_key_clear(KEY_PAUSE);		break;
+					case 0xfd0f: map_key_clear(KEY_F5);		break;
+					default:    goto ignore;
+				}
+			} else
 				goto ignore;
-			}
 			break;
 
 		case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */

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

end of thread, other threads:[~2007-10-16 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 17:35 [PATCH] Map MS Presenter 8000 bottom-side buttons Jan Kiszka
2007-10-16 10:16 ` Jiri Kosina
2007-10-16 17:12   ` Jan Kiszka

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).