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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Firewire devices waltervt Mac Peripherals 13 Sep 22, 2011 12:36 PM
What is the best way to get someone to develop an app for you? iPhone envy iPhone and iPod touch Apps 9 Jul 24, 2008 10:03 PM
How to get mobileSafari to load an HTML file stored locally on the device? yacoub Jailbreaks and iOS Hacks 5 Oct 16, 2007 09:43 PM
Getting ready to buy an iBook, what options to get buzlink Buying Tips, Advice and Discussion (archive) 13 Jul 27, 2004 11:32 AM
How to make an Ext. Firewire HD? matt.bauer Macintosh Computers 5 Feb 1, 2004 03:57 PM


All times are GMT -5. The time now is 04:58 AM.

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

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