0001
0002 #ifndef __HID_ROCCAT_KONE_H
0003 #define __HID_ROCCAT_KONE_H
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/types.h>
0013
0014 struct kone_keystroke {
0015 uint8_t key;
0016 uint8_t action;
0017 uint16_t period;
0018 } __attribute__ ((__packed__));
0019
0020 enum kone_keystroke_buttons {
0021 kone_keystroke_button_1 = 0xf0,
0022 kone_keystroke_button_2 = 0xf1,
0023 kone_keystroke_button_3 = 0xf2,
0024 kone_keystroke_button_9 = 0xf3,
0025 kone_keystroke_button_8 = 0xf4
0026 };
0027
0028 enum kone_keystroke_actions {
0029 kone_keystroke_action_press = 0,
0030 kone_keystroke_action_release = 1
0031 };
0032
0033 struct kone_button_info {
0034 uint8_t number;
0035 uint8_t type;
0036 uint8_t macro_type;
0037 uint8_t macro_set_name[16];
0038 uint8_t macro_name[16];
0039 uint8_t count;
0040 struct kone_keystroke keystrokes[20];
0041 } __attribute__ ((__packed__));
0042
0043 enum kone_button_info_types {
0044
0045 kone_button_info_type_button_1 = 0x1,
0046 kone_button_info_type_button_2 = 0x2,
0047 kone_button_info_type_button_3 = 0x3,
0048 kone_button_info_type_double_click = 0x4,
0049 kone_button_info_type_key = 0x5,
0050 kone_button_info_type_macro = 0x6,
0051 kone_button_info_type_off = 0x7,
0052
0053 kone_button_info_type_osd_xy_prescaling = 0x8,
0054 kone_button_info_type_osd_dpi = 0x9,
0055 kone_button_info_type_osd_profile = 0xa,
0056 kone_button_info_type_button_9 = 0xb,
0057 kone_button_info_type_button_8 = 0xc,
0058 kone_button_info_type_dpi_up = 0xd,
0059 kone_button_info_type_dpi_down = 0xe,
0060 kone_button_info_type_button_7 = 0xf,
0061 kone_button_info_type_button_6 = 0x10,
0062 kone_button_info_type_profile_up = 0x11,
0063 kone_button_info_type_profile_down = 0x12,
0064
0065 kone_button_info_type_multimedia_open_player = 0x20,
0066 kone_button_info_type_multimedia_next_track = 0x21,
0067 kone_button_info_type_multimedia_prev_track = 0x22,
0068 kone_button_info_type_multimedia_play_pause = 0x23,
0069 kone_button_info_type_multimedia_stop = 0x24,
0070 kone_button_info_type_multimedia_mute = 0x25,
0071 kone_button_info_type_multimedia_volume_up = 0x26,
0072 kone_button_info_type_multimedia_volume_down = 0x27
0073 };
0074
0075 enum kone_button_info_numbers {
0076 kone_button_top = 1,
0077 kone_button_wheel_tilt_left = 2,
0078 kone_button_wheel_tilt_right = 3,
0079 kone_button_forward = 4,
0080 kone_button_backward = 5,
0081 kone_button_middle = 6,
0082 kone_button_plus = 7,
0083 kone_button_minus = 8,
0084 };
0085
0086 struct kone_light_info {
0087 uint8_t number;
0088 uint8_t mod;
0089 uint8_t red;
0090 uint8_t green;
0091 uint8_t blue;
0092 } __attribute__ ((__packed__));
0093
0094 struct kone_profile {
0095 uint16_t size;
0096 uint16_t unused;
0097
0098
0099
0100
0101
0102
0103 uint8_t profile;
0104
0105 uint16_t main_sensitivity;
0106 uint8_t xy_sensitivity_enabled;
0107 uint16_t x_sensitivity;
0108 uint16_t y_sensitivity;
0109 uint8_t dpi_rate;
0110 uint8_t startup_dpi;
0111 uint8_t polling_rate;
0112
0113
0114
0115
0116 uint8_t dcu_flag;
0117 uint8_t light_effect_1;
0118 uint8_t light_effect_2;
0119 uint8_t light_effect_3;
0120 uint8_t light_effect_speed;
0121
0122 struct kone_light_info light_infos[5];
0123
0124 struct kone_button_info button_infos[8];
0125
0126 uint16_t checksum;
0127 } __attribute__ ((__packed__));
0128
0129 enum kone_polling_rates {
0130 kone_polling_rate_125 = 1,
0131 kone_polling_rate_500 = 2,
0132 kone_polling_rate_1000 = 3
0133 };
0134
0135 struct kone_settings {
0136 uint16_t size;
0137 uint8_t startup_profile;
0138 uint8_t unknown1;
0139 uint8_t tcu;
0140 uint8_t unknown2[23];
0141 uint8_t calibration_data[4];
0142 uint8_t unknown3[2];
0143 uint16_t checksum;
0144 } __attribute__ ((__packed__));
0145
0146
0147
0148
0149 struct kone_mouse_event {
0150 uint8_t report_number;
0151 uint8_t button;
0152 uint16_t x;
0153 uint16_t y;
0154 uint8_t wheel;
0155 struct_group(wipe,
0156 uint8_t tilt;
0157 uint8_t unknown;
0158 uint8_t event;
0159 uint8_t value;
0160 uint8_t macro_key;
0161 );
0162 } __attribute__ ((__packed__));
0163
0164 enum kone_mouse_events {
0165
0166 kone_mouse_event_osd_dpi = 0xa0,
0167 kone_mouse_event_osd_profile = 0xb0,
0168
0169 kone_mouse_event_calibration = 0xc0,
0170 kone_mouse_event_call_overlong_macro = 0xe0,
0171 kone_mouse_event_multimedia = 0xe1,
0172
0173 kone_mouse_event_switch_dpi = 0xf0,
0174 kone_mouse_event_switch_profile = 0xf1
0175 };
0176
0177 enum kone_commands {
0178 kone_command_profile = 0x5a,
0179 kone_command_settings = 0x15a,
0180 kone_command_firmware_version = 0x25a,
0181 kone_command_weight = 0x45a,
0182 kone_command_calibrate = 0x55a,
0183 kone_command_confirm_write = 0x65a,
0184 kone_command_firmware = 0xe5a
0185 };
0186
0187 struct kone_roccat_report {
0188 uint8_t event;
0189 uint8_t value;
0190 uint8_t key;
0191 } __attribute__ ((__packed__));
0192
0193 struct kone_device {
0194
0195
0196
0197
0198 int actual_profile, actual_dpi;
0199
0200 struct kone_mouse_event last_mouse_event;
0201
0202
0203
0204
0205
0206
0207 struct mutex kone_lock;
0208
0209
0210
0211
0212
0213 struct kone_profile profiles[5];
0214 struct kone_settings settings;
0215
0216
0217
0218
0219
0220 int firmware_version;
0221
0222 int roccat_claimed;
0223 int chrdev_minor;
0224 };
0225
0226 #endif