diff options
| -rw-r--r-- | drivers/hid/uhid.c | 18 | ||||
| -rw-r--r-- | include/linux/uhid.h | 8 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 0226ba3f5307..4dd693e1c8b8 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
| @@ -112,6 +112,24 @@ static void uhid_hid_close(struct hid_device *hid) | |||
| 112 | static int uhid_hid_input(struct input_dev *input, unsigned int type, | 112 | static int uhid_hid_input(struct input_dev *input, unsigned int type, |
| 113 | unsigned int code, int value) | 113 | unsigned int code, int value) |
| 114 | { | 114 | { |
| 115 | struct hid_device *hid = input_get_drvdata(input); | ||
| 116 | struct uhid_device *uhid = hid->driver_data; | ||
| 117 | unsigned long flags; | ||
| 118 | struct uhid_event *ev; | ||
| 119 | |||
| 120 | ev = kzalloc(sizeof(*ev), GFP_ATOMIC); | ||
| 121 | if (!ev) | ||
| 122 | return -ENOMEM; | ||
| 123 | |||
| 124 | ev->type = UHID_OUTPUT_EV; | ||
| 125 | ev->u.output_ev.type = type; | ||
| 126 | ev->u.output_ev.code = code; | ||
| 127 | ev->u.output_ev.value = value; | ||
| 128 | |||
| 129 | spin_lock_irqsave(&uhid->qlock, flags); | ||
| 130 | uhid_queue(uhid, ev); | ||
| 131 | spin_unlock_irqrestore(&uhid->qlock, flags); | ||
| 132 | |||
| 115 | return 0; | 133 | return 0; |
| 116 | } | 134 | } |
| 117 | 135 | ||
diff --git a/include/linux/uhid.h b/include/linux/uhid.h index 351650b7a0f6..3fa484921010 100644 --- a/include/linux/uhid.h +++ b/include/linux/uhid.h | |||
| @@ -29,6 +29,7 @@ enum uhid_event_type { | |||
| 29 | UHID_STOP, | 29 | UHID_STOP, |
| 30 | UHID_OPEN, | 30 | UHID_OPEN, |
| 31 | UHID_CLOSE, | 31 | UHID_CLOSE, |
| 32 | UHID_OUTPUT_EV, | ||
| 32 | UHID_INPUT, | 33 | UHID_INPUT, |
| 33 | }; | 34 | }; |
| 34 | 35 | ||
| @@ -53,12 +54,19 @@ struct uhid_input_req { | |||
| 53 | __u16 size; | 54 | __u16 size; |
| 54 | } __attribute__((__packed__)); | 55 | } __attribute__((__packed__)); |
| 55 | 56 | ||
| 57 | struct uhid_output_ev_req { | ||
| 58 | __u16 type; | ||
| 59 | __u16 code; | ||
| 60 | __s32 value; | ||
| 61 | } __attribute__((__packed__)); | ||
| 62 | |||
| 56 | struct uhid_event { | 63 | struct uhid_event { |
| 57 | __u32 type; | 64 | __u32 type; |
| 58 | 65 | ||
| 59 | union { | 66 | union { |
| 60 | struct uhid_create_req create; | 67 | struct uhid_create_req create; |
| 61 | struct uhid_input_req input; | 68 | struct uhid_input_req input; |
| 69 | struct uhid_output_ev_req output_ev; | ||
| 62 | } u; | 70 | } u; |
| 63 | } __attribute__((__packed__)); | 71 | } __attribute__((__packed__)); |
| 64 | 72 | ||
