X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=macosx.c;h=a0df84e6b079d4e5ff9fa969a27020631115bbfe;hb=02c8a1424d06cb97061a7ebf96231bdb08673b01;hp=b1e0b4579524ff716174d83f800564f8dc51bb96;hpb=dc422c04af5c63e31de6af2eedcebbfc961ee9e2;p=libserialport.git
diff --git a/macosx.c b/macosx.c
index b1e0b45..a0df84e 100644
--- a/macosx.c
+++ b/macosx.c
@@ -18,6 +18,7 @@
* along with this program. If not, see .
*/
+#include
#include "libserialport.h"
#include "libserialport_internal.h"
@@ -62,6 +63,17 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
DEBUG_FMT("Found port %s", path);
IORegistryEntryGetParentEntry(ioport, kIOServicePlane, &ioparent);
+ if ((cf_property=IORegistryEntrySearchCFProperty(ioparent,kIOServicePlane,
+ CFSTR("IOClass"), kCFAllocatorDefault,
+ kIORegistryIterateRecursively | kIORegistryIterateParents))) {
+ if (CFStringGetCString(cf_property, class, sizeof(class),
+ kCFStringEncodingASCII) &&
+ strstr(class, "USB")) {
+ DEBUG("Found USB class device");
+ port->transport = SP_TRANSPORT_USB;
+ }
+ CFRelease(cf_property);
+ }
if ((cf_property=IORegistryEntrySearchCFProperty(ioparent,kIOServicePlane,
CFSTR("IOProviderClass"), kCFAllocatorDefault,
kIORegistryIterateRecursively | kIORegistryIterateParents))) {