hid-roccat-koneplus.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. enum koneplus_control_requests {
  19. KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
  20. KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
  21. };
  22. struct koneplus_actual_profile {
  23. uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
  24. uint8_t size; /* always 3 */
  25. uint8_t actual_profile; /* Range 0-4! */
  26. } __attribute__ ((__packed__));
  27. struct koneplus_profile_settings {
  28. uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
  29. uint8_t size; /* always 43 */
  30. uint8_t number; /* range 0-4 */
  31. uint8_t advanced_sensitivity;
  32. uint8_t sensitivity_x;
  33. uint8_t sensitivity_y;
  34. uint8_t cpi_levels_enabled;
  35. uint8_t cpi_levels_x[5];
  36. uint8_t cpi_startup_level; /* range 0-4 */
  37. uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
  38. uint8_t unknown1;
  39. uint8_t polling_rate;
  40. uint8_t lights_enabled;
  41. uint8_t light_effect_mode;
  42. uint8_t color_flow_effect;
  43. uint8_t light_effect_type;
  44. uint8_t light_effect_speed;
  45. uint8_t lights[16];
  46. uint16_t checksum;
  47. } __attribute__ ((__packed__));
  48. struct koneplus_profile_buttons {
  49. uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
  50. uint8_t size; /* always 77 */
  51. uint8_t number; /* range 0-4 */
  52. uint8_t data[72];
  53. uint16_t checksum;
  54. } __attribute__ ((__packed__));
  55. struct koneplus_macro {
  56. uint8_t command; /* KONEPLUS_COMMAND_MACRO */
  57. uint16_t size; /* always 0x822 little endian */
  58. uint8_t profile; /* range 0-4 */
  59. uint8_t button; /* range 0-23 */
  60. uint8_t data[2075];
  61. uint16_t checksum;
  62. } __attribute__ ((__packed__));
  63. struct koneplus_info {
  64. uint8_t command; /* KONEPLUS_COMMAND_INFO */
  65. uint8_t size; /* always 6 */
  66. uint8_t firmware_version;
  67. uint8_t unknown[3];
  68. } __attribute__ ((__packed__));
  69. struct koneplus_e {
  70. uint8_t command; /* KONEPLUS_COMMAND_E */
  71. uint8_t size; /* always 3 */
  72. uint8_t unknown; /* TODO 1; 0 before firmware update */
  73. } __attribute__ ((__packed__));
  74. struct koneplus_sensor {
  75. uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
  76. uint8_t size; /* always 6 */
  77. uint8_t data[4];
  78. } __attribute__ ((__packed__));
  79. struct koneplus_firmware_write {
  80. uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
  81. uint8_t unknown[1025];
  82. } __attribute__ ((__packed__));
  83. struct koneplus_firmware_write_control {
  84. uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
  85. /*
  86. * value is 1 on success
  87. * 3 means "not finished yet"
  88. */
  89. uint8_t value;
  90. uint8_t unknown; /* always 0x75 */
  91. } __attribute__ ((__packed__));
  92. struct koneplus_tcu {
  93. uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
  94. uint8_t data[2];
  95. } __attribute__ ((__packed__));
  96. struct koneplus_tcu_image {
  97. uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
  98. uint8_t data[1024];
  99. uint16_t checksum;
  100. } __attribute__ ((__packed__));
  101. enum koneplus_commands {
  102. KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
  103. KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
  104. KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
  105. KONEPLUS_COMMAND_MACRO = 0x8,
  106. KONEPLUS_COMMAND_INFO = 0x9,
  107. KONEPLUS_COMMAND_TCU = 0xc,
  108. KONEPLUS_COMMAND_E = 0xe,
  109. KONEPLUS_COMMAND_SENSOR = 0xf,
  110. KONEPLUS_COMMAND_TALK = 0x10,
  111. KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
  112. KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
  113. };
  114. enum koneplus_mouse_report_numbers {
  115. KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
  116. KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
  117. KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
  118. };
  119. struct koneplus_mouse_report_button {
  120. uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
  121. uint8_t zero1;
  122. uint8_t type;
  123. uint8_t data1;
  124. uint8_t data2;
  125. uint8_t zero2;
  126. uint8_t unknown[2];
  127. } __attribute__ ((__packed__));
  128. enum koneplus_mouse_report_button_types {
  129. /* data1 = new profile range 1-5 */
  130. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
  131. /* data1 = button number range 1-24; data2 = action */
  132. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
  133. /* data1 = button number range 1-24; data2 = action */
  134. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
  135. /* data1 = setting number range 1-5 */
  136. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
  137. /* data1 and data2 = range 0x1-0xb */
  138. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
  139. /* data1 = 22 = next track...
  140. * data2 = action
  141. */
  142. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
  143. KONEPLUS_MOUSE_REPORT_TALK = 0xff,
  144. };
  145. enum koneplus_mouse_report_button_action {
  146. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
  147. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
  148. };
  149. struct koneplus_roccat_report {
  150. uint8_t type;
  151. uint8_t data1;
  152. uint8_t data2;
  153. uint8_t profile;
  154. } __attribute__ ((__packed__));
  155. struct koneplus_device {
  156. int actual_profile;
  157. int roccat_claimed;
  158. int chrdev_minor;
  159. struct mutex koneplus_lock;
  160. struct koneplus_info info;
  161. struct koneplus_profile_settings profile_settings[5];
  162. struct koneplus_profile_buttons profile_buttons[5];
  163. };
  164. #endif