From: Jiri Slaby <jirislaby@gmail.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, marcel@holtmann.org, dmitry.torokhov@gmail.com,
Jiri Slaby <jirislaby@gmail.com>
Subject: [RFC 8/8] test
Date: Fri, 4 Apr 2008 22:35:57 +0200 [thread overview]
Message-ID: <1207341357-17792-9-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <1207341357-17792-1-git-send-email-jirislaby@gmail.com>
Just demonstrative example.
---
drivers/hid/Makefile | 2 +-
drivers/hid/hid-core.c | 1 +
drivers/hid/test.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 1 deletions(-)
create mode 100644 drivers/hid/test.c
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 8a5cbbe..e607b7b 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -3,7 +3,7 @@
#
hid-objs := hid-core.o hid-input.o hid-input-quirks.o
-obj-$(CONFIG_HID) += hid.o
+obj-$(CONFIG_HID) += hid.o test.o
hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index e1b17e7..aff61c6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1155,6 +1155,7 @@ static const struct hid_device_id hid_usb_blacklist[] = {
{ HID_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
{ HID_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
{ HID_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS) },
+ { HID_DEVICE(0x045e, 0x00f0) },
{ }
};
diff --git a/drivers/hid/test.c b/drivers/hid/test.c
new file mode 100644
index 0000000..3633199
--- /dev/null
+++ b/drivers/hid/test.c
@@ -0,0 +1,62 @@
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+static const struct hid_report_id t_report_table[] = {
+ { HID_REPORT_ID(0) },
+ { HID_TERMINATOR }
+};
+
+static int t_raw_event(struct hid_device *hdev, struct hid_report *report,
+ u8 *data, int size)
+{
+/* printk(KERN_DEBUG "report: %u, %u, %d, %.8x\n",
+ report->id, report->type,
+ size, __swab32(*((u32 *)data)));*/
+
+ return -ENODEV;
+}
+
+static const struct hid_usage_id t_usage_table[] = {
+ { HID_USAGE_ID(HID_ANY_ID, 8) },
+ { HID_TERMINATOR }
+};
+
+static int t_event(struct hid_device *hdev, struct hid_field *field,
+ struct hid_usage *usage, __s32 value)
+{
+/* printk(KERN_DEBUG "usage: %u %u %u %d\n",
+ usage->hid, usage->code, usage->type, value);*/
+
+ return -ENODEV;
+}
+
+static const struct hid_device_id t_devices[] = {
+ { HID_DEVICE(0x045e, 0x00f0) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, t_devices);
+
+static struct hid_driver t_driver = {
+ .name = "test-usb",
+ .bus_type = BUS_USB,
+ .id_table = t_devices,
+ .usage_table = t_usage_table,
+ .event = t_event,
+ .report_table = t_report_table,
+ .raw_event = t_raw_event,
+};
+
+static int t_init(void)
+{
+ return hid_register_driver(&t_driver);
+}
+
+static void t_exit(void)
+{
+ hid_unregister_driver(&t_driver);
+}
+
+module_init(t_init);
+module_exit(t_exit);
+MODULE_LICENSE("GPL");
--
1.5.4.4
prev parent reply other threads:[~2008-04-04 20:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-04 20:35 Hid bus #2 Jiri Slaby
2008-04-04 20:35 ` [RFC 1/8] HID: make a bus from hid code Jiri Slaby
2008-04-04 20:35 ` [RFC 2/8] HID: hid, make parsing event driven Jiri Slaby
2008-04-04 20:35 ` [RFC 3/8] HID: move ids into separate file Jiri Slaby
2008-04-04 20:35 ` [RFC 4/8] HID: move usage input mapping to hid.h Jiri Slaby
2008-04-04 20:35 ` [RFC 5/8] HID: move logitech report quirks Jiri Slaby
2008-04-04 20:35 ` [RFC 6/8] HID: move ignore quirks Jiri Slaby
2008-04-04 20:35 ` [RFC 7/8] HID: move apple quirks Jiri Slaby
2008-04-16 13:31 ` HID bus Jiri Kosina
2008-04-16 14:43 ` Jiri Slaby
2008-04-16 20:30 ` Jiri Slaby
2008-04-16 20:45 ` Dmitry Torokhov
2008-04-16 20:54 ` Jiri Slaby
2008-04-16 21:05 ` Dmitry Torokhov
2008-04-18 11:36 ` Jiri Kosina
2008-04-19 22:38 ` Jiri Slaby
2008-04-20 11:57 ` Jiri Slaby
2008-04-22 0:00 ` Jiri Kosina
2008-04-27 11:22 ` Jiri Slaby
2008-05-09 21:24 ` Jiri Slaby
2008-04-20 16:15 ` Anssi Hannula
2008-04-20 18:07 ` Jiri Slaby
2008-04-21 9:25 ` Jiri Kosina
2008-04-21 13:36 ` Dmitry Torokhov
2008-04-21 23:05 ` Jiri Slaby
2008-04-16 13:45 ` [RFC 7/8] HID: move apple quirks Jiri Kosina
2008-04-16 14:42 ` Jiri Slaby
2008-04-18 11:33 ` Jiri Kosina
2008-04-18 11:35 ` David Miller
2008-04-04 20:35 ` Jiri Slaby [this message]
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=1207341357-17792-9-git-send-email-jirislaby@gmail.com \
--to=jirislaby@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=marcel@holtmann.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).