Getting system to re-recognize an "unknown" Firewire device

Discussion in 'Mac Programming' started by brianus, Aug 30, 2007.

  1. brianus macrumors 6502

    Jun 17, 2005
    I'm writing a small command line utility that does nothing but disconnect and reconnect a badly behaved FireWire device (I often have to do this physically, so I want a software equivalent that can be automated). I've gotten the disconnection down (using the firewire device interface's Seize() function), but I can't get the system to re-recognize the device. I'm told by the ADC documentation that calling Close() and IOServiceRequestProbe() after having Seize()'d the device, will '[make] it appear that the device has been "re-plugged"', but it doesn't seem to have that effect. Instead, the device shows up in SystemProfiler as "Unknown Device." It can still be accessed programmatically, but the system no longer recognizes it. Any ideas?

    io_object_t aDevice;
    IOCFPlugInInterface **cfPlugInInterface(0);
    SInt32 theScore;
    IOFireWireLibDeviceRef fwDeviceInterface(0);
    bool found(false);
    while (aDevice = IOIteratorNext(iterator)) {
    	if ((kIOReturnSuccess == IOCreatePlugInInterfaceForService(
    	) && cfPlugInInterface && (kIOReturnSuccess == (*cfPlugInInterface)->QueryInterface(
    			reinterpret_cast<void **>(&fwDeviceInterface)
    	)) {
    		found = true;
    if (found) {
    	[b](*fwDeviceInterface)->Seize(fwDeviceInterface, NULL);
    	IOServiceRequestProbe(aDevice, 0);[/b]

Share This Page