hidapi icon indicating copy to clipboard operation
hidapi copied to clipboard

mac: fix behaviour of hid_get_feature_report

Open rbarazzutti opened this issue 10 years ago • 7 comments

This fix is quite important for the Mac platform, since the behaviour of hid_get_feature_report was not following the specs.

rbarazzutti avatar Apr 08 '15 00:04 rbarazzutti

Hello Alan,

I'm pretty happy to see that you're carefully checking patches submissions.

I agree Apple docs are kinda horrible. I double checked my fix and tested it on OSX 10.10.

Keep me posted,

Raphaël

rbarazzutti avatar Apr 09 '15 21:04 rbarazzutti

What is the status of this PR? It's currently being applied in the Homebrew formula, but it's not clear that upstream agrees with the change, in which case we would probably want to remove it from the formula.

ilovezfs avatar Aug 18 '16 22:08 ilovezfs

+1 on this. For psmoveapi and PSMoveService this is a problem. The number of bytes returned by hid_get_feature_report is different on Windows than it is on Mac. According to your API doc strings, the Windows version is returning the correct number of bytes but the Mac version returns one less.

However, it's not entirely so straightforward. The PSMove can be connected via bluetooth or USB. All of the BT feature reports behave as described above. At least one of the USB feature reports does not, where the first byte no longer contains the report id. I'll have to investigate this further.

cboulay avatar Dec 01 '16 14:12 cboulay

@signal11 ping on this PR

ilovezfs avatar Apr 28 '17 16:04 ilovezfs

Also confirming that on the current master branch does not match the documentation on macOS 10.12. The first byte returned is not the report id, even when the report id is requested and the length is off by one.

bakercp avatar Jun 30 '17 01:06 bakercp

This behaviour in master on OSX 10.14 is still incorrect, and differs from the Linux version.

The work-around I have is to explicitly set a non-zero report ID (by setting the 0th byte in the buffer to something other than 0).

In this case the Linux and OSX APIs will return the same result, but it does mean that the commands sent to the device change. There don't appear to be any negative side-effects for the device I'm working with, but this may be problematic for others.

Update (2019-08-11):

micolous avatar Nov 09 '18 13:11 micolous

@rbarazzutti do you happen to remember, have you been using numbered reports or not?

as far as I can tell from the original message of @micolous (9 Nov 2018) - Report ID is his case was zero (no numbered reports)

Youw avatar Aug 11 '19 19:08 Youw