506 else if (transPhase == ECompletingPhase) |
506 else if (transPhase == ECompletingPhase) |
507 { |
507 { |
508 __FLOG(_L8("cancel event received at completing phase, flush rx data")); |
508 __FLOG(_L8("cancel event received at completing phase, flush rx data")); |
509 |
509 |
510 //flush rx data. |
510 //flush rx data. |
511 static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->FlushRxDataL(); |
511 iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL(); |
512 } |
512 } |
513 else |
513 else |
514 { |
514 { |
515 __FLOG(_L8("cancel event received at idle phase, stop data EPs, flush rx data, restart data eps")); |
515 __FLOG(_L8("cancel event received at idle phase, stop data EPs, flush rx data, restart data eps")); |
516 |
516 |
517 // stop data endpoint |
517 // stop data endpoint |
518 DataEndpointsStop(); |
518 DataEndpointsStop(); |
519 |
519 |
520 //flush rx data. |
520 //flush rx data. |
521 static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->FlushRxDataL(); |
521 iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL(); |
522 |
522 |
523 // initiate bulk request sequence. |
523 // initiate bulk request sequence. |
524 InitiateBulkRequestSequenceL(); |
524 InitiateBulkRequestSequenceL(); |
525 |
525 |
526 SetDeviceStatus(EMTPUsbDeviceStatusOK); |
526 SetDeviceStatus(EMTPUsbDeviceStatusOK); |
1667 __FLOG(_L8("Notifying protocol layer connection closed")); |
1667 __FLOG(_L8("Notifying protocol layer connection closed")); |
1668 ret = iConnectionMgr->ConnectionClosed(*this); |
1668 ret = iConnectionMgr->ConnectionClosed(*this); |
1669 SetBulkTransactionState(EUndefined); |
1669 SetBulkTransactionState(EUndefined); |
1670 SetConnectionState(EIdle); |
1670 SetConnectionState(EIdle); |
1671 SetSuspendState(ENotSuspended); |
1671 SetSuspendState(ENotSuspended); |
1672 SetDeviceStatus(EMTPUsbDeviceStatusBusy); |
|
1673 } |
1672 } |
1674 |
1673 |
1675 __FLOG(_L8("StopConnection - Exit")); |
1674 __FLOG(_L8("StopConnection - Exit")); |
1676 |
1675 |
1677 return ret; |
1676 return ret; |
1686 __FLOG(_L8("SuspendConnectionL - Entry")); |
1685 __FLOG(_L8("SuspendConnectionL - Entry")); |
1687 if (ConnectionOpen()) |
1686 if (ConnectionOpen()) |
1688 { |
1687 { |
1689 // Stop all data transfer activity. |
1688 // Stop all data transfer activity. |
1690 DataEndpointsStop(); |
1689 DataEndpointsStop(); |
|
1690 |
|
1691 //flush buffered rx data. |
|
1692 iEndpoints[EMTPUsbEpBulkOut]->FlushBufferedRxDataL(); |
1691 } |
1693 } |
1692 ControlEndpointStop(); |
1694 ControlEndpointStop(); |
1693 |
1695 |
1694 // Update state. |
1696 // Update state. |
1695 SetSuspendState(ESuspended); |
1697 SetSuspendState(ESuspended); |
1844 ifc().iClass.iClassNum = KMTPUsbInterfaceClassSIC; |
1846 ifc().iClass.iClassNum = KMTPUsbInterfaceClassSIC; |
1845 ifc().iClass.iSubClassNum = KMTPUsbInterfaceSubClassSIC; |
1847 ifc().iClass.iSubClassNum = KMTPUsbInterfaceSubClassSIC; |
1846 ifc().iClass.iProtocolNum = KMTPUsbInterfaceProtocolSIC; |
1848 ifc().iClass.iProtocolNum = KMTPUsbInterfaceProtocolSIC; |
1847 ifc().iTotalEndpointsUsed = KMTPUsbRequiredNumEndpoints; |
1849 ifc().iTotalEndpointsUsed = KMTPUsbRequiredNumEndpoints; |
1848 |
1850 |
1849 // Allocate 512KB buffer for OUT EndPoint, and 64KB for IN EndPoint |
1851 // Allocate 512KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint |
1850 TUint32 bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTMaximum; |
1852 TUint32 bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTMaximum; |
1851 |
1853 |
1852 // Write the active interface descriptor. |
1854 // Write the active interface descriptor. |
1853 User::LeaveIfError(iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority)); |
1855 TInt err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority); |
1854 |
1856 |
|
1857 if (err == KErrNoMemory) |
|
1858 { |
|
1859 __FLOG(_L8("NoMem when setinterface, try with lower priority")); |
|
1860 // Allocate 64KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint |
|
1861 bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTPlus2; |
|
1862 err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority); |
|
1863 __FLOG_1(_L8("setinterface return for lower priority:%d"),err); |
|
1864 } |
|
1865 |
|
1866 __FLOG_1(_L8("setinterface error code:%d"),err); |
|
1867 User::LeaveIfError(err); |
|
1868 |
1855 __FLOG(_L8("SetInterfaceDescriptorL - Exit")); |
1869 __FLOG(_L8("SetInterfaceDescriptorL - Exit")); |
1856 } |
1870 } |
1857 |
1871 |
1858 /** |
1872 /** |
1859 Sets the USB MTP device class connection state. |
1873 Sets the USB MTP device class connection state. |