- Timestamp:
- Aug 4, 2016 8:03:50 AM (8 years ago)
- Location:
- trunk/src/VBox/Devices/USB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/VUSBDevice.cpp
r62502 r62959 111 111 } 112 112 113 static PCVUSBDESCINTERFACEEX vusbDevFindAltIfDesc(P VUSBDEV pDev, PCVUSBINTERFACESTATE pIfState, int iAlt)113 static PCVUSBDESCINTERFACEEX vusbDevFindAltIfDesc(PCVUSBINTERFACESTATE pIfState, int iAlt) 114 114 { 115 115 for (uint32_t i = 0; i < pIfState->pIf->cSettings; i++) … … 308 308 static bool vusbDevStdReqSetConfig(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 309 309 { 310 RT_NOREF(EndPt, pbBuf, pcbBuf); 310 311 unsigned iCfg = pSetup->wValue & 0xff; 311 312 … … 360 361 static bool vusbDevStdReqGetConfig(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 361 362 { 363 RT_NOREF(EndPt); 362 364 if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_DEVICE) 363 365 { … … 402 404 static bool vusbDevStdReqGetInterface(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 403 405 { 406 RT_NOREF(EndPt); 404 407 if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_INTERFACE) 405 408 { … … 448 451 static bool vusbDevStdReqSetInterface(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 449 452 { 453 RT_NOREF(EndPt, pbBuf, pcbBuf); 450 454 if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_INTERFACE) 451 455 { … … 476 480 } 477 481 uint8_t iAlt = pSetup->wValue; 478 PCVUSBDESCINTERFACEEX pIfDesc = vusbDevFindAltIfDesc(p Dev, pIfState, iAlt);482 PCVUSBDESCINTERFACEEX pIfDesc = vusbDevFindAltIfDesc(pIfState, iAlt); 479 483 if (!pIfDesc) 480 484 { … … 510 514 static bool vusbDevStdReqSetAddress(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 511 515 { 516 RT_NOREF(EndPt, pbBuf, pcbBuf); 512 517 if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_DEVICE) 513 518 { … … 541 546 static bool vusbDevStdReqClearFeature(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 542 547 { 548 RT_NOREF(pbBuf, pcbBuf); 543 549 switch (pSetup->bmRequestType & VUSB_RECIP_MASK) 544 550 { … … 575 581 static bool vusbDevStdReqSetFeature(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 576 582 { 583 RT_NOREF(pDev, EndPt, pbBuf, pcbBuf); 577 584 switch (pSetup->bmRequestType & VUSB_RECIP_MASK) 578 585 { … … 599 606 static bool vusbDevStdReqGetStatus(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 600 607 { 608 RT_NOREF(EndPt); 601 609 if (*pcbBuf != 2) 602 610 { … … 832 840 static bool vusbDevStdReqGetDescriptor(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf) 833 841 { 842 RT_NOREF(EndPt); 834 843 if ((pSetup->bmRequestType & VUSB_RECIP_MASK) == VUSB_TO_DEVICE) 835 844 { … … 1168 1177 /* Process any URBs waiting to be cancelled first. */ 1169 1178 int rc = RTReqQueueProcess(pDev->hReqQueueSync, 0); /* Don't wait if there is nothing to do. */ 1170 Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); 1179 Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); NOREF(rc); 1171 1180 } 1172 1181 … … 1357 1366 static DECLCALLBACK(void) vusbDevResetDoneTimer(PPDMUSBINS pUsbIns, PTMTIMER pTimer, void *pvUser) 1358 1367 { 1368 RT_NOREF(pUsbIns, pTimer); 1359 1369 PVUSBDEV pDev = (PVUSBDEV)pvUser; 1360 1370 PVUSBRESETARGS pArgs = (PVUSBRESETARGS)pDev->pvArgs; … … 1432 1442 * @thread EMT 1433 1443 */ 1434 static DECLCALLBACK(int) vusbIDeviceReset(PVUSBIDEVICE pDevice, bool fResetOnLinux, PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM) 1435 { 1444 static DECLCALLBACK(int) vusbIDeviceReset(PVUSBIDEVICE pDevice, bool fResetOnLinux, 1445 PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM) 1446 { 1447 RT_NOREF(pVM); 1436 1448 PVUSBDEV pDev = (PVUSBDEV)pDevice; 1437 1449 Assert(!pfnDone || pVM); … … 1656 1668 { 1657 1669 int rc2 = RTReqQueueProcess(pDev->hReqQueueSync, 0); 1658 Assert(RT_SUCCESS(rc2) || rc2 == VERR_TIMEOUT); 1670 Assert(RT_SUCCESS(rc2) || rc2 == VERR_TIMEOUT); NOREF(rc2); 1659 1671 } 1660 1672 else -
trunk/src/VBox/Devices/USB/VUSBSniffer.cpp
r62956 r62959 137 137 const char *pszDesc) 138 138 { 139 RT_NOREF(pszDesc); 139 140 int rc = VINF_SUCCESS; 140 141 PVUSBSNIFFERINT pThis = NULL; -
trunk/src/VBox/Devices/USB/VUSBSnifferPcapNg.cpp
r62956 r62959 429 429 * @param cbOption Size of the optiob data. 430 430 */ 431 static int vusbSnifferAddOption(PVUSBSNIFFERFMTINT pThis, uint16_t u16OptionCode, const void *pvOption, uint16_t cbOption)432 { 433 int rc = VINF_SUCCESS;431 static int vusbSnifferAddOption(PVUSBSNIFFERFMTINT pThis, uint16_t u16OptionCode, const void *pvOption, size_t cbOption) 432 { 433 AssertStmt((uint16_t)cbOption == cbOption, cbOption = UINT16_MAX); 434 434 DumpFileOptionHdr OptHdr; 435 436 435 OptHdr.u16OptionCode = u16OptionCode; 437 OptHdr.u16OptionLength = cbOption;438 rc = vusbSnifferBlockAddData(pThis, &OptHdr, sizeof(OptHdr));436 OptHdr.u16OptionLength = (uint16_t)cbOption; 437 int rc = vusbSnifferBlockAddData(pThis, &OptHdr, sizeof(OptHdr)); 439 438 if ( RT_SUCCESS(rc) 440 439 && u16OptionCode != DUMPFILE_OPTION_CODE_END 441 440 && cbOption != 0) 442 441 { 443 rc = vusbSnifferBlockAddData(pThis, pvOption, cbOption);442 rc = vusbSnifferBlockAddData(pThis, pvOption, (uint16_t)cbOption); 444 443 if (RT_SUCCESS(rc)) 445 444 rc = vusbSnifferBlockAlign(pThis); … … 561 560 static DECLCALLBACK(int) vusbSnifferFmtPcanNgRecordEvent(PVUSBSNIFFERFMTINT pThis, PVUSBURB pUrb, VUSBSNIFFEREVENT enmEvent) 562 561 { 563 int rc = VINF_SUCCESS;564 562 DumpFileEpb Epb; 565 563 DumpFileUsbHeaderLnxMmapped UsbHdr; 566 DumpFileUsbSetup UsbSetup; 564 uint32_t cbCapturedLength = sizeof(UsbHdr); 565 uint8_t *pbData = NULL; 566 567 567 RTTIMESPEC TimeNow; 568 uint64_t u64TimestampEvent;569 size_t cbUrbLength = 0;570 uint32_t cbDataLength = 0;571 uint32_t cbCapturedLength = sizeof(UsbHdr);572 uint32_t cIsocPkts = 0;573 uint8_t *pbData = NULL;574 575 568 RTTimeNow(&TimeNow); 576 u 64TimestampEvent = RTTimeSpecGetNano(&TimeNow);569 uint64_t u64TimestampEvent = RTTimeSpecGetNano(&TimeNow); 577 570 578 571 /* Start with the enhanced packet block. */ … … 584 577 585 578 UsbHdr.u64Id = (uint64_t)pUrb; /** @todo: check whether the pointer is a good ID. */ 579 uint32_t cbUrbLength; 586 580 switch (enmEvent) 587 581 { … … 597 591 case VUSBSNIFFEREVENT_ERROR_COMPLETE: 598 592 UsbHdr.u8EventType = DUMPFILE_USB_EVENT_TYPE_ERROR; 593 cbUrbLength = 0; 599 594 break; 600 595 default: 601 596 AssertMsgFailed(("Invalid event type %d\n", enmEvent)); 602 } 603 cbDataLength = cbUrbLength; 597 cbUrbLength = 0; 598 } 599 uint32_t cbDataLength = cbUrbLength; 604 600 pbData = &pUrb->abData[0]; 605 601 602 uint32_t cIsocPkts = 0; 606 603 switch (pUrb->enmType) 607 604 { 608 605 case VUSBXFERTYPE_ISOC: 609 606 { 610 int32_t i32ErrorCount= 0;607 int32_t cErrors = 0; 611 608 612 609 UsbHdr.u8TransferType = 0; … … 615 612 if ( pUrb->aIsocPkts[i].enmStatus != VUSBSTATUS_OK 616 613 && pUrb->aIsocPkts[i].enmStatus != VUSBSTATUS_NOT_ACCESSED) 617 i32ErrorCount++;618 619 UsbHdr.u.IsoRec.i32ErrorCount = i32ErrorCount;614 cErrors++; 615 616 UsbHdr.u.IsoRec.i32ErrorCount = cErrors; 620 617 UsbHdr.u.IsoRec.i32NumDesc = pUrb->cIsocPkts; 621 618 cbCapturedLength += cIsocPkts * sizeof(DumpFileUsbIsoDesc); … … 623 620 } 624 621 case VUSBXFERTYPE_BULK: 625 626 622 UsbHdr.u8TransferType = 3; 623 break; 627 624 case VUSBXFERTYPE_INTR: 628 629 625 UsbHdr.u8TransferType = 1; 626 break; 630 627 case VUSBXFERTYPE_CTRL: 631 628 case VUSBXFERTYPE_MSG: 632 633 629 UsbHdr.u8TransferType = 2; 630 break; 634 631 default: 635 632 AssertMsgFailed(("invalid transfer type %d\n", pUrb->enmType)); … … 684 681 685 682 /* Write the packet to the capture file. */ 686 rc = vusbSnifferBlockNew(pThis, &Epb.Hdr, sizeof(Epb));683 int rc = vusbSnifferBlockNew(pThis, &Epb.Hdr, sizeof(Epb)); 687 684 if (RT_SUCCESS(rc)) 688 685 rc = vusbSnifferBlockAddData(pThis, &UsbHdr, sizeof(UsbHdr));
Note:
See TracChangeset
for help on using the changeset viewer.