hid-roccat-kovaplus.h 3.8 KB

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