aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/Kconfig21
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/uhid.c88
3 files changed, 110 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index e9c68fedfcff..8cca0af2dbd1 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -59,6 +59,27 @@ config HIDRAW
59 59
60 If unsure, say Y. 60 If unsure, say Y.
61 61
62config UHID
63 tristate "User-space I/O driver support for HID subsystem"
64 depends on HID
65 default n
66 ---help---
67 Say Y here if you want to provide HID I/O Drivers from user-space.
68 This allows to write I/O drivers in user-space and feed the data from
69 the device into the kernel. The kernel parses the HID reports, loads the
70 corresponding HID Device Driver or provides input devices on top of your
71 user-space device.
72
73 This driver cannot be used to parse HID-reports in user-space and write
74 special HID-drivers. You should use hidraw for that.
75 Instead, this driver allows to write the transport-layer driver in
76 user-space like USB-HID and Bluetooth-HID do in kernel-space.
77
78 If unsure, say N.
79
80 To compile this driver as a module, choose M here: the
81 module will be called uhid.
82
62source "drivers/hid/usbhid/Kconfig" 83source "drivers/hid/usbhid/Kconfig"
63 84
64menu "Special HID drivers" 85menu "Special HID drivers"
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index ca6cc9f0485c..d7061928325e 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -8,6 +8,7 @@ ifdef CONFIG_DEBUG_FS
8endif 8endif
9 9
10obj-$(CONFIG_HID) += hid.o 10obj-$(CONFIG_HID) += hid.o
11obj-$(CONFIG_UHID) += uhid.o
11 12
12obj-$(CONFIG_HID_GENERIC) += hid-generic.o 13obj-$(CONFIG_HID_GENERIC) += hid-generic.o
13 14
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
new file mode 100644
index 000000000000..5b02d6cb0e60
--- /dev/null
+++ b/drivers/hid/uhid.c
@@ -0,0 +1,88 @@
1/*
2 * User-space I/O driver support for HID subsystem
3 * Copyright (c) 2012 David Herrmann
4 */
5
6/*
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
11 */
12
13#include <linux/atomic.h>
14#include <linux/device.h>
15#include <linux/fs.h>
16#include <linux/hid.h>
17#include <linux/input.h>
18#include <linux/miscdevice.h>
19#include <linux/module.h>
20#include <linux/mutex.h>
21#include <linux/poll.h>
22#include <linux/sched.h>
23#include <linux/spinlock.h>
24#include <linux/uhid.h>
25#include <linux/wait.h>
26
27#define UHID_NAME "uhid"
28
29static struct miscdevice uhid_misc;
30
31static int uhid_char_open(struct inode *inode, struct file *file)
32{
33 return 0;
34}
35
36static int uhid_char_release(struct inode *inode, struct file *file)
37{
38 return 0;
39}
40
41static ssize_t uhid_char_read(struct file *file, char __user *buffer,
42 size_t count, loff_t *ppos)
43{
44 return 0;
45}
46
47static ssize_t uhid_char_write(struct file *file, const char __user *buffer,
48 size_t count, loff_t *ppos)
49{
50 return 0;
51}
52
53static unsigned int uhid_char_poll(struct file *file, poll_table *wait)
54{
55 return 0;
56}
57
58static const struct file_operations uhid_fops = {
59 .owner = THIS_MODULE,
60 .open = uhid_char_open,
61 .release = uhid_char_release,
62 .read = uhid_char_read,
63 .write = uhid_char_write,
64 .poll = uhid_char_poll,
65 .llseek = no_llseek,
66};
67
68static struct miscdevice uhid_misc = {
69 .fops = &uhid_fops,
70 .minor = MISC_DYNAMIC_MINOR,
71 .name = UHID_NAME,
72};
73
74static int __init uhid_init(void)
75{
76 return misc_register(&uhid_misc);
77}
78
79static void __exit uhid_exit(void)
80{
81 misc_deregister(&uhid_misc);
82}
83
84module_init(uhid_init);
85module_exit(uhid_exit);
86MODULE_LICENSE("GPL");
87MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>");
88MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem");