Hi, I'm enumerating HID devices with the following code and testing with a generic game pad I noticed that the when I unplug the device it does not disappear from the list, re-plugging it adds an other 'instance' of the device on the list. Sometimes repeated unplug/replugs create a third instance.
What am I doing wrong? If I'm not doing anything wrong, is this a feature or bug? How can I determine which of those instances is valid, not all of them can be opened. I'm doing this from Java using JNA but this is pretty straightforward Core Foundation and IOKit calls so the Java code should be readable. I'm on Yosemite. This is from my PureJavaHidApi project: https://github.com/nyholku/purejavahidapi Here is the code: public List<purejavahidapi.HidDeviceInfo> enumerateDevices() { List<purejavahidapi.HidDeviceInfo> list = new LinkedList<purejavahidapi.HidDeviceInfo>(); processPendingEvents(); CFSetRef device_set = IOHIDManagerCopyDevices(MacOsXBackend.m_HidManager); int num_devices = (int) CFSetGetCount(device_set); Pointer[] device_array = new Pointer[(int) num_devices]; CFSetGetValues(device_set, device_array); for (int i = num_devices - 1; i >= 0; i--) { IOHIDDeviceRef dev = new IOHIDDeviceRef(device_array[i]); HidDeviceInfo info = new HidDeviceInfo(dev); list.add(info); } CFRelease(device_set); return list; } and here is an example of what I'm seeing (listing the returned list, listing code not shown): FOUND VID 0x05AC (1452), PID 0x0263 (611), manufacturer "Apple Inc.", serial"null", product "Apple Internal Keyboard / Trackpad", release 0x0222 (546), path "USB_05ac_0263_0x7f93a1e2ecc0" FOUND VID 0x0810 (2064), PID 0x0005 (5), manufacturer "null", serial"null", product "USB Gamepad", release 0x0106 (262), path "USB_0810_0005_0x7f93a3f01ce0" FOUND VID 0x0000 (0), PID 0x0000 (0), manufacturer "null", serial"null", product "Apple Mikey HID Driver", release 0x0000 (0), path "null" FOUND VID 0x05AC (1452), PID 0x0263 (611), manufacturer "Apple Inc.", serial"null", product "Apple Internal Keyboard / Trackpad", release 0x0222 (546), path "USB_05ac_0263_0x7f93a1e2f550" FOUND VID 0x05AC (1452), PID 0x0263 (611), manufacturer "Apple Inc.", serial"null", product "Apple Internal Keyboard / Trackpad", release 0x0222 (546), path "USB_05ac_0263_0x7f93a1e2e550" FOUND VID 0x0810 (2064), PID 0x0005 (5), manufacturer "null", serial"null", product "USB Gamepad", release 0x0106 (262), path "USB_0810_0005_0x7f93a6c9c450" FOUND VID 0x05AC (1452), PID 0x0263 (611), manufacturer "Apple Inc.", serial"null", product "Apple Internal Keyboard / Trackpad", release 0x0222 (546), path "USB_05ac_0263_0x7f93a1e2dbc0" br Kusti ________________________________ This e-mail may contain confidential or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. We will not be liable for direct, indirect, special or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on or as of transmission of this e-mail in general.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Usb mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/usb/archive%40mail-archive.com This email sent to [email protected]
