HID: roccat: reduce number of functions in kone and pyra drivers
[deliverable/linux.git] / drivers / hid / hid-roccat-pyra.h
CommitLineData
cb7cf3da
SA
1#ifndef __HID_ROCCAT_PYRA_H
2#define __HID_ROCCAT_PYRA_H
3
4/*
5 * Copyright (c) 2010 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
bd3a2b96
SA
17/*
18 * Binary data structures used for hardware communication must have no padding.
19 */
cb7cf3da
SA
20#pragma pack(push)
21#pragma pack(1)
22
23struct pyra_b {
24 uint8_t command; /* PYRA_COMMAND_B */
25 uint8_t size; /* always 3 */
26 uint8_t unknown; /* 1 */
27};
28
29struct pyra_control {
30 uint8_t command; /* PYRA_COMMAND_CONTROL */
31 /*
32 * value is profile number for request_settings and request_buttons
33 * 1 if status ok for request_status
34 */
35 uint8_t value; /* Range 0-4 */
36 uint8_t request;
37};
38
39enum pyra_control_requests {
40 PYRA_CONTROL_REQUEST_STATUS = 0x00,
41 PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
42 PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20
43};
44
45struct pyra_settings {
46 uint8_t command; /* PYRA_COMMAND_SETTINGS */
47 uint8_t size; /* always 3 */
48 uint8_t startup_profile; /* Range 0-4! */
49};
50
51struct pyra_profile_settings {
52 uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
53 uint8_t size; /* always 0xd */
54 uint8_t number; /* Range 0-4 */
55 uint8_t xysync;
56 uint8_t x_sensitivity; /* 0x1-0xa */
57 uint8_t y_sensitivity;
58 uint8_t x_cpi; /* unused */
59 uint8_t y_cpi; /* this value is for x and y */
60 uint8_t lightswitch; /* 0 = off, 1 = on */
61 uint8_t light_effect;
62 uint8_t handedness;
63 uint16_t checksum; /* byte sum */
64};
65
66struct pyra_profile_buttons {
67 uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */
68 uint8_t size; /* always 0x13 */
69 uint8_t number; /* Range 0-4 */
70 uint8_t buttons[14];
71 uint16_t checksum; /* byte sum */
72};
73
74struct pyra_info {
75 uint8_t command; /* PYRA_COMMAND_INFO */
76 uint8_t size; /* always 6 */
77 uint8_t firmware_version;
78 uint8_t unknown1; /* always 0 */
79 uint8_t unknown2; /* always 1 */
80 uint8_t unknown3; /* always 0 */
81};
82
83enum pyra_commands {
84 PYRA_COMMAND_CONTROL = 0x4,
85 PYRA_COMMAND_SETTINGS = 0x5,
86 PYRA_COMMAND_PROFILE_SETTINGS = 0x6,
87 PYRA_COMMAND_PROFILE_BUTTONS = 0x7,
88 PYRA_COMMAND_INFO = 0x9,
89 PYRA_COMMAND_B = 0xb
90};
91
92enum pyra_usb_commands {
93 PYRA_USB_COMMAND_CONTROL = 0x304,
94 PYRA_USB_COMMAND_SETTINGS = 0x305,
95 PYRA_USB_COMMAND_PROFILE_SETTINGS = 0x306,
96 PYRA_USB_COMMAND_PROFILE_BUTTONS = 0x307,
97 PYRA_USB_COMMAND_INFO = 0x309,
98 PYRA_USB_COMMAND_B = 0x30b /* writes 3 bytes */
99};
100
101enum pyra_mouse_report_numbers {
102 PYRA_MOUSE_REPORT_NUMBER_HID = 1,
103 PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2,
104 PYRA_MOUSE_REPORT_NUMBER_BUTTON = 3,
105};
106
107struct pyra_mouse_event_button {
108 uint8_t report_number; /* always 3 */
109 uint8_t unknown; /* always 0 */
110 uint8_t type;
111 uint8_t data1;
112 uint8_t data2;
113};
114
115struct pyra_mouse_event_audio {
116 uint8_t report_number; /* always 2 */
117 uint8_t type;
118 uint8_t unused; /* always 0 */
119};
120
121/* hid audio controls */
122enum pyra_mouse_event_audio_types {
123 PYRA_MOUSE_EVENT_AUDIO_TYPE_MUTE = 0xe2,
124 PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_UP = 0xe9,
125 PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_DOWN = 0xea,
126};
127
128enum pyra_mouse_event_button_types {
129 /*
130 * Mouse sends tilt events on report_number 1 and 3
131 * Tilt events are sent repeatedly with 0.94s between first and second
132 * event and 0.22s on subsequent
133 */
134 PYRA_MOUSE_EVENT_BUTTON_TYPE_TILT = 0x10,
135
136 /*
137 * These are sent sequentially
138 * data1 contains new profile number in range 1-5
139 */
140 PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_1 = 0x20,
141 PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2 = 0x30,
142
143 /*
144 * data1 = button_number (rmp index)
145 * data2 = pressed/released
146 */
147 PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO = 0x40,
148 PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT = 0x50,
149
150 /*
151 * data1 = button_number (rmp index)
152 */
153 PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
154
155 /* data1 = new cpi */
156 PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI = 0xb0,
157
158 /* data1 and data2 = new sensitivity */
159 PYRA_MOUSE_EVENT_BUTTON_TYPE_SENSITIVITY = 0xc0,
160
161 PYRA_MOUSE_EVENT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
162};
163
164enum {
165 PYRA_MOUSE_EVENT_BUTTON_PRESS = 0,
166 PYRA_MOUSE_EVENT_BUTTON_RELEASE = 1,
167};
168
169struct pyra_roccat_report {
170 uint8_t type;
171 uint8_t value;
172 uint8_t key;
173};
174
175#pragma pack(pop)
176
177struct pyra_device {
178 int actual_profile;
179 int actual_cpi;
180 int firmware_version;
181 int roccat_claimed;
182 int chrdev_minor;
183 struct mutex pyra_lock;
184 struct pyra_settings settings;
185 struct pyra_profile_settings profile_settings[5];
186 struct pyra_profile_buttons profile_buttons[5];
187};
188
189#endif
This page took 0.031737 seconds and 5 git commands to generate.