site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Eric _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Oct 1, 2005, at 16:22 , Dan Joumaa wrote: if( responseTimeout ) { result = bulkInPipe->Read( inBufferDescriptor, responseTimeout, 0, inBufferDescriptor->getLength ( ) ); if( result == kIOReturnSuccess ) // success { // <<<< MISSING BRACE if( response->command.status >> 7 ) // Was there an error? continue; } // <<<< MISSING BRACE else { // failure - hits failure if( result == kIOReturnTimeout ) IOLog( "MyDriver::sendCommand( ) - A USB read " "timeout occured.\n" ); else IOLog( "MyDriver::sendCommand( ) - Failed to " "read. Error: %4x\n", err_get_code (result) ); // -----outputs Error 0??----- } } When I plug in my USB device, everything runs fine until it runs up to the above piece of code. It outputs "Failed to read. Error: 0" to system.log. I'm assuming that kIOReturnSuccess == 0, and the if should have executed the success code. The last thing that I could think of is that I am not outputting the IOReturn error code correctly. In breif: How would one correctly output an IOReturn error code through IOLog? If my above code is doing it correctly already, what can error 0 translate to? Always use braces around if/else. In the code above the else is associated with the wrong if. This email sent to site_archiver@lists.apple.com