hid-roccat-kovaplus.h 3.8 KB

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