开发者

IOServiceMatching on AppleUSBCDCACMData IOClass: Anomaly?

开发者 https://www.devze.com 2023-01-26 09:43 出处:网络
I am trying to extract a list of all AppleUSBCDCACMData IOClass devices in my mac using the following code snippet (just some small scale modifications in apple sample code). The device is a usb modem

I am trying to extract a list of all AppleUSBCDCACMData IOClass devices in my mac using the following code snippet (just some small scale modifications in apple sample code). The device is a usb modem which creates开发者_如何转开发 some 7 /dev/cu.usbmodemx device nodes.

    error = IOMasterPort(MACH_PORT_NULL, &masterPort);  

if(error){
    return ;
}
else{
    matchingDict = IOServiceMatching("AppleUSBCDCACMData");
    IOServiceGetMatchingServices(masterPort,matchingDict,&modem_iterator);
    while(usbDevice = IOIteratorNext(modem_iterator))
    {

            }

My observation is, the iterator returned by IOServiceGetMatchingServices is empty (ie nothing to iterate on). But if i pass "AppleUSBCDCACMControl" as the parameter to IOServiceMatching, i get a iterator of a list of 7 elements - which is in conformance with the IORegistryExplorer view. See a screenshot of IORegistryExplorer here, http://tumblr.deepak.dk/post/1666218968/ioregistryexplorer It appears that it is not possible to query IORegistry with arbitrary IOClass name strings? Since i faced the same issues with some non-standard proprietary IOClasses as well. This can be reproduced using any USB modem (3g/HSDPA) which loads AppleUSBCDC driver.

What am i doing wrong?


IOService objects can only be matched once registerService() has been called for them. AppleUSBCDCACMControl does this, but AppleUSBCDCACMData does not.

0

精彩评论

暂无评论...
验证码 换一张
取 消