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