Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Interrupt Pipe reading problems



Hello hi,

I need to read what's on the the interrupt Pipe of me USB ADSL Modem so at the end of my start function I do the following code:

modem->fCommCompletionInfo.target = this;
modem->fCommCompletionInfo.action = commReadComplete;
modem->fCommCompletionInfo.parameter = modem;
IOReturn rtn;

rtn = modem->CommPipe->Read(modem->CommPipeMDP,
&modem->fCommCompletionInfo,
NULL);
if (rtn == kIOReturnSuccess)
{
XTRACE(this, 0, 0, "start - starting reading on the interrupt Pipe");
}
XTRACE(this, 0, 0, "start - successful and IOModemSerialStreamSync created");




*** and in the completion routine I do this (code from the AppleUSBCDCDriver)


void com_trendchip_driver_TC3160::commReadComplete(void *obj, void *param, IOReturn rc, UInt32 remaining)
{
com_trendchip_driver_TC3160 *me = (com_trendchip_driver_TC3160*)obj;
PortInfo_t *port = (PortInfo_t*)param;
IOReturn ior;
UInt32 dLen;
UInt16 *tState;
UInt32 tempS, value, mask;
XTRACE(port, rc, 0, "commReadComplete");


    if (me->fStopping)
		return;

if (rc == kIOReturnSuccess) // If operation returned ok
{
dLen = COMM_BUFF_SIZE - remaining;
XTRACE(port, 0, dLen, "commReadComplete - data length");


if ((dLen > 7) && (port->CommPipeBuffer[1] == kUSBSERIAL_STATE))
{
tState = (UInt16 *)&port->CommPipeBuffer[8];
tempS = USBToHostWord(*tState);
XTRACE(port, 0, tempS, "commReadComplete - kUSBSERIAL_STATE");
}
} else {
XTRACE(port, 0, rc, "commReadComplete - error");
if (rc != kIOReturnAborted)
{
rc = me->clearPipeStall(port, port->CommPipe);
if (rc != kIOReturnSuccess)
{
XTRACE(port, 0, rc, "dataReadComplete - clear stall failed (trying to continue)");
}
}
}



if (rc != kIOReturnAborted)
{
ior = port->CommPipe->Read(port->CommPipeMDP, &port->fCommCompletionInfo, NULL);
if (ior != kIOReturnSuccess)
{
XTRACE(port, 0, rc, "commReadComplete - Read io error");
}
}


    return;
	
}/* end commReadComplete */


I don't understand what append exactly when I run this code:
the code in the start function return an "kIOReturnSuccess" which I assume means that the reading was done but inside the completion routine the return code is (rc in my code) e00002ed wich means that the device is not responding. I don't know if the start function is the right place to read the interrupt pipe but I need this pipe to get the "response_available" notification when I do a "send_encapsulated_request" to perform the corresponding "get_encapsulated_response".


regards

Mathieu
adnxgroup
Lyon France
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.