2 * HID driver for Logitech Unifying receivers
4 * Copyright (c) 2011 Logitech
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <linux/device.h>
26 #include <linux/hid.h>
27 #include <linux/module.h>
28 #include <linux/kfifo.h>
29 #include <linux/delay.h>
30 #include <linux/usb.h> /* For to_usb_interface for kvm extra intf check */
31 #include <asm/unaligned.h>
34 #define DJ_MAX_PAIRED_DEVICES 6
35 #define DJ_MAX_NUMBER_NOTIFS 8
36 #define DJ_RECEIVER_INDEX 0
37 #define DJ_DEVICE_INDEX_MIN 1
38 #define DJ_DEVICE_INDEX_MAX 6
40 #define DJREPORT_SHORT_LENGTH 15
41 #define DJREPORT_LONG_LENGTH 32
43 #define REPORT_ID_DJ_SHORT 0x20
44 #define REPORT_ID_DJ_LONG 0x21
46 #define REPORT_ID_HIDPP_SHORT 0x10
47 #define REPORT_ID_HIDPP_LONG 0x11
49 #define HIDPP_REPORT_SHORT_LENGTH 7
50 #define HIDPP_REPORT_LONG_LENGTH 20
52 #define HIDPP_RECEIVER_INDEX 0xff
54 #define REPORT_TYPE_RFREPORT_FIRST 0x01
55 #define REPORT_TYPE_RFREPORT_LAST 0x1F
57 /* Command Switch to DJ mode */
58 #define REPORT_TYPE_CMD_SWITCH 0x80
59 #define CMD_SWITCH_PARAM_DEVBITFIELD 0x00
60 #define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01
61 #define TIMEOUT_NO_KEEPALIVE 0x00
63 /* Command to Get the list of Paired devices */
64 #define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81
66 /* Device Paired Notification */
67 #define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41
68 #define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01
69 #define SPFUNCTION_DEVICE_LIST_EMPTY 0x02
70 #define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00
71 #define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01
72 #define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02
73 #define DEVICE_PAIRED_RF_REPORT_TYPE 0x03
75 /* Device Un-Paired Notification */
76 #define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40
78 /* Connection Status Notification */
79 #define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42
80 #define CONNECTION_STATUS_PARAM_STATUS 0x00
81 #define STATUS_LINKLOSS 0x01
83 /* Error Notification */
84 #define REPORT_TYPE_NOTIF_ERROR 0x7F
85 #define NOTIF_ERROR_PARAM_ETYPE 0x00
86 #define ETYPE_KEEPALIVE_TIMEOUT 0x01
88 /* supported DJ HID && RF report types */
89 #define REPORT_TYPE_KEYBOARD 0x01
90 #define REPORT_TYPE_MOUSE 0x02
91 #define REPORT_TYPE_CONSUMER_CONTROL 0x03
92 #define REPORT_TYPE_SYSTEM_CONTROL 0x04
93 #define REPORT_TYPE_MEDIA_CENTER 0x08
94 #define REPORT_TYPE_LEDS 0x0E
96 /* RF Report types bitfield */
97 #define STD_KEYBOARD BIT(1)
98 #define STD_MOUSE BIT(2)
99 #define MULTIMEDIA BIT(3)
100 #define POWER_KEYS BIT(4)
101 #define MEDIA_CENTER BIT(8)
102 #define KBD_LEDS BIT(14)
103 /* Fake (bitnr > NUMBER_OF_HID_REPORTS) bit to track HID++ capability */
104 #define HIDPP BIT_ULL(63)
106 /* HID++ Device Connected Notification */
107 #define REPORT_TYPE_NOTIF_DEVICE_CONNECTED 0x41
108 #define HIDPP_PARAM_PROTO_TYPE 0x00
109 #define HIDPP_PARAM_DEVICE_INFO 0x01
110 #define HIDPP_PARAM_EQUAD_LSB 0x02
111 #define HIDPP_PARAM_EQUAD_MSB 0x03
112 #define HIDPP_PARAM_27MHZ_DEVID 0x03
113 #define HIDPP_DEVICE_TYPE_MASK GENMASK(3, 0)
114 #define HIDPP_LINK_STATUS_MASK BIT(6)
115 #define HIDPP_MANUFACTURER_MASK BIT(7)
117 #define HIDPP_DEVICE_TYPE_KEYBOARD 1
118 #define HIDPP_DEVICE_TYPE_MOUSE 2
120 #define HIDPP_SET_REGISTER 0x80
121 #define HIDPP_GET_LONG_REGISTER 0x83
122 #define HIDPP_REG_CONNECTION_STATE 0x02
123 #define HIDPP_REG_PAIRING_INFORMATION 0xB5
124 #define HIDPP_PAIRING_INFORMATION 0x20
125 #define HIDPP_FAKE_DEVICE_ARRIVAL 0x02
130 recvr_type_gaming_hidpp,
132 recvr_type_bluetooth,
139 u8 report_params[DJREPORT_SHORT_LENGTH - 3];
146 u8 params[HIDPP_REPORT_LONG_LENGTH - 3U];
149 struct dj_receiver_dev {
150 struct hid_device *mouse;
151 struct hid_device *keyboard;
152 struct hid_device *hidpp;
153 struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
154 DJ_DEVICE_INDEX_MIN];
155 struct list_head list;
157 struct work_struct work;
158 struct kfifo notif_fifo;
159 unsigned long last_query; /* in jiffies */
161 enum recvr_type type;
162 unsigned int unnumbered_application;
167 struct hid_device *hdev;
168 struct dj_receiver_dev *dj_receiver_dev;
169 u64 reports_supported;
173 #define WORKITEM_TYPE_EMPTY 0
174 #define WORKITEM_TYPE_PAIRED 1
175 #define WORKITEM_TYPE_UNPAIRED 2
176 #define WORKITEM_TYPE_UNKNOWN 255
179 u8 type; /* WORKITEM_TYPE_* */
184 u64 reports_supported;
187 /* Keyboard descriptor (1) */
188 static const char kbd_descriptor[] = {
189 0x05, 0x01, /* USAGE_PAGE (generic Desktop) */
190 0x09, 0x06, /* USAGE (Keyboard) */
191 0xA1, 0x01, /* COLLECTION (Application) */
192 0x85, 0x01, /* REPORT_ID (1) */
193 0x95, 0x08, /* REPORT_COUNT (8) */
194 0x75, 0x01, /* REPORT_SIZE (1) */
195 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
196 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
197 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
198 0x19, 0xE0, /* USAGE_MINIMUM (Left Control) */
199 0x29, 0xE7, /* USAGE_MAXIMUM (Right GUI) */
200 0x81, 0x02, /* INPUT (Data,Var,Abs) */
201 0x95, 0x06, /* REPORT_COUNT (6) */
202 0x75, 0x08, /* REPORT_SIZE (8) */
203 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
204 0x26, 0xFF, 0x00, /* LOGICAL_MAXIMUM (255) */
205 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
206 0x19, 0x00, /* USAGE_MINIMUM (no event) */
207 0x2A, 0xFF, 0x00, /* USAGE_MAXIMUM (reserved) */
208 0x81, 0x00, /* INPUT (Data,Ary,Abs) */
209 0x85, 0x0e, /* REPORT_ID (14) */
210 0x05, 0x08, /* USAGE PAGE (LED page) */
211 0x95, 0x05, /* REPORT COUNT (5) */
212 0x75, 0x01, /* REPORT SIZE (1) */
213 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
214 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
215 0x19, 0x01, /* USAGE MINIMUM (1) */
216 0x29, 0x05, /* USAGE MAXIMUM (5) */
217 0x91, 0x02, /* OUTPUT (Data, Variable, Absolute) */
218 0x95, 0x01, /* REPORT COUNT (1) */
219 0x75, 0x03, /* REPORT SIZE (3) */
220 0x91, 0x01, /* OUTPUT (Constant) */
224 /* Mouse descriptor (2) */
225 static const char mse_descriptor[] = {
226 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
227 0x09, 0x02, /* USAGE (Mouse) */
228 0xA1, 0x01, /* COLLECTION (Application) */
229 0x85, 0x02, /* REPORT_ID = 2 */
230 0x09, 0x01, /* USAGE (pointer) */
231 0xA1, 0x00, /* COLLECTION (physical) */
232 0x05, 0x09, /* USAGE_PAGE (buttons) */
233 0x19, 0x01, /* USAGE_MIN (1) */
234 0x29, 0x10, /* USAGE_MAX (16) */
235 0x15, 0x00, /* LOGICAL_MIN (0) */
236 0x25, 0x01, /* LOGICAL_MAX (1) */
237 0x95, 0x10, /* REPORT_COUNT (16) */
238 0x75, 0x01, /* REPORT_SIZE (1) */
239 0x81, 0x02, /* INPUT (data var abs) */
240 0x05, 0x01, /* USAGE_PAGE (generic desktop) */
241 0x16, 0x01, 0xF8, /* LOGICAL_MIN (-2047) */
242 0x26, 0xFF, 0x07, /* LOGICAL_MAX (2047) */
243 0x75, 0x0C, /* REPORT_SIZE (12) */
244 0x95, 0x02, /* REPORT_COUNT (2) */
245 0x09, 0x30, /* USAGE (X) */
246 0x09, 0x31, /* USAGE (Y) */
247 0x81, 0x06, /* INPUT */
248 0x15, 0x81, /* LOGICAL_MIN (-127) */
249 0x25, 0x7F, /* LOGICAL_MAX (127) */
250 0x75, 0x08, /* REPORT_SIZE (8) */
251 0x95, 0x01, /* REPORT_COUNT (1) */
252 0x09, 0x38, /* USAGE (wheel) */
253 0x81, 0x06, /* INPUT */
254 0x05, 0x0C, /* USAGE_PAGE(consumer) */
255 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */
256 0x95, 0x01, /* REPORT_COUNT (1) */
257 0x81, 0x06, /* INPUT */
258 0xC0, /* END_COLLECTION */
259 0xC0, /* END_COLLECTION */
262 /* Mouse descriptor (2) for 27 MHz receiver, only 8 buttons */
263 static const char mse_27mhz_descriptor[] = {
264 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
265 0x09, 0x02, /* USAGE (Mouse) */
266 0xA1, 0x01, /* COLLECTION (Application) */
267 0x85, 0x02, /* REPORT_ID = 2 */
268 0x09, 0x01, /* USAGE (pointer) */
269 0xA1, 0x00, /* COLLECTION (physical) */
270 0x05, 0x09, /* USAGE_PAGE (buttons) */
271 0x19, 0x01, /* USAGE_MIN (1) */
272 0x29, 0x08, /* USAGE_MAX (8) */
273 0x15, 0x00, /* LOGICAL_MIN (0) */
274 0x25, 0x01, /* LOGICAL_MAX (1) */
275 0x95, 0x08, /* REPORT_COUNT (8) */
276 0x75, 0x01, /* REPORT_SIZE (1) */
277 0x81, 0x02, /* INPUT (data var abs) */
278 0x05, 0x01, /* USAGE_PAGE (generic desktop) */
279 0x16, 0x01, 0xF8, /* LOGICAL_MIN (-2047) */
280 0x26, 0xFF, 0x07, /* LOGICAL_MAX (2047) */
281 0x75, 0x0C, /* REPORT_SIZE (12) */
282 0x95, 0x02, /* REPORT_COUNT (2) */
283 0x09, 0x30, /* USAGE (X) */
284 0x09, 0x31, /* USAGE (Y) */
285 0x81, 0x06, /* INPUT */
286 0x15, 0x81, /* LOGICAL_MIN (-127) */
287 0x25, 0x7F, /* LOGICAL_MAX (127) */
288 0x75, 0x08, /* REPORT_SIZE (8) */
289 0x95, 0x01, /* REPORT_COUNT (1) */
290 0x09, 0x38, /* USAGE (wheel) */
291 0x81, 0x06, /* INPUT */
292 0x05, 0x0C, /* USAGE_PAGE(consumer) */
293 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */
294 0x95, 0x01, /* REPORT_COUNT (1) */
295 0x81, 0x06, /* INPUT */
296 0xC0, /* END_COLLECTION */
297 0xC0, /* END_COLLECTION */
300 /* Mouse descriptor (2) for Bluetooth receiver, low-res hwheel, 12 buttons */
301 static const char mse_bluetooth_descriptor[] = {
302 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
303 0x09, 0x02, /* USAGE (Mouse) */
304 0xA1, 0x01, /* COLLECTION (Application) */
305 0x85, 0x02, /* REPORT_ID = 2 */
306 0x09, 0x01, /* USAGE (pointer) */
307 0xA1, 0x00, /* COLLECTION (physical) */
308 0x05, 0x09, /* USAGE_PAGE (buttons) */
309 0x19, 0x01, /* USAGE_MIN (1) */
310 0x29, 0x08, /* USAGE_MAX (8) */
311 0x15, 0x00, /* LOGICAL_MIN (0) */
312 0x25, 0x01, /* LOGICAL_MAX (1) */
313 0x95, 0x08, /* REPORT_COUNT (8) */
314 0x75, 0x01, /* REPORT_SIZE (1) */
315 0x81, 0x02, /* INPUT (data var abs) */
316 0x05, 0x01, /* USAGE_PAGE (generic desktop) */
317 0x16, 0x01, 0xF8, /* LOGICAL_MIN (-2047) */
318 0x26, 0xFF, 0x07, /* LOGICAL_MAX (2047) */
319 0x75, 0x0C, /* REPORT_SIZE (12) */
320 0x95, 0x02, /* REPORT_COUNT (2) */
321 0x09, 0x30, /* USAGE (X) */
322 0x09, 0x31, /* USAGE (Y) */
323 0x81, 0x06, /* INPUT */
324 0x15, 0x81, /* LOGICAL_MIN (-127) */
325 0x25, 0x7F, /* LOGICAL_MAX (127) */
326 0x75, 0x08, /* REPORT_SIZE (8) */
327 0x95, 0x01, /* REPORT_COUNT (1) */
328 0x09, 0x38, /* USAGE (wheel) */
329 0x81, 0x06, /* INPUT */
330 0x05, 0x0C, /* USAGE_PAGE(consumer) */
331 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */
332 0x15, 0xF9, /* LOGICAL_MIN (-7) */
333 0x25, 0x07, /* LOGICAL_MAX (7) */
334 0x75, 0x04, /* REPORT_SIZE (4) */
335 0x95, 0x01, /* REPORT_COUNT (1) */
336 0x81, 0x06, /* INPUT */
337 0x05, 0x09, /* USAGE_PAGE (buttons) */
338 0x19, 0x09, /* USAGE_MIN (9) */
339 0x29, 0x0C, /* USAGE_MAX (12) */
340 0x15, 0x00, /* LOGICAL_MIN (0) */
341 0x25, 0x01, /* LOGICAL_MAX (1) */
342 0x75, 0x01, /* REPORT_SIZE (1) */
343 0x95, 0x04, /* REPORT_COUNT (4) */
344 0x81, 0x06, /* INPUT */
345 0xC0, /* END_COLLECTION */
346 0xC0, /* END_COLLECTION */
349 /* Gaming Mouse descriptor (2) */
350 static const char mse_high_res_descriptor[] = {
351 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
352 0x09, 0x02, /* USAGE (Mouse) */
353 0xA1, 0x01, /* COLLECTION (Application) */
354 0x85, 0x02, /* REPORT_ID = 2 */
355 0x09, 0x01, /* USAGE (pointer) */
356 0xA1, 0x00, /* COLLECTION (physical) */
357 0x05, 0x09, /* USAGE_PAGE (buttons) */
358 0x19, 0x01, /* USAGE_MIN (1) */
359 0x29, 0x10, /* USAGE_MAX (16) */
360 0x15, 0x00, /* LOGICAL_MIN (0) */
361 0x25, 0x01, /* LOGICAL_MAX (1) */
362 0x95, 0x10, /* REPORT_COUNT (16) */
363 0x75, 0x01, /* REPORT_SIZE (1) */
364 0x81, 0x02, /* INPUT (data var abs) */
365 0x05, 0x01, /* USAGE_PAGE (generic desktop) */
366 0x16, 0x01, 0x80, /* LOGICAL_MIN (-32767) */
367 0x26, 0xFF, 0x7F, /* LOGICAL_MAX (32767) */
368 0x75, 0x10, /* REPORT_SIZE (16) */
369 0x95, 0x02, /* REPORT_COUNT (2) */
370 0x09, 0x30, /* USAGE (X) */
371 0x09, 0x31, /* USAGE (Y) */
372 0x81, 0x06, /* INPUT */
373 0x15, 0x81, /* LOGICAL_MIN (-127) */
374 0x25, 0x7F, /* LOGICAL_MAX (127) */
375 0x75, 0x08, /* REPORT_SIZE (8) */
376 0x95, 0x01, /* REPORT_COUNT (1) */
377 0x09, 0x38, /* USAGE (wheel) */
378 0x81, 0x06, /* INPUT */
379 0x05, 0x0C, /* USAGE_PAGE(consumer) */
380 0x0A, 0x38, 0x02, /* USAGE(AC Pan) */
381 0x95, 0x01, /* REPORT_COUNT (1) */
382 0x81, 0x06, /* INPUT */
383 0xC0, /* END_COLLECTION */
384 0xC0, /* END_COLLECTION */
387 /* Consumer Control descriptor (3) */
388 static const char consumer_descriptor[] = {
389 0x05, 0x0C, /* USAGE_PAGE (Consumer Devices) */
390 0x09, 0x01, /* USAGE (Consumer Control) */
391 0xA1, 0x01, /* COLLECTION (Application) */
392 0x85, 0x03, /* REPORT_ID = 3 */
393 0x75, 0x10, /* REPORT_SIZE (16) */
394 0x95, 0x02, /* REPORT_COUNT (2) */
395 0x15, 0x01, /* LOGICAL_MIN (1) */
396 0x26, 0x8C, 0x02, /* LOGICAL_MAX (652) */
397 0x19, 0x01, /* USAGE_MIN (1) */
398 0x2A, 0x8C, 0x02, /* USAGE_MAX (652) */
399 0x81, 0x00, /* INPUT (Data Ary Abs) */
400 0xC0, /* END_COLLECTION */
403 /* System control descriptor (4) */
404 static const char syscontrol_descriptor[] = {
405 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
406 0x09, 0x80, /* USAGE (System Control) */
407 0xA1, 0x01, /* COLLECTION (Application) */
408 0x85, 0x04, /* REPORT_ID = 4 */
409 0x75, 0x02, /* REPORT_SIZE (2) */
410 0x95, 0x01, /* REPORT_COUNT (1) */
411 0x15, 0x01, /* LOGICAL_MIN (1) */
412 0x25, 0x03, /* LOGICAL_MAX (3) */
413 0x09, 0x82, /* USAGE (System Sleep) */
414 0x09, 0x81, /* USAGE (System Power Down) */
415 0x09, 0x83, /* USAGE (System Wake Up) */
416 0x81, 0x60, /* INPUT (Data Ary Abs NPrf Null) */
417 0x75, 0x06, /* REPORT_SIZE (6) */
418 0x81, 0x03, /* INPUT (Cnst Var Abs) */
419 0xC0, /* END_COLLECTION */
422 /* Media descriptor (8) */
423 static const char media_descriptor[] = {
424 0x06, 0xbc, 0xff, /* Usage Page 0xffbc */
425 0x09, 0x88, /* Usage 0x0088 */
426 0xa1, 0x01, /* BeginCollection */
427 0x85, 0x08, /* Report ID 8 */
428 0x19, 0x01, /* Usage Min 0x0001 */
429 0x29, 0xff, /* Usage Max 0x00ff */
430 0x15, 0x01, /* Logical Min 1 */
431 0x26, 0xff, 0x00, /* Logical Max 255 */
432 0x75, 0x08, /* Report Size 8 */
433 0x95, 0x01, /* Report Count 1 */
434 0x81, 0x00, /* Input */
435 0xc0, /* EndCollection */
438 /* HIDPP descriptor */
439 static const char hidpp_descriptor[] = {
440 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
441 0x09, 0x01, /* Usage (Vendor Usage 1) */
442 0xa1, 0x01, /* Collection (Application) */
443 0x85, 0x10, /* Report ID (16) */
444 0x75, 0x08, /* Report Size (8) */
445 0x95, 0x06, /* Report Count (6) */
446 0x15, 0x00, /* Logical Minimum (0) */
447 0x26, 0xff, 0x00, /* Logical Maximum (255) */
448 0x09, 0x01, /* Usage (Vendor Usage 1) */
449 0x81, 0x00, /* Input (Data,Arr,Abs) */
450 0x09, 0x01, /* Usage (Vendor Usage 1) */
451 0x91, 0x00, /* Output (Data,Arr,Abs) */
452 0xc0, /* End Collection */
453 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
454 0x09, 0x02, /* Usage (Vendor Usage 2) */
455 0xa1, 0x01, /* Collection (Application) */
456 0x85, 0x11, /* Report ID (17) */
457 0x75, 0x08, /* Report Size (8) */
458 0x95, 0x13, /* Report Count (19) */
459 0x15, 0x00, /* Logical Minimum (0) */
460 0x26, 0xff, 0x00, /* Logical Maximum (255) */
461 0x09, 0x02, /* Usage (Vendor Usage 2) */
462 0x81, 0x00, /* Input (Data,Arr,Abs) */
463 0x09, 0x02, /* Usage (Vendor Usage 2) */
464 0x91, 0x00, /* Output (Data,Arr,Abs) */
465 0xc0, /* End Collection */
466 0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
467 0x09, 0x04, /* Usage (Vendor Usage 0x04) */
468 0xa1, 0x01, /* Collection (Application) */
469 0x85, 0x20, /* Report ID (32) */
470 0x75, 0x08, /* Report Size (8) */
471 0x95, 0x0e, /* Report Count (14) */
472 0x15, 0x00, /* Logical Minimum (0) */
473 0x26, 0xff, 0x00, /* Logical Maximum (255) */
474 0x09, 0x41, /* Usage (Vendor Usage 0x41) */
475 0x81, 0x00, /* Input (Data,Arr,Abs) */
476 0x09, 0x41, /* Usage (Vendor Usage 0x41) */
477 0x91, 0x00, /* Output (Data,Arr,Abs) */
478 0x85, 0x21, /* Report ID (33) */
479 0x95, 0x1f, /* Report Count (31) */
480 0x15, 0x00, /* Logical Minimum (0) */
481 0x26, 0xff, 0x00, /* Logical Maximum (255) */
482 0x09, 0x42, /* Usage (Vendor Usage 0x42) */
483 0x81, 0x00, /* Input (Data,Arr,Abs) */
484 0x09, 0x42, /* Usage (Vendor Usage 0x42) */
485 0x91, 0x00, /* Output (Data,Arr,Abs) */
486 0xc0, /* End Collection */
489 /* Maximum size of all defined hid reports in bytes (including report id) */
490 #define MAX_REPORT_SIZE 8
492 /* Make sure all descriptors are present here */
493 #define MAX_RDESC_SIZE \
494 (sizeof(kbd_descriptor) + \
495 sizeof(mse_bluetooth_descriptor) + \
496 sizeof(consumer_descriptor) + \
497 sizeof(syscontrol_descriptor) + \
498 sizeof(media_descriptor) + \
499 sizeof(hidpp_descriptor))
501 /* Number of possible hid report types that can be created by this driver.
503 * Right now, RF report types have the same report types (or report id's)
504 * than the hid report created from those RF reports. In the future
505 * this doesnt have to be true.
507 * For instance, RF report type 0x01 which has a size of 8 bytes, corresponds
508 * to hid report id 0x01, this is standard keyboard. Same thing applies to mice
509 * reports and consumer control, etc. If a new RF report is created, it doesn't
510 * has to have the same report id as its corresponding hid report, so an
511 * translation may have to take place for future report types.
513 #define NUMBER_OF_HID_REPORTS 32
514 static const u8 hid_reportid_size_map[NUMBER_OF_HID_REPORTS] = {
515 [1] = 8, /* Standard keyboard */
516 [2] = 8, /* Standard mouse */
517 [3] = 5, /* Consumer control */
518 [4] = 2, /* System control */
519 [8] = 2, /* Media Center */
523 #define LOGITECH_DJ_INTERFACE_NUMBER 0x02
525 static struct hid_ll_driver logi_dj_ll_driver;
527 static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev);
528 static void delayedwork_callback(struct work_struct *work);
530 static LIST_HEAD(dj_hdev_list);
531 static DEFINE_MUTEX(dj_hdev_list_lock);
534 * dj/HID++ receivers are really a single logical entity, but for BIOS/Windows
535 * compatibility they have multiple USB interfaces. On HID++ receivers we need
536 * to listen for input reports on both interfaces. The functions below are used
537 * to create a single struct dj_receiver_dev for all interfaces belonging to
538 * a single USB-device / receiver.
540 static struct dj_receiver_dev *dj_find_receiver_dev(struct hid_device *hdev,
541 enum recvr_type type)
543 struct dj_receiver_dev *djrcv_dev;
547 * The bluetooth receiver contains a built-in hub and has separate
548 * USB-devices for the keyboard and mouse interfaces.
550 sep = (type == recvr_type_bluetooth) ? '.' : '/';
552 /* Try to find an already-probed interface from the same device */
553 list_for_each_entry(djrcv_dev, &dj_hdev_list, list) {
554 if (djrcv_dev->mouse &&
555 hid_compare_device_paths(hdev, djrcv_dev->mouse, sep)) {
556 kref_get(&djrcv_dev->kref);
559 if (djrcv_dev->keyboard &&
560 hid_compare_device_paths(hdev, djrcv_dev->keyboard, sep)) {
561 kref_get(&djrcv_dev->kref);
564 if (djrcv_dev->hidpp &&
565 hid_compare_device_paths(hdev, djrcv_dev->hidpp, sep)) {
566 kref_get(&djrcv_dev->kref);
574 static void dj_release_receiver_dev(struct kref *kref)
576 struct dj_receiver_dev *djrcv_dev = container_of(kref, struct dj_receiver_dev, kref);
578 list_del(&djrcv_dev->list);
579 kfifo_free(&djrcv_dev->notif_fifo);
583 static void dj_put_receiver_dev(struct hid_device *hdev)
585 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
587 mutex_lock(&dj_hdev_list_lock);
589 if (djrcv_dev->mouse == hdev)
590 djrcv_dev->mouse = NULL;
591 if (djrcv_dev->keyboard == hdev)
592 djrcv_dev->keyboard = NULL;
593 if (djrcv_dev->hidpp == hdev)
594 djrcv_dev->hidpp = NULL;
596 kref_put(&djrcv_dev->kref, dj_release_receiver_dev);
598 mutex_unlock(&dj_hdev_list_lock);
601 static struct dj_receiver_dev *dj_get_receiver_dev(struct hid_device *hdev,
602 enum recvr_type type,
603 unsigned int application,
606 struct dj_receiver_dev *djrcv_dev;
608 mutex_lock(&dj_hdev_list_lock);
610 djrcv_dev = dj_find_receiver_dev(hdev, type);
612 djrcv_dev = kzalloc(sizeof(*djrcv_dev), GFP_KERNEL);
616 INIT_WORK(&djrcv_dev->work, delayedwork_callback);
617 spin_lock_init(&djrcv_dev->lock);
618 if (kfifo_alloc(&djrcv_dev->notif_fifo,
619 DJ_MAX_NUMBER_NOTIFS * sizeof(struct dj_workitem),
625 kref_init(&djrcv_dev->kref);
626 list_add_tail(&djrcv_dev->list, &dj_hdev_list);
627 djrcv_dev->last_query = jiffies;
628 djrcv_dev->type = type;
631 if (application == HID_GD_KEYBOARD)
632 djrcv_dev->keyboard = hdev;
633 if (application == HID_GD_MOUSE)
634 djrcv_dev->mouse = hdev;
636 djrcv_dev->hidpp = hdev;
638 hid_set_drvdata(hdev, djrcv_dev);
640 mutex_unlock(&dj_hdev_list_lock);
644 static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev,
645 struct dj_workitem *workitem)
647 /* Called in delayed work context */
648 struct dj_device *dj_dev;
651 spin_lock_irqsave(&djrcv_dev->lock, flags);
652 dj_dev = djrcv_dev->paired_dj_devices[workitem->device_index];
653 djrcv_dev->paired_dj_devices[workitem->device_index] = NULL;
654 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
656 if (dj_dev != NULL) {
657 hid_destroy_device(dj_dev->hdev);
660 hid_err(djrcv_dev->hidpp, "%s: can't destroy a NULL device\n",
665 static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
666 struct dj_workitem *workitem)
668 /* Called in delayed work context */
669 struct hid_device *djrcv_hdev = djrcv_dev->hidpp;
670 struct hid_device *dj_hiddev;
671 struct dj_device *dj_dev;
672 u8 device_index = workitem->device_index;
675 /* Device index goes from 1 to 6, we need 3 bytes to store the
676 * semicolon, the index, and a null terminator
678 unsigned char tmpstr[3];
680 /* We are the only one ever adding a device, no need to lock */
681 if (djrcv_dev->paired_dj_devices[device_index]) {
682 /* The device is already known. No need to reallocate it. */
683 dbg_hid("%s: device is already known\n", __func__);
687 dj_hiddev = hid_allocate_device();
688 if (IS_ERR(dj_hiddev)) {
689 hid_err(djrcv_hdev, "%s: hid_allocate_dev failed\n", __func__);
693 dj_hiddev->ll_driver = &logi_dj_ll_driver;
695 dj_hiddev->dev.parent = &djrcv_hdev->dev;
696 dj_hiddev->bus = BUS_USB;
697 dj_hiddev->vendor = djrcv_hdev->vendor;
698 dj_hiddev->product = (workitem->quad_id_msb << 8) |
699 workitem->quad_id_lsb;
700 if (workitem->device_type) {
701 const char *type_str = "Device";
703 switch (workitem->device_type) {
704 case 0x01: type_str = "Keyboard"; break;
705 case 0x02: type_str = "Mouse"; break;
706 case 0x03: type_str = "Numpad"; break;
707 case 0x04: type_str = "Presenter"; break;
708 case 0x07: type_str = "Remote Control"; break;
709 case 0x08: type_str = "Trackball"; break;
710 case 0x09: type_str = "Touchpad"; break;
712 snprintf(dj_hiddev->name, sizeof(dj_hiddev->name),
713 "Logitech Wireless %s PID:%04x",
714 type_str, dj_hiddev->product);
716 snprintf(dj_hiddev->name, sizeof(dj_hiddev->name),
717 "Logitech Unifying Device. Wireless PID:%04x",
721 if (djrcv_dev->type == recvr_type_27mhz)
722 dj_hiddev->group = HID_GROUP_LOGITECH_27MHZ_DEVICE;
724 dj_hiddev->group = HID_GROUP_LOGITECH_DJ_DEVICE;
726 memcpy(dj_hiddev->phys, djrcv_hdev->phys, sizeof(djrcv_hdev->phys));
727 snprintf(tmpstr, sizeof(tmpstr), ":%d", device_index);
728 strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys));
730 dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL);
733 hid_err(djrcv_hdev, "%s: failed allocating dj_dev\n", __func__);
734 goto dj_device_allocate_fail;
737 dj_dev->reports_supported = workitem->reports_supported;
738 dj_dev->hdev = dj_hiddev;
739 dj_dev->dj_receiver_dev = djrcv_dev;
740 dj_dev->device_index = device_index;
741 dj_hiddev->driver_data = dj_dev;
743 spin_lock_irqsave(&djrcv_dev->lock, flags);
744 djrcv_dev->paired_dj_devices[device_index] = dj_dev;
745 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
747 if (hid_add_device(dj_hiddev)) {
748 hid_err(djrcv_hdev, "%s: failed adding dj_device\n", __func__);
749 goto hid_add_device_fail;
755 spin_lock_irqsave(&djrcv_dev->lock, flags);
756 djrcv_dev->paired_dj_devices[device_index] = NULL;
757 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
759 dj_device_allocate_fail:
760 hid_destroy_device(dj_hiddev);
763 static void delayedwork_callback(struct work_struct *work)
765 struct dj_receiver_dev *djrcv_dev =
766 container_of(work, struct dj_receiver_dev, work);
768 struct dj_workitem workitem;
773 dbg_hid("%s\n", __func__);
775 spin_lock_irqsave(&djrcv_dev->lock, flags);
778 * Since we attach to multiple interfaces, we may get scheduled before
779 * we are bound to the HID++ interface, catch this.
781 if (!djrcv_dev->ready) {
782 pr_warn("%s: delayedwork queued before hidpp interface was enumerated\n",
784 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
788 count = kfifo_out(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem));
790 if (count != sizeof(workitem)) {
791 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
795 if (!kfifo_is_empty(&djrcv_dev->notif_fifo))
796 schedule_work(&djrcv_dev->work);
798 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
800 switch (workitem.type) {
801 case WORKITEM_TYPE_PAIRED:
802 logi_dj_recv_add_djhid_device(djrcv_dev, &workitem);
804 case WORKITEM_TYPE_UNPAIRED:
805 logi_dj_recv_destroy_djhid_device(djrcv_dev, &workitem);
807 case WORKITEM_TYPE_UNKNOWN:
808 retval = logi_dj_recv_query_paired_devices(djrcv_dev);
810 hid_err(djrcv_dev->hidpp, "%s: logi_dj_recv_query_paired_devices error: %d\n",
814 case WORKITEM_TYPE_EMPTY:
815 dbg_hid("%s: device list is empty\n", __func__);
821 * Sometimes we receive reports for which we do not have a paired dj_device
822 * associated with the device_index or report-type to forward the report to.
823 * This means that the original "device paired" notification corresponding
824 * to the dj_device never arrived to this driver. Possible reasons for this are:
825 * 1) hid-core discards all packets coming from a device during probe().
826 * 2) if the receiver is plugged into a KVM switch then the pairing reports
827 * are only forwarded to it if the focus is on this PC.
828 * This function deals with this by re-asking the receiver for the list of
829 * connected devices in the delayed work callback.
830 * This function MUST be called with djrcv->lock held.
832 static void logi_dj_recv_queue_unknown_work(struct dj_receiver_dev *djrcv_dev)
834 struct dj_workitem workitem = { .type = WORKITEM_TYPE_UNKNOWN };
836 /* Rate limit queries done because of unhandeled reports to 2/sec */
837 if (time_before(jiffies, djrcv_dev->last_query + HZ / 2))
840 kfifo_in(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem));
841 schedule_work(&djrcv_dev->work);
844 static void logi_dj_recv_queue_notification(struct dj_receiver_dev *djrcv_dev,
845 struct dj_report *dj_report)
847 /* We are called from atomic context (tasklet && djrcv->lock held) */
848 struct dj_workitem workitem = {
849 .device_index = dj_report->device_index,
852 switch (dj_report->report_type) {
853 case REPORT_TYPE_NOTIF_DEVICE_PAIRED:
854 workitem.type = WORKITEM_TYPE_PAIRED;
855 if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] &
856 SPFUNCTION_DEVICE_LIST_EMPTY) {
857 workitem.type = WORKITEM_TYPE_EMPTY;
861 case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
862 workitem.quad_id_msb =
863 dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB];
864 workitem.quad_id_lsb =
865 dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB];
866 workitem.reports_supported = get_unaligned_le32(
867 dj_report->report_params +
868 DEVICE_PAIRED_RF_REPORT_TYPE);
869 workitem.reports_supported |= HIDPP;
870 if (dj_report->report_type == REPORT_TYPE_NOTIF_DEVICE_UNPAIRED)
871 workitem.type = WORKITEM_TYPE_UNPAIRED;
874 logi_dj_recv_queue_unknown_work(djrcv_dev);
878 kfifo_in(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem));
879 schedule_work(&djrcv_dev->work);
882 static void logi_hidpp_dev_conn_notif_equad(struct hidpp_event *hidpp_report,
883 struct dj_workitem *workitem)
885 workitem->type = WORKITEM_TYPE_PAIRED;
886 workitem->device_type = hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] &
887 HIDPP_DEVICE_TYPE_MASK;
888 workitem->quad_id_msb = hidpp_report->params[HIDPP_PARAM_EQUAD_MSB];
889 workitem->quad_id_lsb = hidpp_report->params[HIDPP_PARAM_EQUAD_LSB];
890 switch (workitem->device_type) {
891 case REPORT_TYPE_KEYBOARD:
892 workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA |
893 POWER_KEYS | MEDIA_CENTER |
896 case REPORT_TYPE_MOUSE:
897 workitem->reports_supported |= STD_MOUSE | HIDPP;
902 static void logi_hidpp_dev_conn_notif_27mhz(struct hid_device *hdev,
903 struct hidpp_event *hidpp_report,
904 struct dj_workitem *workitem)
906 workitem->type = WORKITEM_TYPE_PAIRED;
907 workitem->quad_id_lsb = hidpp_report->params[HIDPP_PARAM_27MHZ_DEVID];
908 switch (hidpp_report->device_index) {
909 case 1: /* Index 1 is always a mouse */
910 case 2: /* Index 2 is always a mouse */
911 workitem->device_type = HIDPP_DEVICE_TYPE_MOUSE;
912 workitem->reports_supported |= STD_MOUSE | HIDPP;
914 case 3: /* Index 3 is always the keyboard */
915 case 4: /* Index 4 is used for an optional separate numpad */
916 workitem->device_type = HIDPP_DEVICE_TYPE_KEYBOARD;
917 workitem->reports_supported |= STD_KEYBOARD | MULTIMEDIA |
921 hid_warn(hdev, "%s: unexpected device-index %d", __func__,
922 hidpp_report->device_index);
926 static void logi_hidpp_recv_queue_notif(struct hid_device *hdev,
927 struct hidpp_event *hidpp_report)
929 /* We are called from atomic context (tasklet && djrcv->lock held) */
930 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
931 const char *device_type = "UNKNOWN";
932 struct dj_workitem workitem = {
933 .type = WORKITEM_TYPE_EMPTY,
934 .device_index = hidpp_report->device_index,
937 switch (hidpp_report->params[HIDPP_PARAM_PROTO_TYPE]) {
939 device_type = "Bluetooth";
940 /* Bluetooth connect packet contents is the same as (e)QUAD */
941 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
942 if (!(hidpp_report->params[HIDPP_PARAM_DEVICE_INFO] &
943 HIDPP_MANUFACTURER_MASK)) {
944 hid_info(hdev, "Non Logitech device connected on slot %d\n",
945 hidpp_report->device_index);
946 workitem.reports_supported &= ~HIDPP;
950 device_type = "27 Mhz";
951 logi_hidpp_dev_conn_notif_27mhz(hdev, hidpp_report, &workitem);
954 device_type = "QUAD or eQUAD";
955 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
958 device_type = "eQUAD step 4 DJ";
959 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
962 device_type = "DFU Lite";
965 device_type = "eQUAD step 4 Lite";
966 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
969 device_type = "eQUAD step 4 Gaming";
972 device_type = "eQUAD step 4 for gamepads";
975 device_type = "eQUAD nano Lite";
976 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
979 device_type = "eQUAD Lightspeed";
980 logi_hidpp_dev_conn_notif_equad(hidpp_report, &workitem);
981 workitem.reports_supported |= STD_KEYBOARD;
985 if (workitem.type == WORKITEM_TYPE_EMPTY) {
987 "unusable device of type %s (0x%02x) connected on slot %d",
989 hidpp_report->params[HIDPP_PARAM_PROTO_TYPE],
990 hidpp_report->device_index);
994 hid_info(hdev, "device of type %s (0x%02x) connected on slot %d",
995 device_type, hidpp_report->params[HIDPP_PARAM_PROTO_TYPE],
996 hidpp_report->device_index);
998 kfifo_in(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem));
999 schedule_work(&djrcv_dev->work);
1002 static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev,
1003 struct dj_report *dj_report)
1005 /* We are called from atomic context (tasklet && djrcv->lock held) */
1007 u8 reportbuffer[MAX_REPORT_SIZE];
1008 struct dj_device *djdev;
1010 djdev = djrcv_dev->paired_dj_devices[dj_report->device_index];
1012 memset(reportbuffer, 0, sizeof(reportbuffer));
1014 for (i = 0; i < NUMBER_OF_HID_REPORTS; i++) {
1015 if (djdev->reports_supported & (1 << i)) {
1016 reportbuffer[0] = i;
1017 if (hid_input_report(djdev->hdev,
1020 hid_reportid_size_map[i], 1)) {
1021 dbg_hid("hid_input_report error sending null "
1028 static void logi_dj_recv_forward_dj(struct dj_receiver_dev *djrcv_dev,
1029 struct dj_report *dj_report)
1031 /* We are called from atomic context (tasklet && djrcv->lock held) */
1032 struct dj_device *dj_device;
1034 dj_device = djrcv_dev->paired_dj_devices[dj_report->device_index];
1036 if ((dj_report->report_type > ARRAY_SIZE(hid_reportid_size_map) - 1) ||
1037 (hid_reportid_size_map[dj_report->report_type] == 0)) {
1038 dbg_hid("invalid report type:%x\n", dj_report->report_type);
1042 if (hid_input_report(dj_device->hdev,
1043 HID_INPUT_REPORT, &dj_report->report_type,
1044 hid_reportid_size_map[dj_report->report_type], 1)) {
1045 dbg_hid("hid_input_report error\n");
1049 static void logi_dj_recv_forward_report(struct dj_device *dj_dev, u8 *data,
1052 /* We are called from atomic context (tasklet && djrcv->lock held) */
1053 if (hid_input_report(dj_dev->hdev, HID_INPUT_REPORT, data, size, 1))
1054 dbg_hid("hid_input_report error\n");
1057 static void logi_dj_recv_forward_input_report(struct hid_device *hdev,
1060 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1061 struct dj_device *dj_dev;
1062 unsigned long flags;
1063 u8 report = data[0];
1066 if (report > REPORT_TYPE_RFREPORT_LAST) {
1067 hid_err(hdev, "Unexpected input report number %d\n", report);
1071 spin_lock_irqsave(&djrcv_dev->lock, flags);
1072 for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) {
1073 dj_dev = djrcv_dev->paired_dj_devices[i];
1074 if (dj_dev && (dj_dev->reports_supported & BIT(report))) {
1075 logi_dj_recv_forward_report(dj_dev, data, size);
1076 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1081 logi_dj_recv_queue_unknown_work(djrcv_dev);
1082 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1084 dbg_hid("No dj-devs handling input report number %d\n", report);
1087 static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
1088 struct dj_report *dj_report)
1090 struct hid_device *hdev = djrcv_dev->hidpp;
1091 struct hid_report *report;
1092 struct hid_report_enum *output_report_enum;
1093 u8 *data = (u8 *)(&dj_report->device_index);
1096 output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT];
1097 report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT];
1100 hid_err(hdev, "%s: unable to find dj report\n", __func__);
1104 for (i = 0; i < DJREPORT_SHORT_LENGTH - 1; i++)
1105 report->field[0]->value[i] = data[i];
1107 hid_hw_request(hdev, report, HID_REQ_SET_REPORT);
1112 static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev)
1114 const u8 template[] = {REPORT_ID_HIDPP_SHORT,
1115 HIDPP_RECEIVER_INDEX,
1117 HIDPP_REG_CONNECTION_STATE,
1118 HIDPP_FAKE_DEVICE_ARRIVAL,
1123 hidpp_report = kmemdup(template, sizeof(template), GFP_KERNEL);
1127 retval = hid_hw_raw_request(djrcv_dev->hidpp,
1128 REPORT_ID_HIDPP_SHORT,
1129 hidpp_report, sizeof(template),
1131 HID_REQ_SET_REPORT);
1133 kfree(hidpp_report);
1137 static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
1139 struct dj_report *dj_report;
1142 djrcv_dev->last_query = jiffies;
1144 if (djrcv_dev->type != recvr_type_dj)
1145 return logi_dj_recv_query_hidpp_devices(djrcv_dev);
1147 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
1150 dj_report->report_id = REPORT_ID_DJ_SHORT;
1151 dj_report->device_index = 0xFF;
1152 dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES;
1153 retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
1159 static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
1162 struct hid_device *hdev = djrcv_dev->hidpp;
1163 struct dj_report *dj_report;
1167 dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
1171 if (djrcv_dev->type == recvr_type_dj) {
1172 dj_report->report_id = REPORT_ID_DJ_SHORT;
1173 dj_report->device_index = 0xFF;
1174 dj_report->report_type = REPORT_TYPE_CMD_SWITCH;
1175 dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
1176 dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] =
1179 retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
1182 * Ugly sleep to work around a USB 3.0 bug when the receiver is
1183 * still processing the "switch-to-dj" command while we send an
1185 * 50 msec should gives enough time to the receiver to be ready.
1191 * Magical bits to set up hidpp notifications when the dj devices
1192 * are connected/disconnected.
1194 * We can reuse dj_report because HIDPP_REPORT_SHORT_LENGTH is smaller
1195 * than DJREPORT_SHORT_LENGTH.
1197 buf = (u8 *)dj_report;
1199 memset(buf, 0, HIDPP_REPORT_SHORT_LENGTH);
1201 buf[0] = REPORT_ID_HIDPP_SHORT;
1209 hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf,
1210 HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT,
1211 HID_REQ_SET_REPORT);
1218 static int logi_dj_ll_open(struct hid_device *hid)
1220 dbg_hid("%s: %s\n", __func__, hid->phys);
1225 static void logi_dj_ll_close(struct hid_device *hid)
1227 dbg_hid("%s: %s\n", __func__, hid->phys);
1231 * Register 0xB5 is "pairing information". It is solely intended for the
1232 * receiver, so do not overwrite the device index.
1234 static u8 unifying_pairing_query[] = { REPORT_ID_HIDPP_SHORT,
1235 HIDPP_RECEIVER_INDEX,
1236 HIDPP_GET_LONG_REGISTER,
1237 HIDPP_REG_PAIRING_INFORMATION };
1238 static u8 unifying_pairing_answer[] = { REPORT_ID_HIDPP_LONG,
1239 HIDPP_RECEIVER_INDEX,
1240 HIDPP_GET_LONG_REGISTER,
1241 HIDPP_REG_PAIRING_INFORMATION };
1243 static int logi_dj_ll_raw_request(struct hid_device *hid,
1244 unsigned char reportnum, __u8 *buf,
1245 size_t count, unsigned char report_type,
1248 struct dj_device *djdev = hid->driver_data;
1249 struct dj_receiver_dev *djrcv_dev = djdev->dj_receiver_dev;
1253 if ((buf[0] == REPORT_ID_HIDPP_SHORT) ||
1254 (buf[0] == REPORT_ID_HIDPP_LONG)) {
1258 /* special case where we should not overwrite
1259 * the device_index */
1260 if (count == 7 && !memcmp(buf, unifying_pairing_query,
1261 sizeof(unifying_pairing_query)))
1262 buf[4] = (buf[4] & 0xf0) | (djdev->device_index - 1);
1264 buf[1] = djdev->device_index;
1265 return hid_hw_raw_request(djrcv_dev->hidpp, reportnum, buf,
1266 count, report_type, reqtype);
1269 if (buf[0] != REPORT_TYPE_LEDS)
1272 if (djrcv_dev->type != recvr_type_dj && count >= 2) {
1273 if (!djrcv_dev->keyboard) {
1274 hid_warn(hid, "Received REPORT_TYPE_LEDS request before the keyboard interface was enumerated\n");
1277 /* usbhid overrides the report ID and ignores the first byte */
1278 return hid_hw_raw_request(djrcv_dev->keyboard, 0, buf, count,
1279 report_type, reqtype);
1282 out_buf = kzalloc(DJREPORT_SHORT_LENGTH, GFP_ATOMIC);
1286 if (count > DJREPORT_SHORT_LENGTH - 2)
1287 count = DJREPORT_SHORT_LENGTH - 2;
1289 out_buf[0] = REPORT_ID_DJ_SHORT;
1290 out_buf[1] = djdev->device_index;
1291 memcpy(out_buf + 2, buf, count);
1293 ret = hid_hw_raw_request(djrcv_dev->hidpp, out_buf[0], out_buf,
1294 DJREPORT_SHORT_LENGTH, report_type, reqtype);
1300 static void rdcat(char *rdesc, unsigned int *rsize, const char *data, unsigned int size)
1302 memcpy(rdesc + *rsize, data, size);
1306 static int logi_dj_ll_parse(struct hid_device *hid)
1308 struct dj_device *djdev = hid->driver_data;
1309 unsigned int rsize = 0;
1313 dbg_hid("%s\n", __func__);
1315 djdev->hdev->version = 0x0111;
1316 djdev->hdev->country = 0x00;
1318 rdesc = kmalloc(MAX_RDESC_SIZE, GFP_KERNEL);
1322 if (djdev->reports_supported & STD_KEYBOARD) {
1323 dbg_hid("%s: sending a kbd descriptor, reports_supported: %llx\n",
1324 __func__, djdev->reports_supported);
1325 rdcat(rdesc, &rsize, kbd_descriptor, sizeof(kbd_descriptor));
1328 if (djdev->reports_supported & STD_MOUSE) {
1329 dbg_hid("%s: sending a mouse descriptor, reports_supported: %llx\n",
1330 __func__, djdev->reports_supported);
1331 if (djdev->dj_receiver_dev->type == recvr_type_gaming_hidpp)
1332 rdcat(rdesc, &rsize, mse_high_res_descriptor,
1333 sizeof(mse_high_res_descriptor));
1334 else if (djdev->dj_receiver_dev->type == recvr_type_27mhz)
1335 rdcat(rdesc, &rsize, mse_27mhz_descriptor,
1336 sizeof(mse_27mhz_descriptor));
1337 else if (djdev->dj_receiver_dev->type == recvr_type_bluetooth)
1338 rdcat(rdesc, &rsize, mse_bluetooth_descriptor,
1339 sizeof(mse_bluetooth_descriptor));
1341 rdcat(rdesc, &rsize, mse_descriptor,
1342 sizeof(mse_descriptor));
1345 if (djdev->reports_supported & MULTIMEDIA) {
1346 dbg_hid("%s: sending a multimedia report descriptor: %llx\n",
1347 __func__, djdev->reports_supported);
1348 rdcat(rdesc, &rsize, consumer_descriptor, sizeof(consumer_descriptor));
1351 if (djdev->reports_supported & POWER_KEYS) {
1352 dbg_hid("%s: sending a power keys report descriptor: %llx\n",
1353 __func__, djdev->reports_supported);
1354 rdcat(rdesc, &rsize, syscontrol_descriptor, sizeof(syscontrol_descriptor));
1357 if (djdev->reports_supported & MEDIA_CENTER) {
1358 dbg_hid("%s: sending a media center report descriptor: %llx\n",
1359 __func__, djdev->reports_supported);
1360 rdcat(rdesc, &rsize, media_descriptor, sizeof(media_descriptor));
1363 if (djdev->reports_supported & KBD_LEDS) {
1364 dbg_hid("%s: need to send kbd leds report descriptor: %llx\n",
1365 __func__, djdev->reports_supported);
1368 if (djdev->reports_supported & HIDPP) {
1369 rdcat(rdesc, &rsize, hidpp_descriptor,
1370 sizeof(hidpp_descriptor));
1373 retval = hid_parse_report(hid, rdesc, rsize);
1379 static int logi_dj_ll_start(struct hid_device *hid)
1381 dbg_hid("%s\n", __func__);
1385 static void logi_dj_ll_stop(struct hid_device *hid)
1387 dbg_hid("%s\n", __func__);
1391 static struct hid_ll_driver logi_dj_ll_driver = {
1392 .parse = logi_dj_ll_parse,
1393 .start = logi_dj_ll_start,
1394 .stop = logi_dj_ll_stop,
1395 .open = logi_dj_ll_open,
1396 .close = logi_dj_ll_close,
1397 .raw_request = logi_dj_ll_raw_request,
1400 static int logi_dj_dj_event(struct hid_device *hdev,
1401 struct hid_report *report, u8 *data,
1404 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1405 struct dj_report *dj_report = (struct dj_report *) data;
1406 unsigned long flags;
1409 * Here we receive all data coming from iface 2, there are 3 cases:
1411 * 1) Data is intended for this driver i. e. data contains arrival,
1412 * departure, etc notifications, in which case we queue them for delayed
1413 * processing by the work queue. We return 1 to hid-core as no further
1414 * processing is required from it.
1416 * 2) Data informs a connection change, if the change means rf link
1417 * loss, then we must send a null report to the upper layer to discard
1418 * potentially pressed keys that may be repeated forever by the input
1419 * layer. Return 1 to hid-core as no further processing is required.
1421 * 3) Data is an actual input event from a paired DJ device in which
1422 * case we forward it to the correct hid device (via hid_input_report()
1423 * ) and return 1 so hid-core does not anything else with it.
1426 if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
1427 (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
1429 * Device index is wrong, bail out.
1430 * This driver can ignore safely the receiver notifications,
1431 * so ignore those reports too.
1433 if (dj_report->device_index != DJ_RECEIVER_INDEX)
1434 hid_err(hdev, "%s: invalid device index:%d\n",
1435 __func__, dj_report->device_index);
1439 spin_lock_irqsave(&djrcv_dev->lock, flags);
1441 if (!djrcv_dev->paired_dj_devices[dj_report->device_index]) {
1442 /* received an event for an unknown device, bail out */
1443 logi_dj_recv_queue_notification(djrcv_dev, dj_report);
1447 switch (dj_report->report_type) {
1448 case REPORT_TYPE_NOTIF_DEVICE_PAIRED:
1449 /* pairing notifications are handled above the switch */
1451 case REPORT_TYPE_NOTIF_DEVICE_UNPAIRED:
1452 logi_dj_recv_queue_notification(djrcv_dev, dj_report);
1454 case REPORT_TYPE_NOTIF_CONNECTION_STATUS:
1455 if (dj_report->report_params[CONNECTION_STATUS_PARAM_STATUS] ==
1457 logi_dj_recv_forward_null_report(djrcv_dev, dj_report);
1461 logi_dj_recv_forward_dj(djrcv_dev, dj_report);
1465 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1470 static int logi_dj_hidpp_event(struct hid_device *hdev,
1471 struct hid_report *report, u8 *data,
1474 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1475 struct hidpp_event *hidpp_report = (struct hidpp_event *) data;
1476 struct dj_device *dj_dev;
1477 unsigned long flags;
1478 u8 device_index = hidpp_report->device_index;
1480 if (device_index == HIDPP_RECEIVER_INDEX) {
1481 /* special case were the device wants to know its unifying
1483 if (size == HIDPP_REPORT_LONG_LENGTH &&
1484 !memcmp(data, unifying_pairing_answer,
1485 sizeof(unifying_pairing_answer)))
1486 device_index = (data[4] & 0x0F) + 1;
1492 * Data is from the HID++ collection, in this case, we forward the
1493 * data to the corresponding child dj device and return 0 to hid-core
1494 * so he data also goes to the hidraw device of the receiver. This
1495 * allows a user space application to implement the full HID++ routing
1499 if ((device_index < DJ_DEVICE_INDEX_MIN) ||
1500 (device_index > DJ_DEVICE_INDEX_MAX)) {
1502 * Device index is wrong, bail out.
1503 * This driver can ignore safely the receiver notifications,
1504 * so ignore those reports too.
1506 hid_err(hdev, "%s: invalid device index:%d\n", __func__,
1507 hidpp_report->device_index);
1511 spin_lock_irqsave(&djrcv_dev->lock, flags);
1513 dj_dev = djrcv_dev->paired_dj_devices[device_index];
1516 * With 27 MHz receivers, we do not get an explicit unpair event,
1517 * remove the old device if the user has paired a *different* device.
1519 if (djrcv_dev->type == recvr_type_27mhz && dj_dev &&
1520 hidpp_report->sub_id == REPORT_TYPE_NOTIF_DEVICE_CONNECTED &&
1521 hidpp_report->params[HIDPP_PARAM_PROTO_TYPE] == 0x02 &&
1522 hidpp_report->params[HIDPP_PARAM_27MHZ_DEVID] !=
1523 dj_dev->hdev->product) {
1524 struct dj_workitem workitem = {
1525 .device_index = hidpp_report->device_index,
1526 .type = WORKITEM_TYPE_UNPAIRED,
1528 kfifo_in(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem));
1529 /* logi_hidpp_recv_queue_notif will queue the work */
1534 logi_dj_recv_forward_report(dj_dev, data, size);
1536 if (hidpp_report->sub_id == REPORT_TYPE_NOTIF_DEVICE_CONNECTED)
1537 logi_hidpp_recv_queue_notif(hdev, hidpp_report);
1539 logi_dj_recv_queue_unknown_work(djrcv_dev);
1542 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1547 static int logi_dj_raw_event(struct hid_device *hdev,
1548 struct hid_report *report, u8 *data,
1551 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1552 dbg_hid("%s, size:%d\n", __func__, size);
1557 if (!hdev->report_enum[HID_INPUT_REPORT].numbered) {
1559 if (djrcv_dev->unnumbered_application == HID_GD_KEYBOARD) {
1561 * For the keyboard, we can reuse the same report by
1562 * using the second byte which is constant in the USB
1563 * HID report descriptor.
1566 data[0] = REPORT_TYPE_KEYBOARD;
1568 logi_dj_recv_forward_input_report(hdev, data, size);
1570 /* restore previous state */
1574 /* The 27 MHz mouse-only receiver sends unnumbered mouse data */
1575 if (djrcv_dev->unnumbered_application == HID_GD_MOUSE &&
1579 /* Prepend report id */
1580 mouse_report[0] = REPORT_TYPE_MOUSE;
1581 memcpy(mouse_report + 1, data, 6);
1582 logi_dj_recv_forward_input_report(hdev, mouse_report, 7);
1589 case REPORT_ID_DJ_SHORT:
1590 if (size != DJREPORT_SHORT_LENGTH) {
1591 hid_err(hdev, "Short DJ report bad size (%d)", size);
1594 return logi_dj_dj_event(hdev, report, data, size);
1595 case REPORT_ID_DJ_LONG:
1596 if (size != DJREPORT_LONG_LENGTH) {
1597 hid_err(hdev, "Long DJ report bad size (%d)", size);
1600 return logi_dj_dj_event(hdev, report, data, size);
1601 case REPORT_ID_HIDPP_SHORT:
1602 if (size != HIDPP_REPORT_SHORT_LENGTH) {
1603 hid_err(hdev, "Short HID++ report bad size (%d)", size);
1606 return logi_dj_hidpp_event(hdev, report, data, size);
1607 case REPORT_ID_HIDPP_LONG:
1608 if (size != HIDPP_REPORT_LONG_LENGTH) {
1609 hid_err(hdev, "Long HID++ report bad size (%d)", size);
1612 return logi_dj_hidpp_event(hdev, report, data, size);
1615 logi_dj_recv_forward_input_report(hdev, data, size);
1620 static int logi_dj_probe(struct hid_device *hdev,
1621 const struct hid_device_id *id)
1623 struct hid_report_enum *rep_enum;
1624 struct hid_report *rep;
1625 struct dj_receiver_dev *djrcv_dev;
1626 struct usb_interface *intf;
1627 unsigned int no_dj_interfaces = 0;
1628 bool has_hidpp = false;
1629 unsigned long flags;
1633 * Call to usbhid to fetch the HID descriptors of the current
1634 * interface subsequently call to the hid/hid-core to parse the
1635 * fetched descriptors.
1637 retval = hid_parse(hdev);
1639 hid_err(hdev, "%s: parse failed\n", __func__);
1644 * Some KVMs add an extra interface for e.g. mouse emulation. If we
1645 * treat these as logitech-dj interfaces then this causes input events
1646 * reported through this extra interface to not be reported correctly.
1647 * To avoid this, we treat these as generic-hid devices.
1649 switch (id->driver_data) {
1650 case recvr_type_dj: no_dj_interfaces = 3; break;
1651 case recvr_type_hidpp: no_dj_interfaces = 2; break;
1652 case recvr_type_gaming_hidpp: no_dj_interfaces = 3; break;
1653 case recvr_type_27mhz: no_dj_interfaces = 2; break;
1654 case recvr_type_bluetooth: no_dj_interfaces = 2; break;
1656 if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
1657 intf = to_usb_interface(hdev->dev.parent);
1658 if (intf && intf->altsetting->desc.bInterfaceNumber >=
1660 hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
1661 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
1665 rep_enum = &hdev->report_enum[HID_INPUT_REPORT];
1667 /* no input reports, bail out */
1668 if (list_empty(&rep_enum->report_list))
1672 * Check for the HID++ application.
1673 * Note: we should theoretically check for HID++ and DJ
1674 * collections, but this will do.
1676 list_for_each_entry(rep, &rep_enum->report_list, list) {
1677 if (rep->application == 0xff000001)
1682 * Ignore interfaces without DJ/HID++ collection, they will not carry
1683 * any data, dont create any hid_device for them.
1685 if (!has_hidpp && id->driver_data == recvr_type_dj)
1688 /* get the current application attached to the node */
1689 rep = list_first_entry(&rep_enum->report_list, struct hid_report, list);
1690 djrcv_dev = dj_get_receiver_dev(hdev, id->driver_data,
1691 rep->application, has_hidpp);
1693 hid_err(hdev, "%s: dj_get_receiver_dev failed\n", __func__);
1697 if (!rep_enum->numbered)
1698 djrcv_dev->unnumbered_application = rep->application;
1700 /* Starts the usb device and connects to upper interfaces hiddev and
1702 retval = hid_hw_start(hdev, HID_CONNECT_HIDRAW|HID_CONNECT_HIDDEV);
1704 hid_err(hdev, "%s: hid_hw_start returned error\n", __func__);
1705 goto hid_hw_start_fail;
1709 retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0);
1711 hid_err(hdev, "%s: logi_dj_recv_switch_to_dj_mode returned error:%d\n",
1713 goto switch_to_dj_mode_fail;
1717 /* This is enabling the polling urb on the IN endpoint */
1718 retval = hid_hw_open(hdev);
1720 hid_err(hdev, "%s: hid_hw_open returned error:%d\n",
1725 /* Allow incoming packets to arrive: */
1726 hid_device_io_start(hdev);
1729 spin_lock_irqsave(&djrcv_dev->lock, flags);
1730 djrcv_dev->ready = true;
1731 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1732 retval = logi_dj_recv_query_paired_devices(djrcv_dev);
1734 hid_err(hdev, "%s: logi_dj_recv_query_paired_devices error:%d\n",
1736 goto logi_dj_recv_query_paired_devices_failed;
1742 logi_dj_recv_query_paired_devices_failed:
1746 switch_to_dj_mode_fail:
1750 dj_put_receiver_dev(hdev);
1755 static int logi_dj_reset_resume(struct hid_device *hdev)
1758 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1760 if (!djrcv_dev || djrcv_dev->hidpp != hdev)
1763 retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0);
1765 hid_err(hdev, "%s: logi_dj_recv_switch_to_dj_mode returned error:%d\n",
1773 static void logi_dj_remove(struct hid_device *hdev)
1775 struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
1776 struct dj_device *dj_dev;
1777 unsigned long flags;
1780 dbg_hid("%s\n", __func__);
1783 return hid_hw_stop(hdev);
1786 * This ensures that if the work gets requeued from another
1787 * interface of the same receiver it will be a no-op.
1789 spin_lock_irqsave(&djrcv_dev->lock, flags);
1790 djrcv_dev->ready = false;
1791 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1793 cancel_work_sync(&djrcv_dev->work);
1799 * For proper operation we need access to all interfaces, so we destroy
1800 * the paired devices when we're unbound from any interface.
1802 * Note we may still be bound to other interfaces, sharing the same
1803 * djrcv_dev, so we need locking here.
1805 for (i = 0; i < (DJ_MAX_PAIRED_DEVICES + DJ_DEVICE_INDEX_MIN); i++) {
1806 spin_lock_irqsave(&djrcv_dev->lock, flags);
1807 dj_dev = djrcv_dev->paired_dj_devices[i];
1808 djrcv_dev->paired_dj_devices[i] = NULL;
1809 spin_unlock_irqrestore(&djrcv_dev->lock, flags);
1810 if (dj_dev != NULL) {
1811 hid_destroy_device(dj_dev->hdev);
1816 dj_put_receiver_dev(hdev);
1819 static const struct hid_device_id logi_dj_receivers[] = {
1820 {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1821 USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER),
1822 .driver_data = recvr_type_dj},
1823 {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1824 USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2),
1825 .driver_data = recvr_type_dj},
1826 { /* Logitech Nano (non DJ) receiver */
1827 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1828 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER),
1829 .driver_data = recvr_type_hidpp},
1830 { /* Logitech Nano (non DJ) receiver */
1831 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1832 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_2),
1833 .driver_data = recvr_type_hidpp},
1834 { /* Logitech gaming receiver (0xc539) */
1835 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1836 USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_GAMING),
1837 .driver_data = recvr_type_gaming_hidpp},
1838 { /* Logitech 27 MHz HID++ 1.0 receiver (0xc517) */
1839 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1840 USB_DEVICE_ID_S510_RECEIVER_2),
1841 .driver_data = recvr_type_27mhz},
1842 { /* Logitech 27 MHz HID++ 1.0 mouse-only receiver (0xc51b) */
1843 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1844 USB_DEVICE_ID_LOGITECH_27MHZ_MOUSE_RECEIVER),
1845 .driver_data = recvr_type_27mhz},
1846 { /* Logitech MX5000 HID++ / bluetooth receiver keyboard intf. */
1847 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1849 .driver_data = recvr_type_bluetooth},
1850 { /* Logitech MX5000 HID++ / bluetooth receiver mouse intf. */
1851 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
1853 .driver_data = recvr_type_bluetooth},
1857 MODULE_DEVICE_TABLE(hid, logi_dj_receivers);
1859 static struct hid_driver logi_djreceiver_driver = {
1860 .name = "logitech-djreceiver",
1861 .id_table = logi_dj_receivers,
1862 .probe = logi_dj_probe,
1863 .remove = logi_dj_remove,
1864 .raw_event = logi_dj_raw_event,
1866 .reset_resume = logi_dj_reset_resume,
1870 module_hid_driver(logi_djreceiver_driver);
1872 MODULE_LICENSE("GPL");
1873 MODULE_AUTHOR("Logitech");
1874 MODULE_AUTHOR("Nestor Lopez Casado");
1875 MODULE_AUTHOR("nlopezcasad@logitech.com");