From: Hans de Goede <hdegoede@redhat.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 2/4] input: hid-microsoft: Do the check for the ms usage page per device
Date: Wed, 29 Jan 2014 17:57:42 +0100 [thread overview]
Message-ID: <1391014664-2642-3-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1391014664-2642-1-git-send-email-hdegoede@redhat.com>
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
next prev parent reply other threads:[~2014-01-29 16:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391014664-2642-3-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).