hid-roccat-pyra.h 4.0 KB

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