Skip to content

Commit d833683

Browse files
rbarazzuttiQbicz
authored andcommitted
mac: fix behaviour of hid_get_feature_report (was writing on the report id byte) and return value was not right)
1 parent f7ee9cc commit d833683

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mac/hid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ int HID_API_EXPORT hid_send_feature_report(hid_device *dev, const unsigned char
941941

942942
int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length)
943943
{
944-
CFIndex len = length;
944+
CFIndex len = length - 1;
945945
IOReturn res;
946946

947947
/* Return if the device has been unplugged. */
@@ -951,9 +951,9 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
951951
res = IOHIDDeviceGetReport(dev->device_handle,
952952
kIOHIDReportTypeFeature,
953953
data[0], /* Report ID */
954-
data, &len);
954+
data + 1, &len);
955955
if (res == kIOReturnSuccess)
956-
return len;
956+
return len + 1;
957957
else
958958
return -1;
959959
}

0 commit comments

Comments
 (0)