-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last version (1.0.21/1.022) does not list all connected devices on macOS Sierra #290
Comments
I think the device is bound to a kernel driver as mentioned here: https://github.com/libusb/libusb/wiki#supported-environments
As the Stlink v1 programmer uses the SCSI transport (compared to Stlink v2 which uses RAW transport). |
This also worked in 1.0.20. It appears to be caused by 871eb29 and b7526c1, and can be worked around by applying the following patch: diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 9946222..42fcc6e 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -516,7 +516,7 @@ static void darwin_check_version (void) {
errno = 0;
version = strtol (version_string, NULL, 10);
if (0 == errno && version >= 15) {
- darwin_device_class = "IOUSBHostDevice";
}
}
@@ -882,7 +882,7 @@ static int get_device_parent_sessionID(io_service_t service, UInt64 *parent_sess
/* Walk up the tree in the IOService plane until we find a parent that has a sessionID */
parent = service;
- while((result = IORegistryEntryGetParentEntry (parent, kIOServicePlane, &parent)) == kIOReturnSuccess) {
+ while((result = IORegistryEntryGetParentEntry (parent, kIOUSBPlane, &parent)) == kIOReturnSuccess) {
if (get_ioregistry_value_number (parent, CFSTR("sessionID"), kCFNumberSInt64Type, parent_sessionID)) {
/* Success */
return 1; |
This is an odd issue. For some reason on Sierra and High Sierra the matching dictionary is not matching all devices of class IOUSBHostDevice. I can confirm it does work when matching IOUSBDevice. Not sure this is the correct fix. Digging into it now. Looks like AppleUSBDevice as the matching class also works. |
Is there a reason you think it's "better" to use the IOServicePlane rather than the IOUSBPlane? Presumably we only care about parent relationships for devices that are visible in the IOUSBPlane. I'm also not sure that AppleUSBDevice is the right matching class because I believe that will only match a subset of USB device classes. Not every USB device is matched by the AppleUSBDevice class, since they can be claimed by non-Apple drivers. |
Is there any progress on this issue? I am experiencing the same problem. If it helps, there are two terminal commands I can issue to show all of the devices or at least the devices I care about:
I am using macOS 10.13.3 |
I did build and try the latest 1.0.22-rc3 release which mentioned improved support for Sierra and High Sierra in the release notes, but it exhibits the same problem. |
You should try my company's fork, https://github.com/GroundControl-Solutions/libusb. We had to fix some hotplug detection issues as I recall to ensure all devices are found on Sierra and High Sierra. |
In my case, I only see the Apple root hub (05ac:8086) is not listed in the latest version compared to libusb-1.0.20.
|
Okay, I inserted an iPhone (05ac:12a8) and I can reproduce this issue. 1.020 can see the device. Latest git can not.
|
Later today I should have time to pull-request from our branch to resolve that issue. |
@JeremyAgost Now 1.022 has been released, can you get the pull-request against latest git? Thanks. |
My Mac Mini died. Is this issue still there in the master git? |
In the product that we integrate libusb, we've simply dropped support for macOS Sierra partly because of this issue. We're not set up to test with those earlier OS versions anymore. Sorry I can't help more. |
@JeremyAgost Thanks for the update. Can you confirm that High Seirra macOS 10.13 (successor to Sierra macOS 10.12) has no issue? Thanks. And hopefully 10.14 Mojave and 10.15 Catalina are okay as well. |
The above stlink issue says that 1.0.23 sorted out the issue. Here we actually had two separate problems in one issue: libusb problems with device detection in macOS: ST-Link-v1 driver issue relates to Kernel Extensions (kext): |
It seems this has been fixed in Pull Request 428 and release 1.0.23. |
Then I'm closing this. Ping me here to reopen in case the issue persists |
Coming back around to this. From what I can tell this is a bug in 11.12.x and other macOS releases. Even though the iPhone shows up as class IOUSBHostDevice it doesn't show up in the device iterator for that class. Apple fixed this by macOS 11. There are benefits to going back to using IOUSBHostDevice so I will look for a workaround that works with all versions until we no longer support the last broken version (I will check 10.13 and 10.14). |
On master branch (seems version 1.0.21) device (STM32VLDiscovery board in my case) doesn't show up in list of connected devices, but on tag v1.0.9 it does.
Related to stlink-org/stlink/issues/574 (and comment)
libusb@master devices list
libusb@v1.0.9 devices list
Please let me know if you need some more debugging info.
The text was updated successfully, but these errors were encountered: