hid-roccat-kovaplus.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #ifndef __HID_ROCCAT_KOVAPLUS_H
  2. #define __HID_ROCCAT_KOVAPLUS_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 kovaplus_control {
  14. uint8_t command; /* KOVAPLUS_COMMAND_CONTROL */
  15. uint8_t value;
  16. uint8_t request;
  17. } __packed;
  18. enum kovaplus_control_requests {
  19. /* read after write; value = 1 */
  20. KOVAPLUS_CONTROL_REQUEST_STATUS = 0x0,
  21. /* write; value = profile number range 0-4 */
  22. KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
  23. /* write; value = profile number range 0-4 */
  24. KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20,
  25. };
  26. enum kovaplus_control_values {
  27. KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0, /* supposed */
  28. KOVAPLUS_CONTROL_REQUEST_STATUS_OK = 1,
  29. KOVAPLUS_CONTROL_REQUEST_STATUS_WAIT = 3, /* supposed */
  30. };
  31. struct kovaplus_actual_profile {
  32. uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */
  33. uint8_t size; /* always 3 */
  34. uint8_t actual_profile; /* Range 0-4! */
  35. } __packed;
  36. struct kovaplus_profile_settings {
  37. uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_SETTINGS */
  38. uint8_t size; /* 16 */
  39. uint8_t profile_index; /* range 0-4 */
  40. uint8_t unknown1;
  41. uint8_t sensitivity_x; /* range 1-10 */
  42. uint8_t sensitivity_y; /* range 1-10 */
  43. uint8_t cpi_levels_enabled;
  44. uint8_t cpi_startup_level; /* range 1-4 */
  45. uint8_t data[8];
  46. } __packed;
  47. struct kovaplus_profile_buttons {
  48. uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_BUTTONS */
  49. uint8_t size; /* 23 */
  50. uint8_t profile_index; /* range 0-4 */
  51. uint8_t data[20];
  52. } __packed;
  53. struct kovaplus_info {
  54. uint8_t command; /* KOVAPLUS_COMMAND_INFO */
  55. uint8_t size; /* 6 */
  56. uint8_t firmware_version;
  57. uint8_t unknown[3];
  58. } __packed;
  59. /* writes 1 on plugin */
  60. struct kovaplus_a {
  61. uint8_t command; /* KOVAPLUS_COMMAND_A */
  62. uint8_t size; /* 3 */
  63. uint8_t unknown;
  64. } __packed;
  65. enum kovaplus_commands {
  66. KOVAPLUS_COMMAND_CONTROL = 0x4,
  67. KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
  68. KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
  69. KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
  70. KOVAPLUS_COMMAND_INFO = 0x9,
  71. KOVAPLUS_COMMAND_A = 0xa,
  72. };
  73. enum kovaplus_usb_commands {
  74. KOVAPLUS_USB_COMMAND_CONTROL = 0x304,
  75. KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
  76. KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
  77. KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
  78. KOVAPLUS_USB_COMMAND_INFO = 0x309,
  79. KOVAPLUS_USB_COMMAND_A = 0x30a,
  80. };
  81. enum kovaplus_mouse_report_numbers {
  82. KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1,
  83. KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
  84. KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
  85. KOVAPLUS_MOUSE_REPORT_NUMBER_KBD = 4,
  86. };
  87. struct kovaplus_mouse_report_button {
  88. uint8_t report_number; /* KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON */
  89. uint8_t unknown1;
  90. uint8_t type;
  91. uint8_t data1;
  92. uint8_t data2;
  93. } __packed;
  94. enum kovaplus_mouse_report_button_types {
  95. /* data1 = profile_number range 1-5; no release event */
  96. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1 = 0x20,
  97. /* data1 = profile_number range 1-5; no release event */
  98. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2 = 0x30,
  99. /* data1 = button_number range 1-18; data2 = action */
  100. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MACRO = 0x40,
  101. /* data1 = button_number range 1-18; data2 = action */
  102. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SHORTCUT = 0x50,
  103. /* data1 = button_number range 1-18; data2 = action */
  104. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
  105. /* data1 = button_number range 1-18; data2 = action */
  106. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
  107. /* data1 = 1 = 400, 2 = 800, 4 = 1600, 7 = 3200; no release event */
  108. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
  109. /* data1 + data2 = sense range 1-10; no release event */
  110. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
  111. /* data1 = type as in profile_buttons; data2 = action */
  112. KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
  113. };
  114. enum kovaplus_mouse_report_button_actions {
  115. KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
  116. KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
  117. };
  118. struct kovaplus_roccat_report {
  119. uint8_t type;
  120. uint8_t profile;
  121. uint8_t button;
  122. uint8_t data1;
  123. uint8_t data2;
  124. } __packed;
  125. struct kovaplus_device {
  126. int actual_profile;
  127. int actual_cpi;
  128. int actual_x_sensitivity;
  129. int actual_y_sensitivity;
  130. int roccat_claimed;
  131. int chrdev_minor;
  132. struct mutex kovaplus_lock;
  133. struct kovaplus_info info;
  134. struct kovaplus_profile_settings profile_settings[5];
  135. struct kovaplus_profile_buttons profile_buttons[5];
  136. };
  137. #endif