X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=macosx.c;fp=macosx.c;h=a0df84e6b079d4e5ff9fa969a27020631115bbfe;hb=aacba60dca204923c2be4ffbdd9e43cb795c4cce;hp=f5f19448498f0f5de9819d7413ab180fade6ec7a;hpb=8062087ab346852563bf13eef38309c88d520bb7;p=libserialport.git diff --git a/macosx.c b/macosx.c index f5f1944..a0df84e 100644 --- a/macosx.c +++ b/macosx.c @@ -63,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))) {