From 23ceae94c958418b6584a804c34b94eee2774d60 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 25 Oct 2023 14:50:07 -0700
Subject: [PATCH] Fixed Xbox 360 Controller support using libusb on Linux
---
src/hidapi/libusb/hid.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c
index e15bf319c097..3cdb891020bb 100644
--- a/src/hidapi/libusb/hid.c
+++ b/src/hidapi/libusb/hid.c
@@ -123,6 +123,7 @@ struct hid_device_ {
/* Quirks */
int skip_output_report_id;
+ int no_skip_output_report_id;
int no_output_reports_on_intr_ep;
/* List of received input reports. */
@@ -1347,6 +1348,7 @@ static int hidapi_initialize_device(hid_device *dev, const struct libusb_interfa
/* Initialize XBox 360 controllers */
if (is_xbox360(desc.idVendor, intf_desc)) {
+ dev->no_skip_output_report_id = 1;
init_xbox360(dev->device_handle, desc.idVendor, desc.idProduct, conf_desc);
}
@@ -1572,7 +1574,7 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
report_number = data[0];
- if (report_number == 0x0 || dev->skip_output_report_id) {
+ if ((!dev->no_skip_output_report_id && report_number == 0x0) || dev->skip_output_report_id) {
data++;
length--;
skipped_report_id = 1;