Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef __HID_ROCCAT_PYRA_H
0003 #define __HID_ROCCAT_PYRA_H
0004 
0005 /*
0006  * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
0007  */
0008 
0009 /*
0010  */
0011 
0012 #include <linux/types.h>
0013 
0014 enum {
0015     PYRA_SIZE_CONTROL = 0x03,
0016     PYRA_SIZE_INFO = 0x06,
0017     PYRA_SIZE_PROFILE_SETTINGS = 0x0d,
0018     PYRA_SIZE_PROFILE_BUTTONS = 0x13,
0019     PYRA_SIZE_SETTINGS = 0x03,
0020 };
0021 
0022 enum pyra_control_requests {
0023     PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
0024     PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20
0025 };
0026 
0027 struct pyra_settings {
0028     uint8_t command; /* PYRA_COMMAND_SETTINGS */
0029     uint8_t size; /* always 3 */
0030     uint8_t startup_profile; /* Range 0-4! */
0031 } __attribute__ ((__packed__));
0032 
0033 struct pyra_profile_settings {
0034     uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
0035     uint8_t size; /* always 0xd */
0036     uint8_t number; /* Range 0-4 */
0037     uint8_t xysync;
0038     uint8_t x_sensitivity; /* 0x1-0xa */
0039     uint8_t y_sensitivity;
0040     uint8_t x_cpi; /* unused */
0041     uint8_t y_cpi; /* this value is for x and y */
0042     uint8_t lightswitch; /* 0 = off, 1 = on */
0043     uint8_t light_effect;
0044     uint8_t handedness;
0045     uint16_t checksum; /* byte sum */
0046 } __attribute__ ((__packed__));
0047 
0048 struct pyra_info {
0049     uint8_t command; /* PYRA_COMMAND_INFO */
0050     uint8_t size; /* always 6 */
0051     uint8_t firmware_version;
0052     uint8_t unknown1; /* always 0 */
0053     uint8_t unknown2; /* always 1 */
0054     uint8_t unknown3; /* always 0 */
0055 } __attribute__ ((__packed__));
0056 
0057 enum pyra_commands {
0058     PYRA_COMMAND_CONTROL = 0x4,
0059     PYRA_COMMAND_SETTINGS = 0x5,
0060     PYRA_COMMAND_PROFILE_SETTINGS = 0x6,
0061     PYRA_COMMAND_PROFILE_BUTTONS = 0x7,
0062     PYRA_COMMAND_INFO = 0x9,
0063     PYRA_COMMAND_B = 0xb
0064 };
0065 
0066 enum pyra_mouse_report_numbers {
0067     PYRA_MOUSE_REPORT_NUMBER_HID = 1,
0068     PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2,
0069     PYRA_MOUSE_REPORT_NUMBER_BUTTON = 3,
0070 };
0071 
0072 struct pyra_mouse_event_button {
0073     uint8_t report_number; /* always 3 */
0074     uint8_t unknown; /* always 0 */
0075     uint8_t type;
0076     uint8_t data1;
0077     uint8_t data2;
0078 } __attribute__ ((__packed__));
0079 
0080 struct pyra_mouse_event_audio {
0081     uint8_t report_number; /* always 2 */
0082     uint8_t type;
0083     uint8_t unused; /* always 0 */
0084 } __attribute__ ((__packed__));
0085 
0086 /* hid audio controls */
0087 enum pyra_mouse_event_audio_types {
0088     PYRA_MOUSE_EVENT_AUDIO_TYPE_MUTE = 0xe2,
0089     PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_UP = 0xe9,
0090     PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_DOWN = 0xea,
0091 };
0092 
0093 enum pyra_mouse_event_button_types {
0094     /*
0095      * Mouse sends tilt events on report_number 1 and 3
0096      * Tilt events are sent repeatedly with 0.94s between first and second
0097      * event and 0.22s on subsequent
0098      */
0099     PYRA_MOUSE_EVENT_BUTTON_TYPE_TILT = 0x10,
0100 
0101     /*
0102      * These are sent sequentially
0103      * data1 contains new profile number in range 1-5
0104      */
0105     PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_1 = 0x20,
0106     PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2 = 0x30,
0107 
0108     /*
0109      * data1 = button_number (rmp index)
0110      * data2 = pressed/released
0111      */
0112     PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO = 0x40,
0113     PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT = 0x50,
0114 
0115     /*
0116      * data1 = button_number (rmp index)
0117      */
0118     PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
0119 
0120     /* data1 = new cpi */
0121     PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI = 0xb0,
0122 
0123     /* data1 and data2 = new sensitivity */
0124     PYRA_MOUSE_EVENT_BUTTON_TYPE_SENSITIVITY = 0xc0,
0125 
0126     PYRA_MOUSE_EVENT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
0127 };
0128 
0129 enum {
0130     PYRA_MOUSE_EVENT_BUTTON_PRESS = 0,
0131     PYRA_MOUSE_EVENT_BUTTON_RELEASE = 1,
0132 };
0133 
0134 struct pyra_roccat_report {
0135     uint8_t type;
0136     uint8_t value;
0137     uint8_t key;
0138 } __attribute__ ((__packed__));
0139 
0140 struct pyra_device {
0141     int actual_profile;
0142     int actual_cpi;
0143     int roccat_claimed;
0144     int chrdev_minor;
0145     struct mutex pyra_lock;
0146     struct pyra_profile_settings profile_settings[5];
0147 };
0148 
0149 #endif