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