Added support for macosx 10.11+
Seems like, starting from 10.11, IOUSBDevice has been renamed to IOUSBHostDevice.
This commit is contained in:
@@ -47,9 +47,13 @@ func extractPortInfo(service C.io_registry_entry_t) (*PortDetails, error) {
|
||||
port.Name = name
|
||||
port.IsUSB = false
|
||||
|
||||
validUSBDeviceClass := map[string]bool{
|
||||
"IOUSBDevice": true,
|
||||
"IOUSBHostDevice": true,
|
||||
}
|
||||
usbDevice := service
|
||||
var searchErr error
|
||||
for usbDevice.GetClass() != "IOUSBDevice" {
|
||||
for !validUSBDeviceClass[usbDevice.GetClass()] {
|
||||
if usbDevice, searchErr = usbDevice.GetParent("IOService"); searchErr != nil {
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user