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