|
@@ -173,6 +173,10 @@ struct hid_device_ {
|
|
|
int transfer_loop_finished;
|
|
|
struct libusb_transfer *transfer;
|
|
|
|
|
|
+ /* Quirks */
|
|
|
+ int skip_output_report_id;
|
|
|
+ int no_output_reports_on_intr_ep;
|
|
|
+
|
|
|
/* List of received input reports. */
|
|
|
struct input_report *input_reports;
|
|
|
};
|
|
@@ -1144,6 +1148,19 @@ static void init_xboxone(libusb_device_handle *device_handle, unsigned short idV
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void calculate_device_quirks(hid_device *dev, unsigned short idVendor, unsigned short idProduct)
|
|
|
+{
|
|
|
+ static const int VENDOR_SONY = 0x054c;
|
|
|
+ static const int PRODUCT_PS3_CONTROLLER = 0x0268;
|
|
|
+ static const int PRODUCT_NAVIGATION_CONTROLLER = 0x042f;
|
|
|
+
|
|
|
+ if (idVendor == VENDOR_SONY &&
|
|
|
+ (idProduct == PRODUCT_PS3_CONTROLLER || idProduct == PRODUCT_NAVIGATION_CONTROLLER)) {
|
|
|
+ dev->skip_output_report_id = 1;
|
|
|
+ dev->no_output_reports_on_intr_ep = 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
|
|
{
|
|
|
hid_device *dev = NULL;
|
|
@@ -1269,6 +1286,8 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ calculate_device_quirks(dev, desc.idVendor, desc.idProduct);
|
|
|
+
|
|
|
dev->thread = SDL_CreateThread(read_thread, NULL, dev);
|
|
|
|
|
|
/* Wait here for the read thread to be initialized. */
|
|
@@ -1301,11 +1320,11 @@ int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t
|
|
|
{
|
|
|
int res;
|
|
|
|
|
|
- if (dev->output_endpoint <= 0) {
|
|
|
+ if (dev->output_endpoint <= 0 || dev->no_output_reports_on_intr_ep) {
|
|
|
int report_number = data[0];
|
|
|
int skipped_report_id = 0;
|
|
|
|
|
|
- if (report_number == 0x0) {
|
|
|
+ if (report_number == 0x0 || dev->skip_output_report_id) {
|
|
|
data++;
|
|
|
length--;
|
|
|
skipped_report_id = 1;
|