From: Jiri Slaby <jirislaby@gmail.com>
To: jkosina@suse.cz
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
"Steven Noonan" <steven@uplinklabs.net>,
"Justin Mattock" <justinmattock@gmail.com>,
"Sven Anders" <anders@anduras.de>,
Marcel Holtmann <marcel@holtmann.org>,
linux-bluetooth@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>
Subject: [PATCH 1/2] HID: add hid_type
Date: Sun, 19 Oct 2008 16:15:48 +0200 [thread overview]
Message-ID: <1224425749-22652-1-git-send-email-jirislaby@gmail.com> (raw)
Add type to the hid structure to distinguish to which device type
(mouse/kbd) we are talking to. Needed for per device type ignore
list support.
Note: this patch leaves the type as unknown for bluetooth devices,
there is not support for this in the hidp code.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
drivers/hid/usbhid/hid-core.c | 8 ++++++++
include/linux/hid.h | 7 +++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 1d3b8a3..20617d8 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -972,6 +972,14 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
hid->product = le16_to_cpu(dev->descriptor.idProduct);
hid->name[0] = 0;
+ switch (intf->cur_altsetting->desc.bInterfaceProtocol) {
+ case USB_INTERFACE_PROTOCOL_KEYBOARD:
+ hid->type = HID_TYPE_KEYBOARD;
+ break;
+ case USB_INTERFACE_PROTOCOL_MOUSE:
+ hid->type = HID_TYPE_MOUSE;
+ break;
+ }
if (dev->manufacturer)
strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));
diff --git a/include/linux/hid.h b/include/linux/hid.h
index f13bca2..36a3953 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -417,6 +417,12 @@ struct hid_input {
struct input_dev *input;
};
+enum hid_type {
+ HID_TYPE_UNKNOWN = 0,
+ HID_TYPE_MOUSE,
+ HID_TYPE_KEYBOARD
+};
+
struct hid_driver;
struct hid_ll_driver;
@@ -431,6 +437,7 @@ struct hid_device { /* device report descriptor */
__u32 vendor; /* Vendor ID */
__u32 product; /* Product ID */
__u32 version; /* HID version */
+ enum hid_type type; /* device type (mouse, kbd, ...) */
unsigned country; /* HID country */
struct hid_report_enum report_enum[HID_REPORT_TYPES];
--
1.6.0.2
next reply other threads:[~2008-10-19 14:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-19 14:15 Jiri Slaby [this message]
2008-10-19 14:15 ` [PATCH 2/2] HID: fix appletouch regression Jiri Slaby
2008-10-19 19:40 ` several messages Jiri Kosina
2008-10-19 20:06 ` Justin Mattock
2008-10-19 20:06 ` Justin Mattock
2008-10-19 22:09 ` Jiri Slaby
2008-10-19 22:23 ` [PATCH 2/2] HID: fix appletouch regression (was Re: several messages) Jiri Kosina
2008-10-19 19:08 ` [PATCH 1/2] HID: add hid_type Justin Mattock
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=1224425749-22652-1-git-send-email-jirislaby@gmail.com \
--to=jirislaby@gmail.com \
--cc=anders@anduras.de \
--cc=jkosina@suse.cz \
--cc=justinmattock@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=steven@uplinklabs.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.