MCPcopy Create free account
hub / github.com/360Controller/360Controller / ReadComplete

Method ReadComplete

360Controller/_60Controller.cpp:815–852  ·  view source on GitHub ↗

This handles a completed asynchronous read

Source from the content-addressed store, hash-verified

813
814// This handles a completed asynchronous read
815void Xbox360Peripheral::ReadComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining)
816{
817 if (padHandler != NULL) // avoid deadlock with release
818 {
819 LockRequired locker(mainLock);
820 IOReturn err;
821 bool reread=!isInactive();
822
823 switch(status) {
824 case kIOReturnOverrun:
825 IOLog("read - kIOReturnOverrun, clearing stall\n");
826 if (inPipe != NULL)
827 inPipe->ClearStall();
828 // Fall through
829 case kIOReturnSuccess:
830 if (inBuffer != NULL)
831 {
832 const XBOX360_IN_REPORT *report=(const XBOX360_IN_REPORT*)inBuffer->getBytesNoCopy();
833 if(((report->header.command==inReport)&&(report->header.size==sizeof(XBOX360_IN_REPORT)))
834 || (report->header.command==0x20) || (report->header.command==0x07)) /* Xbox One */ {
835 err = padHandler->handleReport(inBuffer, kIOHIDReportTypeInput);
836 if(err!=kIOReturnSuccess) {
837 IOLog("read - failed to handle report: 0x%.8x\n",err);
838 }
839 }
840 }
841 break;
842 case kIOReturnNotResponding:
843 IOLog("read - kIOReturnNotResponding\n");
844 reread=false;
845 break;
846 default:
847 reread=false;
848 break;
849 }
850 if(reread) QueueRead();
851 }
852}
853
854void Xbox360Peripheral::SerialReadComplete(void *parameter, IOReturn status, UInt32 bufferSizeRemaining)
855{

Callers 1

ReadCompleteInternalMethod · 0.45

Calls 1

handleReportMethod · 0.45

Tested by

no test coverage detected