hid-roccat-pyra.h 3.7 KB

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