Matching GCController and IOHIDDeviceRef

Hello!

I encountered a problem in my OS X app. I'm using both IOKit HID devices and GameController.framework devices.

Problem is, all GCController devices have HID devices, and I didn't find any way of matching them.


So, here are questions:


1. Is there a way to say "this

IOHIDDeviceRef
device is MFi controller which would be handled by GameController.framework"?

2. This

GCController
and
IOHIDDeviceRef
object refer to same physical controller and I can ignore/blacklist one of them in my code to avoid duplications


N.B.

There is

[GCController deviceRef]
field. In fact it is
IOHIDDeviceRef
, so I can get their
IOHIDDeviceGetService
and then
IORegistryEntryGetRegistryEntryID
to see if they're same connected device.

Problem is -

deviceRef
is a private field. I'm not sure if I can use it when submitting app to App Store

Replies

Wow, 6 years ago and find a post about a current issue.

We are hitting the same issue with an SDL2 based app whereby MFi / IOKit compatible controllers (PS/XB/Switch Pro) get detected twice resulting in the appearance that 2 gamepads are connected when there is only 1 in actuality. Is there a method for filtering this out to avoid duplicates?

Looks like as of OSX 11, GCController implements supportsHIDDevice: which should allow for filtering duplicates. This is used within SDL2 but likely a bug or order of operations issue depending on whether GC or IOKit detects first.

  • Could you elaborate? Under what use case is +supportsHIDDevice: not returning the correct result for you?

Add a Comment