hid-roccat-koneplus.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #ifndef __HID_ROCCAT_KONEPLUS_H
  2. #define __HID_ROCCAT_KONEPLUS_H
  3. /*
  4. * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
  5. */
  6. /*
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. */
  12. #include <linux/types.h>
  13. struct koneplus_talk {
  14. uint8_t command; /* KONEPLUS_COMMAND_TALK */
  15. uint8_t size; /* always 0x10 */
  16. uint8_t data[14];
  17. } __packed;
  18. /*
  19. * case 1: writes request 80 and reads value 1
  20. *
  21. */
  22. struct koneplus_control {
  23. uint8_t command; /* KONEPLUS_COMMAND_CONTROL */
  24. /*
  25. * value is profile number in range 0-4 for requesting settings and buttons
  26. * 1 if status ok for requesting status
  27. */
  28. uint8_t value;
  29. uint8_t request;
  30. } __attribute__ ((__packed__));
  31. enum koneplus_control_requests {
  32. KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
  33. KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
  34. KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
  35. };
  36. enum koneplus_control_values {
  37. KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0,
  38. KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1,
  39. KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,
  40. };
  41. struct koneplus_actual_profile {
  42. uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
  43. uint8_t size; /* always 3 */
  44. uint8_t actual_profile; /* Range 0-4! */
  45. } __attribute__ ((__packed__));
  46. struct koneplus_profile_settings {
  47. uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
  48. uint8_t size; /* always 43 */
  49. uint8_t number; /* range 0-4 */
  50. uint8_t advanced_sensitivity;
  51. uint8_t sensitivity_x;
  52. uint8_t sensitivity_y;
  53. uint8_t cpi_levels_enabled;
  54. uint8_t cpi_levels_x[5];
  55. uint8_t cpi_startup_level; /* range 0-4 */
  56. uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
  57. uint8_t unknown1;
  58. uint8_t polling_rate;
  59. uint8_t lights_enabled;
  60. uint8_t light_effect_mode;
  61. uint8_t color_flow_effect;
  62. uint8_t light_effect_type;
  63. uint8_t light_effect_speed;
  64. uint8_t lights[16];
  65. uint16_t checksum;
  66. } __attribute__ ((__packed__));
  67. struct koneplus_profile_buttons {
  68. uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
  69. uint8_t size; /* always 77 */
  70. uint8_t number; /* range 0-4 */
  71. uint8_t data[72];
  72. uint16_t checksum;
  73. } __attribute__ ((__packed__));
  74. struct koneplus_macro {
  75. uint8_t command; /* KONEPLUS_COMMAND_MACRO */
  76. uint16_t size; /* always 0x822 little endian */
  77. uint8_t profile; /* range 0-4 */
  78. uint8_t button; /* range 0-23 */
  79. uint8_t data[2075];
  80. uint16_t checksum;
  81. } __attribute__ ((__packed__));
  82. struct koneplus_info {
  83. uint8_t command; /* KONEPLUS_COMMAND_INFO */
  84. uint8_t size; /* always 6 */
  85. uint8_t firmware_version;
  86. uint8_t unknown[3];
  87. } __attribute__ ((__packed__));
  88. struct koneplus_e {
  89. uint8_t command; /* KONEPLUS_COMMAND_E */
  90. uint8_t size; /* always 3 */
  91. uint8_t unknown; /* TODO 1; 0 before firmware update */
  92. } __attribute__ ((__packed__));
  93. struct koneplus_sensor {
  94. uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
  95. uint8_t size; /* always 6 */
  96. uint8_t data[4];
  97. } __attribute__ ((__packed__));
  98. struct koneplus_firmware_write {
  99. uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
  100. uint8_t unknown[1025];
  101. } __attribute__ ((__packed__));
  102. struct koneplus_firmware_write_control {
  103. uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
  104. /*
  105. * value is 1 on success
  106. * 3 means "not finished yet"
  107. */
  108. uint8_t value;
  109. uint8_t unknown; /* always 0x75 */
  110. } __attribute__ ((__packed__));
  111. struct koneplus_tcu {
  112. uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
  113. uint8_t data[2];
  114. } __attribute__ ((__packed__));
  115. struct koneplus_tcu_image {
  116. uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
  117. uint8_t data[1024];
  118. uint16_t checksum;
  119. } __attribute__ ((__packed__));
  120. enum koneplus_commands {
  121. KONEPLUS_COMMAND_CONTROL = 0x4,
  122. KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
  123. KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
  124. KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
  125. KONEPLUS_COMMAND_MACRO = 0x8,
  126. KONEPLUS_COMMAND_INFO = 0x9,
  127. KONEPLUS_COMMAND_TCU = 0xc,
  128. KONEPLUS_COMMAND_E = 0xe,
  129. KONEPLUS_COMMAND_SENSOR = 0xf,
  130. KONEPLUS_COMMAND_TALK = 0x10,
  131. KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
  132. KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
  133. };
  134. enum koneplus_mouse_report_numbers {
  135. KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
  136. KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
  137. KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
  138. };
  139. struct koneplus_mouse_report_button {
  140. uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
  141. uint8_t zero1;
  142. uint8_t type;
  143. uint8_t data1;
  144. uint8_t data2;
  145. uint8_t zero2;
  146. uint8_t unknown[2];
  147. } __attribute__ ((__packed__));
  148. enum koneplus_mouse_report_button_types {
  149. /* data1 = new profile range 1-5 */
  150. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
  151. /* data1 = button number range 1-24; data2 = action */
  152. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
  153. /* data1 = button number range 1-24; data2 = action */
  154. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
  155. /* data1 = setting number range 1-5 */
  156. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
  157. /* data1 and data2 = range 0x1-0xb */
  158. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
  159. /* data1 = 22 = next track...
  160. * data2 = action
  161. */
  162. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
  163. KONEPLUS_MOUSE_REPORT_TALK = 0xff,
  164. };
  165. enum koneplus_mouse_report_button_action {
  166. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
  167. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
  168. };
  169. struct koneplus_roccat_report {
  170. uint8_t type;
  171. uint8_t data1;
  172. uint8_t data2;
  173. uint8_t profile;
  174. } __attribute__ ((__packed__));
  175. struct koneplus_device {
  176. int actual_profile;
  177. int roccat_claimed;
  178. int chrdev_minor;
  179. struct mutex koneplus_lock;
  180. struct koneplus_info info;
  181. struct koneplus_profile_settings profile_settings[5];
  182. struct koneplus_profile_buttons profile_buttons[5];
  183. };
  184. #endif