aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/uhid.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-06-10 09:16:13 -0400
committerJiri Kosina <jkosina@suse.cz>2012-06-18 07:41:59 -0400
commit1ccd7a2a33f2b47e46c51f4501e9623a51d28090 (patch)
treebfcee4e23158ec8eb777c77ef3ea1d484dde7fff /drivers/hid/uhid.c
parent3c2c4b73aa79e4a1b601710b59e092441175f4bb (diff)
HID: uhid: introduce user-space I/O driver support for HID
This adds a dummy driver that will support user-space I/O drivers for the HID subsystem. This allows to write transport-level drivers like USB-HID and Bluetooth-HID in user-space. Low-Energy Bluetooth needs this to feed HID data that is parsed in user-space back into the kernel. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/uhid.c')
-rw-r--r--drivers/hid/uhid.c88
1 files changed, 88 insertions, 0 deletions
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");