|
81 | 81 | #define MAP_TRIGGERS_TO_BUTTONS (1 << 1)
|
82 | 82 | #define MAP_STICKS_TO_NULL (1 << 2)
|
83 | 83 | #define MAP_SELECT_BUTTON (1 << 3)
|
84 |
| -#define MAP_PADDLES (1 << 4) |
| 84 | +#define MAP_PADDLES (1 << 4) |
| 85 | +#define MAP_PROFILE_BUTTON (1 << 5) |
| 86 | + |
85 | 87 | #define DANCEPAD_MAP_CONFIG (MAP_DPAD_TO_BUTTONS | \
|
86 | 88 | MAP_TRIGGERS_TO_BUTTONS | MAP_STICKS_TO_NULL)
|
87 | 89 |
|
@@ -148,7 +150,7 @@ static const struct xpad_device {
|
148 | 150 | { 0x045e, 0x0b00, "Microsoft X-Box One Elite 2 pad", MAP_PADDLES, XTYPE_XBOXONE },
|
149 | 151 | { 0x045e, 0x02ea, "Microsoft X-Box One S pad", 0, XTYPE_XBOXONE },
|
150 | 152 | { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
|
151 |
| - { 0x045e, 0x0b0a, "Microsoft X-Box Adaptive Controller", 0, XTYPE_XBOXONE }, |
| 153 | + { 0x045e, 0x0b0a, "Microsoft X-Box Adaptive Controller", MAP_PROFILE_BUTTON, XTYPE_XBOXONE }, |
152 | 154 | { 0x045e, 0x0b12, "Microsoft Xbox Series S|X Controller", MAP_SELECT_BUTTON, XTYPE_XBOXONE },
|
153 | 155 | { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
|
154 | 156 | { 0x046d, 0xc21e, "Logitech Gamepad F510", 0, XTYPE_XBOX360 },
|
@@ -777,6 +779,10 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
|
777 | 779 | input_report_key(dev, BTN_C, data[8]);
|
778 | 780 | input_report_key(dev, BTN_Z, data[9]);
|
779 | 781 |
|
| 782 | + /* Profile button has a value of 0-3, so it is reported as an axis */ |
| 783 | + if (xpad->mapping & MAP_PROFILE_BUTTON) |
| 784 | + input_report_abs(dev, ABS_PROFILE, data[34]); |
| 785 | + |
780 | 786 | input_sync(dev);
|
781 | 787 | }
|
782 | 788 |
|
@@ -1800,6 +1806,9 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
|
1800 | 1806 | case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */
|
1801 | 1807 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0);
|
1802 | 1808 | break;
|
| 1809 | + case ABS_PROFILE: /* 4 value profile button (such as on XAC) */ |
| 1810 | + input_set_abs_params(input_dev, abs, 0, 4, 0, 0); |
| 1811 | + break; |
1803 | 1812 | default:
|
1804 | 1813 | input_set_abs_params(input_dev, abs, 0, 0, 0, 0);
|
1805 | 1814 | break;
|
@@ -1898,6 +1907,10 @@ static int xpad_init_input(struct usb_xpad *xpad)
|
1898 | 1907 | xpad_set_up_abs(input_dev, xpad_abs_triggers[i]);
|
1899 | 1908 | }
|
1900 | 1909 |
|
| 1910 | + /* setup profile button as an axis with 4 possible values */ |
| 1911 | + if (xpad->mapping & MAP_PROFILE_BUTTON) |
| 1912 | + xpad_set_up_abs(input_dev, ABS_PROFILE); |
| 1913 | + |
1901 | 1914 | error = xpad_init_ff(xpad);
|
1902 | 1915 | if (error)
|
1903 | 1916 | goto err_free_input;
|
|
0 commit comments