From 55a7cacfa94ba32ead7efc563b8c4970115b3ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20P=2E=20Barazzutti?= Date: Wed, 8 Apr 2015 01:15:08 +0200 Subject: [PATCH] mac: fix behaviour of hid_get_feature_report (was writing on the report id byte) and return value was not right) --- mac/hid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mac/hid.c b/mac/hid.c index 38bb635a..bc1ca366 100644 --- a/mac/hid.c +++ b/mac/hid.c @@ -948,7 +948,7 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length) { - CFIndex len = length; + CFIndex len = length - 1; IOReturn res; /* Return if the device has been unplugged. */ @@ -958,9 +958,9 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, res = IOHIDDeviceGetReport(dev->device_handle, kIOHIDReportTypeFeature, data[0], /* Report ID */ - data, &len); + data + 1, &len); if (res == kIOReturnSuccess) - return len; + return len + 1; else return -1; }