Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 30, 2007, 03:53 PM   #1
brianus
macrumors 6502
 
Join Date: Jun 2005
Getting system to re-recognize an "unknown" Firewire device

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?

Code:
io_object_t aDevice;
IOCFPlugInInterface **cfPlugInInterface(0);
SInt32 theScore;
IOFireWireLibDeviceRef fwDeviceInterface(0);
bool found(false);
while (aDevice = IOIteratorNext(iterator)) {
	if ((kIOReturnSuccess == IOCreatePlugInInterfaceForService(
			aDevice, 
			kIOFireWireLibTypeID,
			kIOCFPlugInInterfaceID, 
			&cfPlugInInterface, 
			&theScore
		)
	) && cfPlugInInterface && (kIOReturnSuccess == (*cfPlugInInterface)->QueryInterface(
			cfPlugInInterface, 
			CFUUIDGetUUIDBytes(kIOFireWireDeviceInterfaceID), 
			reinterpret_cast<void **>(&fwDeviceInterface)
		)
	)) {
		found = true;
		break;
	}
}
if (found) {
	(*fwDeviceInterface)->Seize(fwDeviceInterface, NULL);
	(*fwDeviceInterface)->Open(fwDeviceInterface);
	(*fwDeviceInterface)->Close(fwDeviceInterface);
	IOServiceRequestProbe(aDevice, 0);
}
__________________
iPhone 4S 64㎇ 6.1.3 | iPad 4th Gen 128㎇ 6.1.3 | MacBook Pro 13" Retina i7 2.9㎓/8㎇/768㎇ 10.8.4 |
Mac mini C2D 2.66㎓/4㎇/120㎇ SSD 10.8.2 | TV 160㎇ 3.0.2 | Thunderbolt Display | Airport Ex.
brianus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
"Another device is using this computer's IP address""Shared" user's slowing down Wifi mnya OS X 2 Feb 15, 2014 01:30 PM
All iPads: 128Gb Cellular iPad Air - Stolen by the "unknown signer" trevpimp iPad 25 Dec 2, 2013 04:52 AM
Website for IMEIinfo says lock status "Unknown" shankar2 iPhone 10 Sep 25, 2013 11:50 PM
"Message not found" text from unknown (with screen shot) rrandyy iPhone 17 May 4, 2013 12:55 AM
Verizon iPhone 5 "2YR Contract" vs "Device only" gMacbookPro iPhone 2 Oct 3, 2012 05:24 PM

Forum Jump

All times are GMT -5. The time now is 01:29 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC