diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2016-07-01 00:11:30 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2016-07-01 00:11:30 +0300 |
commit | 604e5b24aeeabde606c87b53688bb97b60fd7e43 (patch) | |
tree | ce68f2b5fc9058a08018e9023be77cebfd9ed3a4 | |
parent | b18348c76a5caaa45cb0002e1f9a88b474f408ce (diff) |
Support for Linux workaround
-rw-r--r-- | Descriptors.c | 16 | ||||
-rw-r--r-- | Descriptors.h | 6 | ||||
-rw-r--r-- | defines.h | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/Descriptors.c b/Descriptors.c index 8179fb2..092f6dc 100644 --- a/Descriptors.c +++ b/Descriptors.c @@ -35,6 +35,7 @@ * the device's capabilities and functions. */ +#include "defines.h" #include "Descriptors.h" /** HID class report descriptor. This is a special descriptor constructed with values from the @@ -46,10 +47,17 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = { - HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 8, 1), - HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 8, 2), - HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 4, 3), - HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 4, 4) +#ifndef LINUX_WORKAROUND + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x30, 0x31, 8, 1), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x30, 0x31, 8, 2), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x30, 0x31, 4, 3), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x30, 0x31, 4, 4) +#else + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x30, 0x31, 8, 1), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x32, 0x33, 8, 2), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x34, 0x35, 4, 3), + HID_DESCRIPTOR_JOYSTICK_MY(-100, 100, -1, 1, 0x36, 0x37, 4, 4) +#endif }; /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall diff --git a/Descriptors.h b/Descriptors.h index 475e7b6..5b76354 100644 --- a/Descriptors.h +++ b/Descriptors.h @@ -90,15 +90,15 @@ ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); -#define HID_DESCRIPTOR_JOYSTICK_MY(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, ReportId) \ +#define HID_DESCRIPTOR_JOYSTICK_MY(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, AxisAtype, AxisBtype, Buttons, ReportId) \ HID_RI_USAGE_PAGE(8, 0x01), \ HID_RI_USAGE(8, 0x04), \ HID_RI_COLLECTION(8, 0x01), \ HID_RI_REPORT_ID(8, ReportId), \ HID_RI_USAGE(8, 0x01), \ HID_RI_COLLECTION(8, 0x00), \ - HID_RI_USAGE(8, 0x30), \ - HID_RI_USAGE(8, 0x31), \ + HID_RI_USAGE(8, AxisAtype), \ + HID_RI_USAGE(8, AxisBtype), \ HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \ HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \ HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \ @@ -28,3 +28,5 @@ #define LED_PORT B #define LED_RED_PIN 6 #define LED_GREEN_PIN 7 + +//#define LINUX_WORKAROUND |