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