Re: Reporting IOReturn errors...
Re: Reporting IOReturn errors...
- Subject: Re: Reporting IOReturn errors...
- From: Eric Gouriou <email@hidden>
- Date: Sat, 1 Oct 2005 17:04:56 -0700
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.
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden