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