* [PATCH 0/4] input: Add support for special keys on ms office kb
@ 2014-01-29 16:57 Hans de Goede
2014-01-29 16:57 ` [PATCH 1/4] input: Add some missing HUT mappings Hans de Goede
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Hans de Goede @ 2014-01-29 16:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input
Hi All,
A member of my local hackerspace has donated a Microsoft Office keyboard to
me. This keyboard has lots of special keys, some of which don't work
and a scrollwheel which does not work. This patch-set adds support for the
scrollwheel and the non working special-keys.
Regards,
Hans
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] input: Add some missing HUT mappings
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
@ 2014-01-29 16:57 ` Hans de Goede
2014-01-29 16:57 ` [PATCH 2/4] input: hid-microsoft: Do the check for the ms usage page per device Hans de Goede
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2014-01-29 16:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Hans de Goede
Add mapping for "AL Next Task/Application", "AL Previous Task/Application"
and "AL File Browser" buttons, as found on the Microsoft Office keyboard.
Note that there already is a mapping for "AL Local Machine Browser" to
KEY_FILE. Unless we ever encounter a device with both that should not be
a problem.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/hid-input.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index d97f232..ef17163 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -789,10 +789,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x199: map_key_clear(KEY_CHAT); break;
case 0x19c: map_key_clear(KEY_LOGOFF); break;
case 0x19e: map_key_clear(KEY_COFFEE); break;
+ case 0x1a3: map_key_clear(KEY_NEXT); break;
+ case 0x1a4: map_key_clear(KEY_PREVIOUS); break;
case 0x1a6: map_key_clear(KEY_HELP); break;
case 0x1a7: map_key_clear(KEY_DOCUMENTS); break;
case 0x1ab: map_key_clear(KEY_SPELLCHECK); break;
case 0x1ae: map_key_clear(KEY_KEYBOARD); break;
+ case 0x1b4: map_key_clear(KEY_FILE); break;
case 0x1b6: map_key_clear(KEY_IMAGES); break;
case 0x1b7: map_key_clear(KEY_AUDIO); break;
case 0x1b8: map_key_clear(KEY_VIDEO); break;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] input: hid-microsoft: Do the check for the ms usage page per device
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
2014-01-29 16:57 ` [PATCH 1/4] input: Add some missing HUT mappings Hans de Goede
@ 2014-01-29 16:57 ` Hans de Goede
2014-01-29 16:57 ` [PATCH 3/4] input: hid-microsoft: Add support for scrollwheel and special keypad keys Hans de Goede
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2014-01-29 16:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Hans de Goede
For some devices we may also want to do custom mappings for other pages.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/hid-microsoft.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 551795b..a161afd 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -62,6 +62,9 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
{
struct input_dev *input = hi->input;
+ if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
+ return 0;
+
switch (usage->hid & HID_USAGE) {
case 0xfd06: ms_map_key_clear(KEY_CHAT); break;
case 0xfd07: ms_map_key_clear(KEY_PHONE); break;
@@ -82,6 +85,9 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
static int ms_presenter_8k_quirk(struct hid_input *hi, struct hid_usage *usage,
unsigned long **bit, int *max)
{
+ if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
+ return 0;
+
set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
case 0xfd08: ms_map_key_clear(KEY_FORWARD); break;
@@ -101,9 +107,6 @@ static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi,
{
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
- if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
- return 0;
-
if (quirks & MS_ERGONOMY) {
int ret = ms_ergonomy_kb_quirk(hi, usage, bit, max);
if (ret)
--
1.8.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] input: hid-microsoft: Add support for scrollwheel and special keypad keys
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
2014-01-29 16:57 ` [PATCH 1/4] input: Add some missing HUT mappings Hans de Goede
2014-01-29 16:57 ` [PATCH 2/4] input: hid-microsoft: Do the check for the ms usage page per device Hans de Goede
@ 2014-01-29 16:57 ` Hans de Goede
2014-01-29 16:57 ` [PATCH 4/4] input: hid-microsoft: Add support for 2 reserved usage ids used on ms office kb Hans de Goede
2014-02-03 10:12 ` [PATCH 0/4] input: Add support for special keys " Jiri Kosina
4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2014-01-29 16:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Hans de Goede
The Microsoft Office keyboard has a scrollwheel as well as some special keys
above the keypad which are handled through the custom MS usage page, this
commit adds support for these.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-microsoft.c | 49 ++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 253fe23..fe5fa34 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1778,6 +1778,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index f9304cb..c4f5147 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -603,6 +603,7 @@
#define USB_VENDOR_ID_MICROSOFT 0x045e
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
+#define USB_DEVICE_ID_MS_OFFICE_KB 0x0048
#define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
#define USB_DEVICE_ID_MS_NE4K 0x00db
#define USB_DEVICE_ID_MS_NE4K_JP 0x00dc
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index a161afd..992252b 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -68,6 +68,26 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
switch (usage->hid & HID_USAGE) {
case 0xfd06: ms_map_key_clear(KEY_CHAT); break;
case 0xfd07: ms_map_key_clear(KEY_PHONE); break;
+ case 0xff00:
+ /* Special keypad keys */
+ ms_map_key_clear(KEY_KPEQUAL);
+ set_bit(KEY_KPLEFTPAREN, input->keybit);
+ set_bit(KEY_KPRIGHTPAREN, input->keybit);
+ break;
+ case 0xff01:
+ /* Scroll wheel */
+ hid_map_usage_clear(hi, usage, bit, max, EV_REL, REL_WHEEL);
+ break;
+ case 0xff02:
+ /*
+ * This byte contains a copy of the modifier keys byte of a
+ * standard hid keyboard report, as send by interface 0
+ * (this usage is found on interface 1).
+ *
+ * This byte only gets send when another key in the same report
+ * changes state, and as such is useless, ignore it.
+ */
+ return -1;
case 0xff05:
set_bit(EV_REP, input->evbit);
ms_map_key_clear(KEY_F13);
@@ -136,14 +156,39 @@ static int ms_event(struct hid_device *hdev, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
+ struct input_dev *input;
if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
!usage->type)
return 0;
+ input = field->hidinput->input;
+
/* Handling MS keyboards special buttons */
+ if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff00)) {
+ /* Special keypad keys */
+ input_report_key(input, KEY_KPEQUAL, value & 0x01);
+ input_report_key(input, KEY_KPLEFTPAREN, value & 0x02);
+ input_report_key(input, KEY_KPRIGHTPAREN, value & 0x04);
+ return 1;
+ }
+
+ if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff01)) {
+ /* Scroll wheel */
+ int step = ((value & 0x60) >> 5) + 1;
+
+ switch (value & 0x1f) {
+ case 0x01:
+ input_report_rel(input, REL_WHEEL, step);
+ break;
+ case 0x1f:
+ input_report_rel(input, REL_WHEEL, -step);
+ break;
+ }
+ return 1;
+ }
+
if (quirks & MS_ERGONOMY && usage->hid == (HID_UP_MSVENDOR | 0xff05)) {
- struct input_dev *input = field->hidinput->input;
static unsigned int last_key = 0;
unsigned int key = 0;
switch (value) {
@@ -196,6 +241,8 @@ err_free:
static const struct hid_device_id ms_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV),
.driver_data = MS_HIDINPUT },
+ { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB),
+ .driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K),
.driver_data = MS_ERGONOMY },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP),
--
1.8.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] input: hid-microsoft: Add support for 2 reserved usage ids used on ms office kb
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
` (2 preceding siblings ...)
2014-01-29 16:57 ` [PATCH 3/4] input: hid-microsoft: Add support for scrollwheel and special keypad keys Hans de Goede
@ 2014-01-29 16:57 ` Hans de Goede
2014-02-03 10:12 ` [PATCH 0/4] input: Add support for special keys " Jiri Kosina
4 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2014-01-29 16:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-input, Hans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/hid-microsoft.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 992252b..10dd20f 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -62,6 +62,22 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
{
struct input_dev *input = hi->input;
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
+ switch (usage->hid & HID_USAGE) {
+ /*
+ * Microsoft uses these 2 reserved usage ids for 2 keys on
+ * the MS office kb labelled "Office Home" and "Task Pane".
+ */
+ case 0x29d:
+ ms_map_key_clear(KEY_PROG1);
+ return 1;
+ case 0x29e:
+ ms_map_key_clear(KEY_PROG2);
+ return 1;
+ }
+ return 0;
+ }
+
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] input: Add support for special keys on ms office kb
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
` (3 preceding siblings ...)
2014-01-29 16:57 ` [PATCH 4/4] input: hid-microsoft: Add support for 2 reserved usage ids used on ms office kb Hans de Goede
@ 2014-02-03 10:12 ` Jiri Kosina
4 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2014-02-03 10:12 UTC (permalink / raw)
To: Hans de Goede; +Cc: linux-input
On Wed, 29 Jan 2014, Hans de Goede wrote:
> A member of my local hackerspace has donated a Microsoft Office keyboard to
> me. This keyboard has lots of special keys, some of which don't work
> and a scrollwheel which does not work. This patch-set adds support for the
> scrollwheel and the non working special-keys.
Applied, thanks Hans.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-03 10:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 16:57 [PATCH 0/4] input: Add support for special keys on ms office kb Hans de Goede
2014-01-29 16:57 ` [PATCH 1/4] input: Add some missing HUT mappings Hans de Goede
2014-01-29 16:57 ` [PATCH 2/4] input: hid-microsoft: Do the check for the ms usage page per device Hans de Goede
2014-01-29 16:57 ` [PATCH 3/4] input: hid-microsoft: Add support for scrollwheel and special keypad keys Hans de Goede
2014-01-29 16:57 ` [PATCH 4/4] input: hid-microsoft: Add support for 2 reserved usage ids used on ms office kb Hans de Goede
2014-02-03 10:12 ` [PATCH 0/4] input: Add support for special keys " 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).