hid-roccat-koneplus.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef __HID_ROCCAT_KONEPLUS_H
  2. #define __HID_ROCCAT_KONEPLUS_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. KONEPLUS_SIZE_ACTUAL_PROFILE = 0x03,
  15. KONEPLUS_SIZE_CONTROL = 0x03,
  16. KONEPLUS_SIZE_FIRMWARE_WRITE = 0x0402,
  17. KONEPLUS_SIZE_INFO = 0x06,
  18. KONEPLUS_SIZE_MACRO = 0x0822,
  19. KONEPLUS_SIZE_PROFILE_SETTINGS = 0x2b,
  20. KONEPLUS_SIZE_PROFILE_BUTTONS = 0x4d,
  21. KONEPLUS_SIZE_SENSOR = 0x06,
  22. KONEPLUS_SIZE_TALK = 0x10,
  23. KONEPLUS_SIZE_TCU = 0x04,
  24. KONEPLUS_SIZE_TCU_IMAGE = 0x0404,
  25. };
  26. enum koneplus_control_requests {
  27. KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
  28. KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
  29. };
  30. struct koneplus_actual_profile {
  31. uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
  32. uint8_t size; /* always 3 */
  33. uint8_t actual_profile; /* Range 0-4! */
  34. } __attribute__ ((__packed__));
  35. struct koneplus_info {
  36. uint8_t command; /* KONEPLUS_COMMAND_INFO */
  37. uint8_t size; /* always 6 */
  38. uint8_t firmware_version;
  39. uint8_t unknown[3];
  40. } __attribute__ ((__packed__));
  41. enum koneplus_commands {
  42. KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
  43. KONEPLUS_COMMAND_CONTROL = 0x4,
  44. KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
  45. KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
  46. KONEPLUS_COMMAND_MACRO = 0x8,
  47. KONEPLUS_COMMAND_INFO = 0x9,
  48. KONEPLUS_COMMAND_TCU = 0xc,
  49. KONEPLUS_COMMAND_TCU_IMAGE = 0xc,
  50. KONEPLUS_COMMAND_E = 0xe,
  51. KONEPLUS_COMMAND_SENSOR = 0xf,
  52. KONEPLUS_COMMAND_TALK = 0x10,
  53. KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
  54. KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
  55. };
  56. enum koneplus_mouse_report_numbers {
  57. KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
  58. KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
  59. KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
  60. };
  61. struct koneplus_mouse_report_button {
  62. uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
  63. uint8_t zero1;
  64. uint8_t type;
  65. uint8_t data1;
  66. uint8_t data2;
  67. uint8_t zero2;
  68. uint8_t unknown[2];
  69. } __attribute__ ((__packed__));
  70. enum koneplus_mouse_report_button_types {
  71. /* data1 = new profile range 1-5 */
  72. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
  73. /* data1 = button number range 1-24; data2 = action */
  74. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
  75. /* data1 = button number range 1-24; data2 = action */
  76. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
  77. /* data1 = setting number range 1-5 */
  78. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
  79. /* data1 and data2 = range 0x1-0xb */
  80. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
  81. /* data1 = 22 = next track...
  82. * data2 = action
  83. */
  84. KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
  85. KONEPLUS_MOUSE_REPORT_TALK = 0xff,
  86. };
  87. enum koneplus_mouse_report_button_action {
  88. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
  89. KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
  90. };
  91. struct koneplus_roccat_report {
  92. uint8_t type;
  93. uint8_t data1;
  94. uint8_t data2;
  95. uint8_t profile;
  96. } __attribute__ ((__packed__));
  97. struct koneplus_device {
  98. int actual_profile;
  99. int roccat_claimed;
  100. int chrdev_minor;
  101. struct mutex koneplus_lock;
  102. };
  103. #endif