Library to allo USB PTP device to be hosted by the mbed platform
Dependents: class_project_main
Revision 6:124a01eaf569, committed 2013-08-29
- Comitter:
- jakowisp
- Date:
- Thu Aug 29 19:19:37 2013 +0000
- Parent:
- 5:728b5d58e135
- Child:
- 7:c3a16a61643f
- Commit message:
- Refactor Transaction
;
Changed in this revision
USBHostPTP.cpp | Show annotated file Show diff for this revision Revisions of this file |
USBHostPTP.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/USBHostPTP.cpp Thu Aug 29 03:48:07 2013 +0000 +++ b/USBHostPTP.cpp Thu Aug 29 19:19:37 2013 +0000 @@ -87,7 +87,6 @@ /*virtual*/ bool USBHostPTP::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed { - if ((ptp_intf == -1) && (intf_class == USB_PTP_CLASS_CODE) && (intf_subclass == 0x01) && @@ -240,6 +239,7 @@ if( responseCode!=NULL) *responseCode= PIMA_RETURN_CODE_Undefined; + do { ///TODO: Magic number needs to be replaced with DEFINE transferResult = host->bulkRead(this->pointerToDevice, this->bulk_in, this->buffer, 1024); @@ -337,11 +337,12 @@ if (operationFlags->dataStage==1) { if (operationFlags->txOperation==0) { - if (RecieveDataContainer(dataHandlerFunctionCastToVoid,&responseCode)!=true) + if ( RecieveDataContainer(dataHandlerFunctionCastToVoid,&responseCode) != true ) { return PIMA_RETURN_CODE_GeneralError; - else + } else { if (responseCode != PIMA_RETURN_CODE_Undefined) return responseCode; + } } else { printf("DataOut not coded\r\n"); } @@ -353,13 +354,13 @@ printf("Response bulkRead result: %d\r\n",transferResult); printf("PTPResponseContainer:\r\n"); DumpBuffer((uint8_t *)&responseContainer,responseContainer.len); - if(responseContainer.opcode==PIMA_RETURN_CODE_OK) { - printf("PIMA_RETURN_CODE_OK\r\n"); + if (responseContainer.opcode==PIMA_RETURN_CODE_OK) { + printf("PIMA_RETURN_CODE_OK\r\n"); } else { - printf("Response Length: %x\r\n",responseContainer.len); - printf("Response type: %x\r\n",responseContainer.type); - printf("Response code: %x\r\n",responseContainer.opcode); - printf("Response ID: %d\r\n",responseContainer.TransactionID); + printf("Response Length: %x\r\n",responseContainer.len); + printf("Response type: %x\r\n",responseContainer.type); + printf("Response code: %x\r\n",responseContainer.opcode); + printf("Response ID: %d\r\n",responseContainer.TransactionID); } #endif return responseContainer.code;
--- a/USBHostPTP.h Thu Aug 29 03:48:07 2013 +0000 +++ b/USBHostPTP.h Thu Aug 29 19:19:37 2013 +0000 @@ -345,6 +345,7 @@ * @return void */ void DumpObjectInfo(void); + PIMAContainer dataContainer; protected: //From IUSBEnumerator @@ -367,7 +368,7 @@ PIMAContainer commandContainer; PIMAContainer responseContainer; - PIMAContainer dataContainer; + //PIMAContainer dataContainer; PIMAContainer eventContainer; uint32_t transactionCnt; uint32_t sessionID;