1549 TAny * scReadData; |
1576 TAny * scReadData; |
1550 TUint8 * scCharPtr; |
1577 TUint8 * scCharPtr; |
1551 TUint readSize; |
1578 TUint readSize; |
1552 TBool readZlp = EFalse; |
1579 TBool readZlp = EFalse; |
1553 |
1580 |
1554 r = iPort->OpenEndpoint(scReadBuf,firstBulkOutEndpoint); |
1581 r = iPort->OpenEndpoint(scReadBuf,firstBulkOutEndpoint); |
1555 test_KErrNone(r); |
1582 test_KErrNone(r); |
1556 do |
1583 do |
1557 { |
1584 { |
1558 r = scReadBuf.GetBuffer (scReadData,readSize,readZlp,status); |
1585 r = scReadBuf.GetBuffer (scReadData,readSize,readZlp,status); |
1559 // The following line can be reinstated once the shared chunk failure is fixed |
1586 // The following line can be reinstated once the shared chunk failure is fixed |
1560 // that prevents the readZlp flag from being set |
1587 // that prevents the readZlp flag from being set |
1561 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1588 // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof)); |
1562 if (r == KErrCompletion) |
1589 if (r == KErrCompletion) |
1563 { |
1590 { |
1564 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize); |
1591 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize); |
1565 if(gVerbose) |
1592 if(gVerbose) |
1566 { |
1593 { |
1567 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP01, "Host log file %d bytes read\n",readSize); |
1594 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP01, "Host log file %d bytes read\n",readSize); |
1568 } |
1595 } |
1569 scCharPtr = (TUint8 *)scReadData; |
1596 scCharPtr = (TUint8 *)scReadData; |
1570 // Print the host log file |
1597 // Print the host log file |
1571 for (TUint i = 0; i < readSize; i++) |
1598 for (TUint i = 0; i < readSize; i++) |
1572 { |
1599 { |
1573 if (* scCharPtr == '\r') |
1600 if (* scCharPtr == '\r') |
1574 { |
1601 { |
1575 lineBuf[j++] = '\0'; |
1602 lineBuf[j++] = '\0'; |
1576 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf); |
1603 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf); |
1577 j = 0; |
1604 j = 0; |
1578 } |
1605 } |
1579 else |
1606 else |
1580 { |
1607 { |
1581 if (* scCharPtr != '\n') |
1608 if (* scCharPtr != '\n') |
1582 { |
1609 { |
1583 lineBuf[j++] = * scCharPtr; |
1610 lineBuf[j++] = * scCharPtr; |
1584 } |
1611 } |
1585 } |
1612 } |
1586 scCharPtr++; |
1613 scCharPtr++; |
1587 } |
1614 } |
1588 } |
1615 } |
1589 if (r == KErrNone) |
1616 if (r == KErrNone) |
1590 { |
1617 { |
1591 User::WaitForRequest(status); |
1618 User::WaitForRequest(status); |
1592 test_KErrNone(status.Int()); |
1619 test_KErrNone(status.Int()); |
1593 } |
1620 } |
1594 } |
1621 } |
1595 while (r >= KErrNone && !readZlp); |
1622 while (r >= KErrNone && !readZlp); |
1596 #else |
1623 #else |
1597 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1624 TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize); |
1598 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1625 iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf); |
1599 User::WaitForRequest(status); |
1626 User::WaitForRequest(status); |
1600 test_KErrNone(status.Int()); |
1627 test_KErrNone(status.Int()); |
1601 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length()); |
1628 TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length()); |
1602 if(gVerbose) |
1629 if(gVerbose) |
1603 { |
1630 { |
1604 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP03, "Host log file %d bytes read\n",readBuf.Length()); |
1631 OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP03, "Host log file %d bytes read\n",readBuf.Length()); |
1605 } |
1632 } |
1606 for (TUint i = 0; i < readBuf.Length(); i++) |
1633 for (TUint i = 0; i < readBuf.Length(); i++) |
1607 { |
1634 { |
1608 if (readBuf[i] == '\r') |
1635 if (readBuf[i] == '\r') |
1609 { |
1636 { |
1610 lineBuf[j++] = '\0'; |
1637 lineBuf[j++] = '\0'; |
1611 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf); |
1638 OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf); |
1612 j = 0; |
1639 j = 0; |
1613 } |
1640 } |
1614 else |
1641 else |
1615 { |
1642 { |
1616 if (readBuf[i] != '\n') |
1643 if (readBuf[i] != '\n') |
1617 { |
1644 { |
1618 lineBuf[j++] = readBuf[i]; |
1645 lineBuf[j++] = readBuf[i]; |
1619 } |
1646 } |
1620 } |
1647 } |
1621 } |
1648 } |
1622 User::Free ((TAny *)readBuf.Ptr()); |
1649 User::Free ((TAny *)readBuf.Ptr()); |
1623 #endif |
1650 #endif |
|
1651 |
|
1652 #endif // OST_TRACE_COMPILER_IN_USE |
1624 } |
1653 } |
1625 |
1654 |
1626 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1655 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort) |
1627 { |
1656 { |
1628 // Get device/endpoint capabilities |
1657 // Get device/endpoint capabilities |
2358 test.End(); |
2387 test.End(); |
2359 RequestEp0ControlPacket(); |
2388 RequestEp0ControlPacket(); |
2360 } |
2389 } |
2361 |
2390 |
2362 #endif |
2391 #endif |
|
2392 |
|
2393 void OpenStackIfOtg() |
|
2394 { |
|
2395 // On an OTG device we have to start the OTG driver, otherwise the Client |
|
2396 // stack will remain disabled forever. |
|
2397 if (gSupportsOtg) |
|
2398 { |
|
2399 test.Start(_L("Running on OTG device: loading OTG driver\n")); |
|
2400 test.Next(_L("Load OTG LDD")); |
|
2401 TInt r = User::LoadLogicalDevice(KOtgdiLddFilename); |
|
2402 test((r == KErrNone) || (r == KErrAlreadyExists)); |
|
2403 |
|
2404 test.Next(_L("Open OTG channel")); |
|
2405 r = gOtgPort.Open(); |
|
2406 test(r == KErrNone); |
|
2407 |
|
2408 test.Next(_L("Start OTG stack")); |
|
2409 r = gOtgPort.StartStacks(); |
|
2410 test(r == KErrNone); |
|
2411 test.End(); |
|
2412 } |
|
2413 } |
|
2414 |
|
2415 void CloseStackIfOtg() |
|
2416 { |
|
2417 if (gSupportsOtg) |
|
2418 { |
|
2419 test.Start(_L("Close OTG stack\n")); |
|
2420 test.Next(_L("Stop OTG stack")); |
|
2421 gOtgPort.StopStacks(); |
|
2422 test.Next(_L("Close OTG Channel")); |
|
2423 gOtgPort.Close(); |
|
2424 test.Next(_L("Free OTG LDD")); |
|
2425 TInt r = User::FreeLogicalDevice(RUsbOtgDriver::Name()); |
|
2426 test(r == KErrNone); |
|
2427 test.End(); |
|
2428 } |
|
2429 } |
|
2430 |
2363 // -eof- |
2431 // -eof- |