diff --git a/hidapi/hidapi.h b/hidapi/hidapi.h index 744ceb0..095b1b5 100644 --- a/hidapi/hidapi.h +++ b/hidapi/hidapi.h @@ -617,6 +617,14 @@ extern "C" { */ HID_API_EXPORT const char* HID_API_CALL hid_version_str(void); +#ifdef __APPLE__ + /** RPCS3 EDIT: Initializes a USB Sixaxis/DualShock 3 controller, + * which requires report_id to be separate from the data packet. + * Required on macOS Monterey. + */ + int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev); +#endif + #ifdef __cplusplus } #endif diff --git a/mac/hid.c b/mac/hid.c index 5c0914a..d9d99ca 100644 --- a/mac/hid.c +++ b/mac/hid.c @@ -1549,3 +1549,16 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev) return L"Success"; return last_global_error_str; } + +int HID_API_EXPORT hid_init_sixaxis_usb(hid_device *dev) +{ + const char data[] = { 0x42, 0x0C, 0x00, 0x00 }; + size_t length = sizeof(data); + const unsigned char report_id = 0xF4; + + if (IOHIDDeviceSetReport(dev->device_handle, kIOHIDReportTypeFeature, report_id, data, length) == kIOReturnSuccess) { + return length; + } + + return -1; +}