hid-roccat-isku.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #ifndef __HID_ROCCAT_ISKU_H
  2. #define __HID_ROCCAT_ISKU_H
  3. /*
  4. * Copyright (c) 2011 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. ISKU_PROFILE_NUM = 5,
  15. ISKU_USB_INTERFACE_PROTOCOL = 0,
  16. };
  17. struct isku_control {
  18. uint8_t command; /* ISKU_COMMAND_CONTROL */
  19. uint8_t value;
  20. uint8_t request;
  21. } __packed;
  22. enum isku_control_values {
  23. ISKU_CONTROL_VALUE_STATUS_OVERLOAD = 0,
  24. ISKU_CONTROL_VALUE_STATUS_OK = 1,
  25. ISKU_CONTROL_VALUE_STATUS_INVALID = 2,
  26. ISKU_CONTROL_VALUE_STATUS_WAIT = 3,
  27. };
  28. struct isku_actual_profile {
  29. uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */
  30. uint8_t size; /* always 3 */
  31. uint8_t actual_profile;
  32. } __packed;
  33. struct isku_key_mask {
  34. uint8_t command; /* ISKU_COMMAND_KEY_MASK */
  35. uint8_t size; /* 6 */
  36. uint8_t profile_number; /* 0-4 */
  37. uint8_t mask;
  38. uint16_t checksum;
  39. } __packed;
  40. struct isku_keys_function {
  41. uint8_t data[0x29];
  42. } __packed;
  43. struct isku_keys_easyzone {
  44. uint8_t data[0x41];
  45. } __packed;
  46. struct isku_keys_media {
  47. uint8_t data[0x1d];
  48. } __packed;
  49. struct isku_keys_thumbster {
  50. uint8_t data[0x17];
  51. } __packed;
  52. struct isku_keys_macro {
  53. uint8_t data[0x23];
  54. } __packed;
  55. struct isku_keys_capslock {
  56. uint8_t data[0x6];
  57. } __packed;
  58. struct isku_macro {
  59. uint8_t data[0x823];
  60. } __packed;
  61. struct isku_light {
  62. uint8_t data[0xa];
  63. } __packed;
  64. struct isku_info {
  65. uint8_t data[2];
  66. uint8_t firmware_version;
  67. uint8_t unknown[3];
  68. } __packed;
  69. struct isku_talk {
  70. uint8_t data[0x10];
  71. } __packed;
  72. struct isku_last_set {
  73. uint8_t data[0x14];
  74. } __packed;
  75. enum isku_commands {
  76. ISKU_COMMAND_CONTROL = 0x4,
  77. ISKU_COMMAND_ACTUAL_PROFILE = 0x5,
  78. ISKU_COMMAND_KEY_MASK = 0x7,
  79. ISKU_COMMAND_KEYS_FUNCTION = 0x8,
  80. ISKU_COMMAND_KEYS_EASYZONE = 0x9,
  81. ISKU_COMMAND_KEYS_MEDIA = 0xa,
  82. ISKU_COMMAND_KEYS_THUMBSTER = 0xb,
  83. ISKU_COMMAND_KEYS_MACRO = 0xd,
  84. ISKU_COMMAND_MACRO = 0xe,
  85. ISKU_COMMAND_INFO = 0xf,
  86. ISKU_COMMAND_LIGHT = 0x10,
  87. ISKU_COMMAND_KEYS_CAPSLOCK = 0x13,
  88. ISKU_COMMAND_LAST_SET = 0x14,
  89. ISKU_COMMAND_15 = 0x15,
  90. ISKU_COMMAND_TALK = 0x16,
  91. ISKU_COMMAND_FIRMWARE_WRITE = 0x1b,
  92. ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
  93. };
  94. struct isku_report_button {
  95. uint8_t number; /* ISKU_REPORT_NUMBER_BUTTON */
  96. uint8_t zero;
  97. uint8_t event;
  98. uint8_t data1;
  99. uint8_t data2;
  100. };
  101. enum isku_report_numbers {
  102. ISKU_REPORT_NUMBER_BUTTON = 3,
  103. };
  104. enum isku_report_button_events {
  105. ISKU_REPORT_BUTTON_EVENT_PROFILE = 0x2,
  106. };
  107. struct isku_roccat_report {
  108. uint8_t event;
  109. uint8_t data1;
  110. uint8_t data2;
  111. uint8_t profile;
  112. } __packed;
  113. struct isku_device {
  114. int roccat_claimed;
  115. int chrdev_minor;
  116. struct mutex isku_lock;
  117. int actual_profile;
  118. };
  119. #endif