I know I'm late to this IOKit party, but the following Swift code (I'm new to Swift, so point out any better practises if you see I'm doing something horrendously wrong) works for me to retrieve the IODialinDevice...
var dict : Unmanaged<CFMutableDictionary>? if (IORegistryEntryCreateCFProperties(usbDevice, &dict, kCFAllocatorDefault, 0) == KERN_SUCCESS) { let hardDict = (dict?.takeRetainedValue()) as! NSMutableDictionary DispatchQueue.main.async { self.deviceLabel.stringValue = self.deviceLabel.stringValue + (hardDict["IODialinDevice"] as! String) + "\n" } }
For my test purposes I had the deviceLabel (an NSTextField) updating just to make sure I was receiving Add and Remove Messages.
Hope this helps others as the Apple docs on IOKit are really abysmal in helping people with this low level stuff.
Topic:
App & System Services
SubTopic:
Drivers
Tags: