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