aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2013-03-10 07:32:44 -0400
committerJiri Kosina <jkosina@suse.cz>2013-03-14 06:50:49 -0400
commit8936aa31cd5fd0bea828416a3c07efd303269a45 (patch)
treec446d08546f9bf78516865c3e5af250a85380c3c
parentd381f45c890a3fb136afb0dc1cbe025e066cb981 (diff)
HID: roccat: add support for Roccat Kone Pure gaming mouse
Userland-tools can already be found at http://sourceforge.net/projects/roccat Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure105
-rw-r--r--drivers/hid/Makefile4
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-roccat-konepure.c304
-rw-r--r--drivers/hid/hid-roccat-konepure.h72
6 files changed, 485 insertions, 2 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure b/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure
new file mode 100644
index 000000000000..41a9b7fbfc79
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure
@@ -0,0 +1,105 @@
1What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/actual_profile
2Date: December 2012
3Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
4Description: The mouse can store 5 profiles which can be switched by the
5 press of a button. actual_profile holds number of actual profile.
6 This value is persistent, so its value determines the profile
7 that's active when the mouse is powered on next time.
8 When written, the mouse activates the set profile immediately.
9 The data has to be 3 bytes long.
10 The mouse will reject invalid data.
11Users: http://roccat.sourceforge.net
12
13What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/control
14Date: December 2012
15Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
16Description: When written, this file lets one select which data from which
17 profile will be read next. The data has to be 3 bytes long.
18 This file is writeonly.
19Users: http://roccat.sourceforge.net
20
21What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/info
22Date: December 2012
23Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
24Description: When read, this file returns general data like firmware version.
25 When written, the device can be reset.
26 The data is 6 bytes long.
27Users: http://roccat.sourceforge.net
28
29What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/macro
30Date: December 2012
31Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
32Description: The mouse can store a macro with max 500 key/button strokes
33 internally.
34 When written, this file lets one set the sequence for a specific
35 button for a specific profile. Button and profile numbers are
36 included in written data. The data has to be 2082 bytes long.
37 This file is writeonly.
38Users: http://roccat.sourceforge.net
39
40What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/profile_buttons
41Date: December 2012
42Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
43Description: The mouse can store 5 profiles which can be switched by the
44 press of a button. A profile is split in settings and buttons.
45 profile_buttons holds information about button layout.
46 When written, this file lets one write the respective profile
47 buttons back to the mouse. The data has to be 59 bytes long.
48 The mouse will reject invalid data.
49 Which profile to write is determined by the profile number
50 contained in the data.
51 Before reading this file, control has to be written to select
52 which profile to read.
53Users: http://roccat.sourceforge.net
54
55What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/profile_settings
56Date: December 2012
57Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
58Description: The mouse can store 5 profiles which can be switched by the
59 press of a button. A profile is split in settings and buttons.
60 profile_settings holds information like resolution, sensitivity
61 and light effects.
62 When written, this file lets one write the respective profile
63 settings back to the mouse. The data has to be 31 bytes long.
64 The mouse will reject invalid data.
65 Which profile to write is determined by the profile number
66 contained in the data.
67 Before reading this file, control has to be written to select
68 which profile to read.
69Users: http://roccat.sourceforge.net
70
71What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/sensor
72Date: December 2012
73Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
74Description: The mouse has a tracking- and a distance-control-unit. These
75 can be activated/deactivated and the lift-off distance can be
76 set. The data has to be 6 bytes long.
77 This file is writeonly.
78Users: http://roccat.sourceforge.net
79
80What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/talk
81Date: December 2012
82Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
83Description: Used to active some easy* functions of the mouse from outside.
84 The data has to be 16 bytes long.
85 This file is writeonly.
86Users: http://roccat.sourceforge.net
87
88What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/tcu
89Date: December 2012
90Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
91Description: When written a calibration process for the tracking control unit
92 can be initiated/cancelled. Also lets one read/write sensor
93 registers.
94 The data has to be 4 bytes long.
95Users: http://roccat.sourceforge.net
96
97What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/konepure/roccatkonepure<minor>/tcu_image
98Date: December 2012
99Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
100Description: When read the mouse returns a 30x30 pixel image of the
101 sampled underground. This works only in the course of a
102 calibration process initiated with tcu.
103 The returned data is 1028 bytes in size.
104 This file is readonly.
105Users: http://roccat.sourceforge.net
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 72d1b0bc0a97..273515197c37 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -94,8 +94,8 @@ obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
94obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.o 94obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.o
95obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ 95obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
96 hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ 96 hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
97 hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-lua.o \ 97 hid-roccat-koneplus.o hid-roccat-konepure.o hid-roccat-kovaplus.o \
98 hid-roccat-pyra.o hid-roccat-savu.o 98 hid-roccat-lua.o hid-roccat-pyra.o hid-roccat-savu.o
99obj-$(CONFIG_HID_SAITEK) += hid-saitek.o 99obj-$(CONFIG_HID_SAITEK) += hid-saitek.o
100obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o 100obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
101obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o 101obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 512b01c04ea7..733d7e059708 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1687,6 +1687,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
1687 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, 1687 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
1688 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, 1688 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
1689 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, 1689 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) },
1690 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) },
1690 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, 1691 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) },
1691 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, 1692 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) },
1692 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 1693 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 92e47e5c9564..007ee7441e34 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -689,6 +689,7 @@
689#define USB_DEVICE_ID_ROCCAT_ISKU 0x319c 689#define USB_DEVICE_ID_ROCCAT_ISKU 0x319c
690#define USB_DEVICE_ID_ROCCAT_KONE 0x2ced 690#define USB_DEVICE_ID_ROCCAT_KONE 0x2ced
691#define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 691#define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51
692#define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe
692#define USB_DEVICE_ID_ROCCAT_KONEXTD 0x2e22 693#define USB_DEVICE_ID_ROCCAT_KONEXTD 0x2e22
693#define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 694#define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50
694#define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e 695#define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e
diff --git a/drivers/hid/hid-roccat-konepure.c b/drivers/hid/hid-roccat-konepure.c
new file mode 100644
index 000000000000..c79d0b06c143
--- /dev/null
+++ b/drivers/hid/hid-roccat-konepure.c
@@ -0,0 +1,304 @@
1/*
2 * Roccat KonePure driver for Linux
3 *
4 * Copyright (c) 2012 Stefan Achatz <erazor_de@users.sourceforge.net>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 */
13
14/*
15 * Roccat KonePure is a smaller version of KoneXTD with less buttons and lights.
16 */
17
18#include <linux/device.h>
19#include <linux/input.h>
20#include <linux/hid.h>
21#include <linux/module.h>
22#include <linux/slab.h>
23#include <linux/hid-roccat.h>
24#include "hid-ids.h"
25#include "hid-roccat-common.h"
26#include "hid-roccat-konepure.h"
27
28static struct class *konepure_class;
29
30static ssize_t konepure_sysfs_read(struct file *fp, struct kobject *kobj,
31 char *buf, loff_t off, size_t count,
32 size_t real_size, uint command)
33{
34 struct device *dev =
35 container_of(kobj, struct device, kobj)->parent->parent;
36 struct konepure_device *konepure = hid_get_drvdata(dev_get_drvdata(dev));
37 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
38 int retval;
39
40 if (off >= real_size)
41 return 0;
42
43 if (off != 0 || count != real_size)
44 return -EINVAL;
45
46 mutex_lock(&konepure->konepure_lock);
47 retval = roccat_common2_receive(usb_dev, command, buf, real_size);
48 mutex_unlock(&konepure->konepure_lock);
49
50 return retval ? retval : real_size;
51}
52
53static ssize_t konepure_sysfs_write(struct file *fp, struct kobject *kobj,
54 void const *buf, loff_t off, size_t count,
55 size_t real_size, uint command)
56{
57 struct device *dev =
58 container_of(kobj, struct device, kobj)->parent->parent;
59 struct konepure_device *konepure = hid_get_drvdata(dev_get_drvdata(dev));
60 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
61 int retval;
62
63 if (off != 0 || count != real_size)
64 return -EINVAL;
65
66 mutex_lock(&konepure->konepure_lock);
67 retval = roccat_common2_send_with_status(usb_dev, command,
68 (void *)buf, real_size);
69 mutex_unlock(&konepure->konepure_lock);
70
71 return retval ? retval : real_size;
72}
73
74#define KONEPURE_SYSFS_W(thingy, THINGY) \
75static ssize_t konepure_sysfs_write_ ## thingy(struct file *fp, \
76 struct kobject *kobj, struct bin_attribute *attr, char *buf, \
77 loff_t off, size_t count) \
78{ \
79 return konepure_sysfs_write(fp, kobj, buf, off, count, \
80 KONEPURE_SIZE_ ## THINGY, KONEPURE_COMMAND_ ## THINGY); \
81}
82
83#define KONEPURE_SYSFS_R(thingy, THINGY) \
84static ssize_t konepure_sysfs_read_ ## thingy(struct file *fp, \
85 struct kobject *kobj, struct bin_attribute *attr, char *buf, \
86 loff_t off, size_t count) \
87{ \
88 return konepure_sysfs_read(fp, kobj, buf, off, count, \
89 KONEPURE_SIZE_ ## THINGY, KONEPURE_COMMAND_ ## THINGY); \
90}
91
92#define KONEPURE_SYSFS_RW(thingy, THINGY) \
93KONEPURE_SYSFS_W(thingy, THINGY) \
94KONEPURE_SYSFS_R(thingy, THINGY)
95
96#define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \
97{ \
98 .attr = { .name = #thingy, .mode = 0660 }, \
99 .size = KONEPURE_SIZE_ ## THINGY, \
100 .read = konepure_sysfs_read_ ## thingy, \
101 .write = konepure_sysfs_write_ ## thingy \
102}
103
104#define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \
105{ \
106 .attr = { .name = #thingy, .mode = 0440 }, \
107 .size = KONEPURE_SIZE_ ## THINGY, \
108 .read = konepure_sysfs_read_ ## thingy, \
109}
110
111#define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \
112{ \
113 .attr = { .name = #thingy, .mode = 0220 }, \
114 .size = KONEPURE_SIZE_ ## THINGY, \
115 .write = konepure_sysfs_write_ ## thingy \
116}
117
118KONEPURE_SYSFS_RW(actual_profile, ACTUAL_PROFILE)
119KONEPURE_SYSFS_W(control, CONTROL)
120KONEPURE_SYSFS_RW(info, INFO)
121KONEPURE_SYSFS_W(talk, TALK)
122KONEPURE_SYSFS_W(macro, MACRO)
123KONEPURE_SYSFS_RW(sensor, SENSOR)
124KONEPURE_SYSFS_RW(tcu, TCU)
125KONEPURE_SYSFS_R(tcu_image, TCU_IMAGE)
126KONEPURE_SYSFS_RW(profile_settings, PROFILE_SETTINGS)
127KONEPURE_SYSFS_RW(profile_buttons, PROFILE_BUTTONS)
128
129static struct bin_attribute konepure_bin_attributes[] = {
130 KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE),
131 KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL),
132 KONEPURE_BIN_ATTRIBUTE_RW(info, INFO),
133 KONEPURE_BIN_ATTRIBUTE_W(talk, TALK),
134 KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO),
135 KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR),
136 KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU),
137 KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE),
138 KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS),
139 KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS),
140 __ATTR_NULL
141};
142
143static int konepure_init_konepure_device_struct(struct usb_device *usb_dev,
144 struct konepure_device *konepure)
145{
146 mutex_init(&konepure->konepure_lock);
147
148 return 0;
149}
150
151static int konepure_init_specials(struct hid_device *hdev)
152{
153 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
154 struct usb_device *usb_dev = interface_to_usbdev(intf);
155 struct konepure_device *konepure;
156 int retval;
157
158 if (intf->cur_altsetting->desc.bInterfaceProtocol
159 != USB_INTERFACE_PROTOCOL_MOUSE) {
160 hid_set_drvdata(hdev, NULL);
161 return 0;
162 }
163
164 konepure = kzalloc(sizeof(*konepure), GFP_KERNEL);
165 if (!konepure) {
166 hid_err(hdev, "can't alloc device descriptor\n");
167 return -ENOMEM;
168 }
169 hid_set_drvdata(hdev, konepure);
170
171 retval = konepure_init_konepure_device_struct(usb_dev, konepure);
172 if (retval) {
173 hid_err(hdev, "couldn't init struct konepure_device\n");
174 goto exit_free;
175 }
176
177 retval = roccat_connect(konepure_class, hdev,
178 sizeof(struct konepure_mouse_report_button));
179 if (retval < 0) {
180 hid_err(hdev, "couldn't init char dev\n");
181 } else {
182 konepure->chrdev_minor = retval;
183 konepure->roccat_claimed = 1;
184 }
185
186 return 0;
187exit_free:
188 kfree(konepure);
189 return retval;
190}
191
192static void konepure_remove_specials(struct hid_device *hdev)
193{
194 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
195 struct konepure_device *konepure;
196
197 if (intf->cur_altsetting->desc.bInterfaceProtocol
198 != USB_INTERFACE_PROTOCOL_MOUSE)
199 return;
200
201 konepure = hid_get_drvdata(hdev);
202 if (konepure->roccat_claimed)
203 roccat_disconnect(konepure->chrdev_minor);
204 kfree(konepure);
205}
206
207static int konepure_probe(struct hid_device *hdev,
208 const struct hid_device_id *id)
209{
210 int retval;
211
212 retval = hid_parse(hdev);
213 if (retval) {
214 hid_err(hdev, "parse failed\n");
215 goto exit;
216 }
217
218 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
219 if (retval) {
220 hid_err(hdev, "hw start failed\n");
221 goto exit;
222 }
223
224 retval = konepure_init_specials(hdev);
225 if (retval) {
226 hid_err(hdev, "couldn't install mouse\n");
227 goto exit_stop;
228 }
229
230 return 0;
231
232exit_stop:
233 hid_hw_stop(hdev);
234exit:
235 return retval;
236}
237
238static void konepure_remove(struct hid_device *hdev)
239{
240 konepure_remove_specials(hdev);
241 hid_hw_stop(hdev);
242}
243
244static int konepure_raw_event(struct hid_device *hdev,
245 struct hid_report *report, u8 *data, int size)
246{
247 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
248 struct konepure_device *konepure = hid_get_drvdata(hdev);
249
250 if (intf->cur_altsetting->desc.bInterfaceProtocol
251 != USB_INTERFACE_PROTOCOL_MOUSE)
252 return 0;
253
254 if (data[0] != KONEPURE_MOUSE_REPORT_NUMBER_BUTTON)
255 return 0;
256
257 if (konepure != NULL && konepure->roccat_claimed)
258 roccat_report_event(konepure->chrdev_minor, data);
259
260 return 0;
261}
262
263static const struct hid_device_id konepure_devices[] = {
264 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) },
265 { }
266};
267
268MODULE_DEVICE_TABLE(hid, konepure_devices);
269
270static struct hid_driver konepure_driver = {
271 .name = "konepure",
272 .id_table = konepure_devices,
273 .probe = konepure_probe,
274 .remove = konepure_remove,
275 .raw_event = konepure_raw_event
276};
277
278static int __init konepure_init(void)
279{
280 int retval;
281
282 konepure_class = class_create(THIS_MODULE, "konepure");
283 if (IS_ERR(konepure_class))
284 return PTR_ERR(konepure_class);
285 konepure_class->dev_bin_attrs = konepure_bin_attributes;
286
287 retval = hid_register_driver(&konepure_driver);
288 if (retval)
289 class_destroy(konepure_class);
290 return retval;
291}
292
293static void __exit konepure_exit(void)
294{
295 hid_unregister_driver(&konepure_driver);
296 class_destroy(konepure_class);
297}
298
299module_init(konepure_init);
300module_exit(konepure_exit);
301
302MODULE_AUTHOR("Stefan Achatz");
303MODULE_DESCRIPTION("USB Roccat KonePure driver");
304MODULE_LICENSE("GPL v2");
diff --git a/drivers/hid/hid-roccat-konepure.h b/drivers/hid/hid-roccat-konepure.h
new file mode 100644
index 000000000000..2cd24e93dfd6
--- /dev/null
+++ b/drivers/hid/hid-roccat-konepure.h
@@ -0,0 +1,72 @@
1#ifndef __HID_ROCCAT_KONEPURE_H
2#define __HID_ROCCAT_KONEPURE_H
3
4/*
5 * Copyright (c) 2012 Stefan Achatz <erazor_de@users.sourceforge.net>
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 */
14
15#include <linux/types.h>
16
17enum {
18 KONEPURE_SIZE_ACTUAL_PROFILE = 0x03,
19 KONEPURE_SIZE_CONTROL = 0x03,
20 KONEPURE_SIZE_FIRMWARE_WRITE = 0x0402,
21 KONEPURE_SIZE_INFO = 0x06,
22 KONEPURE_SIZE_MACRO = 0x0822,
23 KONEPURE_SIZE_PROFILE_SETTINGS = 0x1f,
24 KONEPURE_SIZE_PROFILE_BUTTONS = 0x3b,
25 KONEPURE_SIZE_SENSOR = 0x06,
26 KONEPURE_SIZE_TALK = 0x10,
27 KONEPURE_SIZE_TCU = 0x04,
28 KONEPURE_SIZE_TCU_IMAGE = 0x0404,
29};
30
31enum konepure_control_requests {
32 KONEPURE_CONTROL_REQUEST_GENERAL = 0x80,
33 KONEPURE_CONTROL_REQUEST_BUTTONS = 0x90,
34};
35
36enum konepure_commands {
37 KONEPURE_COMMAND_CONTROL = 0x04,
38 KONEPURE_COMMAND_ACTUAL_PROFILE = 0x05,
39 KONEPURE_COMMAND_PROFILE_SETTINGS = 0x06,
40 KONEPURE_COMMAND_PROFILE_BUTTONS = 0x07,
41 KONEPURE_COMMAND_MACRO = 0x08,
42 KONEPURE_COMMAND_INFO = 0x09,
43 KONEPURE_COMMAND_TCU = 0x0c,
44 KONEPURE_COMMAND_TCU_IMAGE = 0x0c,
45 KONEPURE_COMMAND_E = 0x0e,
46 KONEPURE_COMMAND_SENSOR = 0x0f,
47 KONEPURE_COMMAND_TALK = 0x10,
48 KONEPURE_COMMAND_FIRMWARE_WRITE = 0x1b,
49 KONEPURE_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
50};
51
52enum {
53 KONEPURE_MOUSE_REPORT_NUMBER_BUTTON = 3,
54};
55
56struct konepure_mouse_report_button {
57 uint8_t report_number; /* always KONEPURE_MOUSE_REPORT_NUMBER_BUTTON */
58 uint8_t zero;
59 uint8_t type;
60 uint8_t data1;
61 uint8_t data2;
62 uint8_t zero2;
63 uint8_t unknown[2];
64} __packed;
65
66struct konepure_device {
67 int roccat_claimed;
68 int chrdev_minor;
69 struct mutex konepure_lock;
70};
71
72#endif