aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-logitech-dj.c88
-rw-r--r--drivers/hid/hid-logitech-dj.h115
2 files changed, 87 insertions, 116 deletions
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 42d38d50afdf..6aea16dca3ff 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -26,9 +26,95 @@
26#include <linux/hid.h> 26#include <linux/hid.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/kfifo.h>
29#include <asm/unaligned.h> 30#include <asm/unaligned.h>
30#include "hid-ids.h" 31#include "hid-ids.h"
31#include "hid-logitech-dj.h" 32
33#define DJ_MAX_PAIRED_DEVICES 6
34#define DJ_MAX_NUMBER_NOTIFICATIONS 8
35#define DJ_RECEIVER_INDEX 0
36#define DJ_DEVICE_INDEX_MIN 1
37#define DJ_DEVICE_INDEX_MAX 6
38
39#define DJREPORT_SHORT_LENGTH 15
40#define DJREPORT_LONG_LENGTH 32
41
42#define REPORT_ID_DJ_SHORT 0x20
43#define REPORT_ID_DJ_LONG 0x21
44
45#define REPORT_TYPE_RFREPORT_LAST 0x1F
46
47/* Command Switch to DJ mode */
48#define REPORT_TYPE_CMD_SWITCH 0x80
49#define CMD_SWITCH_PARAM_DEVBITFIELD 0x00
50#define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01
51#define TIMEOUT_NO_KEEPALIVE 0x00
52
53/* Command to Get the list of Paired devices */
54#define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81
55
56/* Device Paired Notification */
57#define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41
58#define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01
59#define SPFUNCTION_DEVICE_LIST_EMPTY 0x02
60#define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00
61#define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01
62#define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02
63#define DEVICE_PAIRED_RF_REPORT_TYPE 0x03
64
65/* Device Un-Paired Notification */
66#define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40
67
68
69/* Connection Status Notification */
70#define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42
71#define CONNECTION_STATUS_PARAM_STATUS 0x00
72#define STATUS_LINKLOSS 0x01
73
74/* Error Notification */
75#define REPORT_TYPE_NOTIF_ERROR 0x7F
76#define NOTIF_ERROR_PARAM_ETYPE 0x00
77#define ETYPE_KEEPALIVE_TIMEOUT 0x01
78
79/* supported DJ HID && RF report types */
80#define REPORT_TYPE_KEYBOARD 0x01
81#define REPORT_TYPE_MOUSE 0x02
82#define REPORT_TYPE_CONSUMER_CONTROL 0x03
83#define REPORT_TYPE_SYSTEM_CONTROL 0x04
84#define REPORT_TYPE_MEDIA_CENTER 0x08
85#define REPORT_TYPE_LEDS 0x0E
86
87/* RF Report types bitfield */
88#define STD_KEYBOARD 0x00000002
89#define STD_MOUSE 0x00000004
90#define MULTIMEDIA 0x00000008
91#define POWER_KEYS 0x00000010
92#define MEDIA_CENTER 0x00000100
93#define KBD_LEDS 0x00004000
94
95struct dj_report {
96 u8 report_id;
97 u8 device_index;
98 u8 report_type;
99 u8 report_params[DJREPORT_SHORT_LENGTH - 3];
100};
101
102struct dj_receiver_dev {
103 struct hid_device *hdev;
104 struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
105 DJ_DEVICE_INDEX_MIN];
106 struct work_struct work;
107 struct kfifo notif_fifo;
108 spinlock_t lock;
109 bool querying_devices;
110};
111
112struct dj_device {
113 struct hid_device *hdev;
114 struct dj_receiver_dev *dj_receiver_dev;
115 u32 reports_supported;
116 u8 device_index;
117};
32 118
33/* Keyboard descriptor (1) */ 119/* Keyboard descriptor (1) */
34static const char kbd_descriptor[] = { 120static const char kbd_descriptor[] = {
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h
deleted file mode 100644
index b1208c9c0573..000000000000
--- a/drivers/hid/hid-logitech-dj.h
+++ /dev/null
@@ -1,115 +0,0 @@
1#ifndef __HID_LOGITECH_DJ_H
2#define __HID_LOGITECH_DJ_H
3
4/*
5 * HID driver for Logitech Unifying receivers
6 *
7 * Copyright (c) 2011 Logitech
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#include <linux/kfifo.h>
27
28#define DJ_MAX_PAIRED_DEVICES 6
29#define DJ_MAX_NUMBER_NOTIFICATIONS 8
30#define DJ_RECEIVER_INDEX 0
31#define DJ_DEVICE_INDEX_MIN 1
32#define DJ_DEVICE_INDEX_MAX 6
33
34#define DJREPORT_SHORT_LENGTH 15
35#define DJREPORT_LONG_LENGTH 32
36
37#define REPORT_ID_DJ_SHORT 0x20
38#define REPORT_ID_DJ_LONG 0x21
39
40#define REPORT_TYPE_RFREPORT_FIRST 0x01
41#define REPORT_TYPE_RFREPORT_LAST 0x1F
42
43/* Command Switch to DJ mode */
44#define REPORT_TYPE_CMD_SWITCH 0x80
45#define CMD_SWITCH_PARAM_DEVBITFIELD 0x00
46#define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01
47#define TIMEOUT_NO_KEEPALIVE 0x00
48
49/* Command to Get the list of Paired devices */
50#define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81
51
52/* Device Paired Notification */
53#define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41
54#define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01
55#define SPFUNCTION_DEVICE_LIST_EMPTY 0x02
56#define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00
57#define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01
58#define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02
59#define DEVICE_PAIRED_RF_REPORT_TYPE 0x03
60
61/* Device Un-Paired Notification */
62#define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40
63
64
65/* Connection Status Notification */
66#define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42
67#define CONNECTION_STATUS_PARAM_STATUS 0x00
68#define STATUS_LINKLOSS 0x01
69
70/* Error Notification */
71#define REPORT_TYPE_NOTIF_ERROR 0x7F
72#define NOTIF_ERROR_PARAM_ETYPE 0x00
73#define ETYPE_KEEPALIVE_TIMEOUT 0x01
74
75/* supported DJ HID && RF report types */
76#define REPORT_TYPE_KEYBOARD 0x01
77#define REPORT_TYPE_MOUSE 0x02
78#define REPORT_TYPE_CONSUMER_CONTROL 0x03
79#define REPORT_TYPE_SYSTEM_CONTROL 0x04
80#define REPORT_TYPE_MEDIA_CENTER 0x08
81#define REPORT_TYPE_LEDS 0x0E
82
83/* RF Report types bitfield */
84#define STD_KEYBOARD 0x00000002
85#define STD_MOUSE 0x00000004
86#define MULTIMEDIA 0x00000008
87#define POWER_KEYS 0x00000010
88#define MEDIA_CENTER 0x00000100
89#define KBD_LEDS 0x00004000
90
91struct dj_report {
92 u8 report_id;
93 u8 device_index;
94 u8 report_type;
95 u8 report_params[DJREPORT_SHORT_LENGTH - 3];
96};
97
98struct dj_receiver_dev {
99 struct hid_device *hdev;
100 struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
101 DJ_DEVICE_INDEX_MIN];
102 struct work_struct work;
103 struct kfifo notif_fifo;
104 spinlock_t lock;
105 bool querying_devices;
106};
107
108struct dj_device {
109 struct hid_device *hdev;
110 struct dj_receiver_dev *dj_receiver_dev;
111 u32 reports_supported;
112 u8 device_index;
113};
114
115#endif