hid-roccat-pyra.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __HID_ROCCAT_PYRA_H
  3. #define __HID_ROCCAT_PYRA_H
  4. /*
  5. * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
  6. */
  7. /*
  8. */
  9. #include <linux/types.h>
  10. enum {
  11. PYRA_SIZE_CONTROL = 0x03,
  12. PYRA_SIZE_INFO = 0x06,
  13. PYRA_SIZE_PROFILE_SETTINGS = 0x0d,
  14. PYRA_SIZE_PROFILE_BUTTONS = 0x13,
  15. PYRA_SIZE_SETTINGS = 0x03,
  16. };
  17. enum pyra_control_requests {
  18. PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
  19. PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20
  20. };
  21. struct pyra_settings {
  22. uint8_t command; /* PYRA_COMMAND_SETTINGS */
  23. uint8_t size; /* always 3 */
  24. uint8_t startup_profile; /* Range 0-4! */
  25. } __attribute__ ((__packed__));
  26. struct pyra_profile_settings {
  27. uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */
  28. uint8_t size; /* always 0xd */
  29. uint8_t number; /* Range 0-4 */
  30. uint8_t xysync;
  31. uint8_t x_sensitivity; /* 0x1-0xa */
  32. uint8_t y_sensitivity;
  33. uint8_t x_cpi; /* unused */
  34. uint8_t y_cpi; /* this value is for x and y */
  35. uint8_t lightswitch; /* 0 = off, 1 = on */
  36. uint8_t light_effect;
  37. uint8_t handedness;
  38. uint16_t checksum; /* byte sum */
  39. } __attribute__ ((__packed__));
  40. struct pyra_info {
  41. uint8_t command; /* PYRA_COMMAND_INFO */
  42. uint8_t size; /* always 6 */
  43. uint8_t firmware_version;
  44. uint8_t unknown1; /* always 0 */
  45. uint8_t unknown2; /* always 1 */
  46. uint8_t unknown3; /* always 0 */
  47. } __attribute__ ((__packed__));
  48. enum pyra_commands {
  49. PYRA_COMMAND_CONTROL = 0x4,
  50. PYRA_COMMAND_SETTINGS = 0x5,
  51. PYRA_COMMAND_PROFILE_SETTINGS = 0x6,
  52. PYRA_COMMAND_PROFILE_BUTTONS = 0x7,
  53. PYRA_COMMAND_INFO = 0x9,
  54. PYRA_COMMAND_B = 0xb
  55. };
  56. enum pyra_mouse_report_numbers {
  57. PYRA_MOUSE_REPORT_NUMBER_HID = 1,
  58. PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2,
  59. PYRA_MOUSE_REPORT_NUMBER_BUTTON = 3,
  60. };
  61. struct pyra_mouse_event_button {
  62. uint8_t report_number; /* always 3 */
  63. uint8_t unknown; /* always 0 */
  64. uint8_t type;
  65. uint8_t data1;
  66. uint8_t data2;
  67. } __attribute__ ((__packed__));
  68. struct pyra_mouse_event_audio {
  69. uint8_t report_number; /* always 2 */
  70. uint8_t type;
  71. uint8_t unused; /* always 0 */
  72. } __attribute__ ((__packed__));
  73. /* hid audio controls */
  74. enum pyra_mouse_event_audio_types {
  75. PYRA_MOUSE_EVENT_AUDIO_TYPE_MUTE = 0xe2,
  76. PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_UP = 0xe9,
  77. PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_DOWN = 0xea,
  78. };
  79. enum pyra_mouse_event_button_types {
  80. /*
  81. * Mouse sends tilt events on report_number 1 and 3
  82. * Tilt events are sent repeatedly with 0.94s between first and second
  83. * event and 0.22s on subsequent
  84. */
  85. PYRA_MOUSE_EVENT_BUTTON_TYPE_TILT = 0x10,
  86. /*
  87. * These are sent sequentially
  88. * data1 contains new profile number in range 1-5
  89. */
  90. PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_1 = 0x20,
  91. PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2 = 0x30,
  92. /*
  93. * data1 = button_number (rmp index)
  94. * data2 = pressed/released
  95. */
  96. PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO = 0x40,
  97. PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT = 0x50,
  98. /*
  99. * data1 = button_number (rmp index)
  100. */
  101. PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
  102. /* data1 = new cpi */
  103. PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI = 0xb0,
  104. /* data1 and data2 = new sensitivity */
  105. PYRA_MOUSE_EVENT_BUTTON_TYPE_SENSITIVITY = 0xc0,
  106. PYRA_MOUSE_EVENT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
  107. };
  108. enum {
  109. PYRA_MOUSE_EVENT_BUTTON_PRESS = 0,
  110. PYRA_MOUSE_EVENT_BUTTON_RELEASE = 1,
  111. };
  112. struct pyra_roccat_report {
  113. uint8_t type;
  114. uint8_t value;
  115. uint8_t key;
  116. } __attribute__ ((__packed__));
  117. struct pyra_device {
  118. int actual_profile;
  119. int actual_cpi;
  120. int roccat_claimed;
  121. int chrdev_minor;
  122. struct mutex pyra_lock;
  123. struct pyra_profile_settings profile_settings[5];
  124. };
  125. #endif