Skip to content

libusb_get_port_numbers() is broken on MacOS 12.4 (21F79) #1156

@mvp

Description

@mvp

Starting from MacOS 12.4 (21F79), libusb_get_port_numbers() is broken.

For example, on my Mac, building libusb from master branch and running examples/listdevs gives on MacOS 11.6.6:

0bda:5411 (bus 20, device 21) path: 1.3.4
0bda:0411 (bus 20, device 20) path: 5.3.4
0bda:0411 (bus 20, device 19) path: 5.3.3
0bda:5411 (bus 20, device 18) path: 1.3.3
0bda:0411 (bus 20, device 17) path: 5.4
0bda:5411 (bus 20, device 16) path: 1.4
0bda:0411 (bus 20, device 15) path: 5.3
0bda:5411 (bus 20, device 14) path: 1.3
0bda:0411 (bus 20, device 13) path: 5
0bda:5411 (bus 20, device 12) path: 1

Note that path is longer than 1 (contains dots) on older Mac, which is correct behavior.

But running the same libusb build against the same physical hub on MacOS 12.4 (21F79) gives this:

0bda:5411 (bus 20, device 13) path: 4
0bda:5411 (bus 20, device 12) path: 3
0bda:5411 (bus 20, device 11) path: 4
0bda:5411 (bus 20, device 10) path: 3
0bda:0411 (bus 0, device 10) path: 4
0bda:0411 (bus 0, device 9) path: 3
0bda:0411 (bus 0, device 8) path: 4
0bda:0411 (bus 0, device 7) path: 3
0bda:5411 (bus 20, device 9) path: 3
0bda:0411 (bus 0, device 6) path: 1
05ac:1460 (bus 20, device 4) path: 2
1050:0407 (bus 20, device 2) path: 2
05ac:100f (bus 20, device 1) path: 1
05ac:8104 (bus 128, device 6) path: 8
05ac:100e (bus 1, device 1) path: 1

So it is broken on MacOS 12.4 - path is always just length 1 - incorrect!

This seems to be recurrence of issue #693 (aka #707) which was resolved 2 years ago.
I do not see any suspicious changes to darwin_usb.c in last 2 years, so this must be change in MacOS 12.4 USB stack behavoir that needs to be fixed in libusb.

This issue breaks any software that depends on libusb_get_port_numbers(), in particular my utility uhubctl.

cc: @hjelmn, @mcuee, @IgorAnohin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions