aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/uhid.c21
-rw-r--r--include/uapi/linux/uhid.h11
2 files changed, 31 insertions, 1 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index 19511481a7d3..f6ec5eaf6b89 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -92,8 +92,27 @@ static int uhid_queue_event(struct uhid_device *uhid, __u32 event)
92static int uhid_hid_start(struct hid_device *hid) 92static int uhid_hid_start(struct hid_device *hid)
93{ 93{
94 struct uhid_device *uhid = hid->driver_data; 94 struct uhid_device *uhid = hid->driver_data;
95 struct uhid_event *ev;
96 unsigned long flags;
97
98 ev = kzalloc(sizeof(*ev), GFP_KERNEL);
99 if (!ev)
100 return -ENOMEM;
101
102 ev->type = UHID_START;
95 103
96 return uhid_queue_event(uhid, UHID_START); 104 if (hid->report_enum[HID_FEATURE_REPORT].numbered)
105 ev->u.start.dev_flags |= UHID_DEV_NUMBERED_FEATURE_REPORTS;
106 if (hid->report_enum[HID_OUTPUT_REPORT].numbered)
107 ev->u.start.dev_flags |= UHID_DEV_NUMBERED_OUTPUT_REPORTS;
108 if (hid->report_enum[HID_INPUT_REPORT].numbered)
109 ev->u.start.dev_flags |= UHID_DEV_NUMBERED_INPUT_REPORTS;
110
111 spin_lock_irqsave(&uhid->qlock, flags);
112 uhid_queue(uhid, ev);
113 spin_unlock_irqrestore(&uhid->qlock, flags);
114
115 return 0;
97} 116}
98 117
99static void uhid_hid_stop(struct hid_device *hid) 118static void uhid_hid_stop(struct hid_device *hid)
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 62aac0e4edf3..aaa86d6bd1dd 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -54,6 +54,16 @@ struct uhid_create2_req {
54 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE]; 54 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
55} __attribute__((__packed__)); 55} __attribute__((__packed__));
56 56
57enum uhid_dev_flag {
58 UHID_DEV_NUMBERED_FEATURE_REPORTS = (1ULL << 0),
59 UHID_DEV_NUMBERED_OUTPUT_REPORTS = (1ULL << 1),
60 UHID_DEV_NUMBERED_INPUT_REPORTS = (1ULL << 2),
61};
62
63struct uhid_start_req {
64 __u64 dev_flags;
65};
66
57#define UHID_DATA_MAX 4096 67#define UHID_DATA_MAX 4096
58 68
59enum uhid_report_type { 69enum uhid_report_type {
@@ -182,6 +192,7 @@ struct uhid_event {
182 struct uhid_input2_req input2; 192 struct uhid_input2_req input2;
183 struct uhid_set_report_req set_report; 193 struct uhid_set_report_req set_report;
184 struct uhid_set_report_reply_req set_report_reply; 194 struct uhid_set_report_reply_req set_report_reply;
195 struct uhid_start_req start;
185 } u; 196 } u;
186} __attribute__((__packed__)); 197} __attribute__((__packed__));
187 198