Changeset 59091 in vbox for trunk/src/VBox/Devices/USB
- Timestamp:
- Dec 11, 2015 2:29:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp
r58778 r59091 212 212 if (RT_UNLIKELY(pDevSol->hFile == NIL_RTFILE)) 213 213 { 214 LogFlow((USBPROXY ":usbProxySolarisIOCtl connection to driver gone!\n"));214 LogFlow((USBPROXY ":usbProxySolarisIOCtl: Connection to driver gone!\n")); 215 215 return VERR_VUSB_DEVICE_NOT_ATTACHED; 216 216 } … … 232 232 pDevSol->pProxyDev->fDetached = true; 233 233 usbProxySolarisCloseFile(pDevSol); 234 LogRel((USBPROXY ":Command %#x failed, USB Device '%s' disconnected!\n", Function, pDevSol->pProxyDev->pUsbIns->pszName)); 234 LogRel((USBPROXY ": Command %#x failed, USB Device '%s' disconnected!\n", Function, 235 pDevSol->pProxyDev->pUsbIns->pszName)); 235 236 } 236 237 else 237 LogRel((USBPROXY ": Command %#x failed. Req.rc=%Rrc\n", Function, Req.rc));238 LogRel((USBPROXY ": Command %#x failed. Req.rc=%Rrc\n", Function, Req.rc)); 238 239 } 239 240 … … 241 242 } 242 243 243 LogRel((USBPROXY ": Function %#x failed. rc=%Rrc\n", Function, rc));244 LogRel((USBPROXY ": Function %#x failed. rc=%Rrc\n", Function, rc)); 244 245 return rc; 245 246 } … … 268 269 { 269 270 if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 270 LogRel((USBPROXY ": Failed to get configuration. rc=%Rrc\n", rc));271 LogRel((USBPROXY ": Failed to get configuration. rc=%Rrc\n", rc)); 271 272 272 273 pDevSol->pProxyDev->iActiveCfg = -1; … … 290 291 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); 291 292 292 LogFlowFunc((USBPROXY ":usbProxySolarisOpen pProxyDev=%p pszAddress=%s pvBackend=%p\n", pProxyDev, pszAddress, pvBackend));293 LogFlowFunc((USBPROXY ":usbProxySolarisOpen: pProxyDev=%p pszAddress=%s pvBackend=%p\n", pProxyDev, pszAddress, pvBackend)); 293 294 294 295 /* … … 351 352 else 352 353 { 353 LogRel((USBPROXY ": version mismatch! driver v%d.%d expecting ~v%d.%d\n", GetVersionReq.u32Major,354 LogRel((USBPROXY ": Version mismatch, Driver v%d.%d expecting ~v%d.%d\n", GetVersionReq.u32Major, 354 355 GetVersionReq.u32Minor, VBOXUSB_VERSION_MAJOR, VBOXUSB_VERSION_MINOR)); 355 356 rc = VERR_VERSION_MISMATCH; … … 357 358 } 358 359 else 359 LogRel((USBPROXY ": failed to query driver version. rc=%Rrc\n", rc));360 LogRel((USBPROXY ": Failed to query driver version. rc=%Rrc\n", rc)); 360 361 361 362 RTFileClose(pDevSol->hFile); … … 364 365 } 365 366 else 366 LogRel((USBPROXY ": failed to open device. rc=%Rrc pszDevicePath=%s\n", rc, pDevSol->pszDevicePath));367 LogRel((USBPROXY ": Failed to open device. rc=%Rrc pszDevicePath=%s\n", rc, pDevSol->pszDevicePath)); 367 368 368 369 RTStrFree(pDevSol->pszDevicePath); … … 371 372 else 372 373 { 373 LogRel((USBPROXY ": failed to get client info. rc=%Rrc pszDevicePath=%s\n", rc, pDevSol->pszDevicePath));374 LogRel((USBPROXY ": Failed to get client info. rc=%Rrc szDeviceIdent=%s\n", rc, szDeviceIdent)); 374 375 if (rc == VERR_NOT_FOUND) 375 376 rc = VERR_OPEN_FAILED; … … 382 383 } 383 384 else 384 LogRel((USBPROXY ": RTCritSectInit failed. rc=%Rrc pszAddress=%s\n", rc, pszAddress));385 LogRel((USBPROXY ": RTCritSectInit failed. rc=%Rrc pszAddress=%s\n", rc, pszAddress)); 385 386 } 386 387 else 387 LogRel((USBPROXY ": RTStrAPrintf failed. rc=%Rrc pszAddress=%s\n", rc, pszAddress));388 LogRel((USBPROXY ": RTStrAPrintf failed. rc=%Rrc pszAddress=%s\n", rc, pszAddress)); 388 389 } 389 390 else 390 LogRel((USBPROXY ": USBLibInit failed. rc=%Rrc\n", rc));391 LogRel((USBPROXY ": USBLibInit failed. rc=%Rrc\n", rc)); 391 392 392 393 USBLibTerm(); … … 451 452 static DECLCALLBACK(int) usbProxySolarisReset(PUSBPROXYDEV pProxyDev, bool fRootHubReset) 452 453 { 453 LogFlowFunc((USBPROXY ": usbProxySolarisResetpProxyDev=%s fRootHubReset=%d\n", pProxyDev->pUsbIns->pszName, fRootHubReset));454 LogFlowFunc((USBPROXY ": usbProxySolarisReset: pProxyDev=%s fRootHubReset=%d\n", pProxyDev->pUsbIns->pszName, fRootHubReset)); 454 455 455 456 /** Pass all resets to the device. The Trekstor USB (1.1) stick requires this to work. */ … … 466 467 } 467 468 else if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 468 LogRel((USBPROXY ": usbProxySolarisReset failed.rc=%d\n", rc));469 LogRel((USBPROXY ": usbProxySolarisReset: Failed! rc=%d\n", rc)); 469 470 470 471 return rc; … … 484 485 static DECLCALLBACK(int) usbProxySolarisSetConfig(PUSBPROXYDEV pProxyDev, int iCfg) 485 486 { 486 LogFlowFunc((USBPROXY ": usbProxySolarisSetConfig: pProxyDev=%p iCfg=%#x\n", pProxyDev, iCfg));487 LogFlowFunc((USBPROXY ": usbProxySolarisSetConfig: pProxyDev=%p iCfg=%#x\n", pProxyDev, iCfg)); 487 488 488 489 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); … … 494 495 if ( RT_FAILURE(rc) 495 496 && rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 496 LogRel((USBPROXY ": usbProxySolarisSetConfig failed to switch configuration.rc=%Rrc\n", rc));497 LogRel((USBPROXY ": usbProxySolarisSetConfig: Failed! rc=%Rrc\n", rc)); 497 498 498 499 return rc; … … 533 534 * @returns success indicator. 534 535 */ 535 static DECLCALLBACK(int) usbProxySolarisSetInterface(PUSBPROXYDEV pProxyDev, int iIf, int iAlt)536 { 537 LogFlowFunc((USBPROXY ": usbProxySolarisSetInterface: pProxyDev=%p iIf=%d iAlt=%d\n", pProxyDev, iIf, iAlt));536 static DECLCALLBACK(int) usbProxySolarisSetInterface(PUSBPROXYDEV pProxyDev, int bIf, int bAlt) 537 { 538 LogFlowFunc((USBPROXY ": usbProxySolarisSetInterface: pProxyDev=%p bIf=%#x iAlt=%#x\n", pProxyDev, bIf, bAlt)); 538 539 539 540 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); … … 541 542 542 543 VBOXUSBREQ_SET_INTERFACE SetInterfaceReq; 543 SetInterfaceReq.bInterface = iIf;544 SetInterfaceReq.bAlternate = iAlt;544 SetInterfaceReq.bInterface = bIf; 545 SetInterfaceReq.bAlternate = bAlt; 545 546 int rc = usbProxySolarisIOCtl(pDevSol, VBOXUSB_IOCTL_SET_INTERFACE, &SetInterfaceReq, sizeof(SetInterfaceReq)); 546 547 if ( RT_FAILURE(rc) 547 548 && rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 548 LogRel((USBPROXY ": usbProxySolarisSetInterface failed to set interface.rc=%Rrc\n", rc));549 LogRel((USBPROXY ": usbProxySolarisSetInterface: Failed! rc=%Rrc\n", rc)); 549 550 550 551 return rc; … … 557 558 static DECLCALLBACK(int) usbProxySolarisClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int EndPt) 558 559 { 559 LogFlowFunc((USBPROXY ": usbProxySolarisClearHaltedEppProxyDev=%p EndPt=%#x\n", pProxyDev, EndPt));560 LogFlowFunc((USBPROXY ": usbProxySolarisClearHaltedEp: pProxyDev=%p EndPt=%#x\n", pProxyDev, EndPt)); 560 561 561 562 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); … … 567 568 if ( RT_FAILURE(rc) 568 569 && rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 569 LogRel((USBPROXY ": usbProxySolarisClearHaltedEp failed! rc=%Rrc\n", rc));570 LogRel((USBPROXY ": usbProxySolarisClearHaltedEp: Failed! rc=%Rrc\n", rc)); 570 571 571 572 return rc; … … 580 581 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); 581 582 582 LogFlowFunc((USBPROXY ": usbProxySolarisUrbQueue: pProxyDev=%s pUrb=%p EndPt=%#x enmDir=%d cbData=%d pvData=%p\n",583 pProxyDev->pUsbIns->pszName, pUrb, pUrb-> EndPt, pUrb->enmDir, pUrb->cbData, pUrb->abData));583 LogFlowFunc((USBPROXY ": usbProxySolarisUrbQueue: pProxyDev=%s pUrb=%p pszDesc=%s EndPt=%#x enmDir=%d cbData=%d pvData=%p\n", 584 pProxyDev->pUsbIns->pszName, pUrb, pUrb->pszDesc, pUrb->EndPt, pUrb->enmDir, pUrb->cbData, pUrb->abData)); 584 585 585 586 PUSBPROXYURBSOL pUrbSol = usbProxySolarisUrbAlloc(pDevSol); 586 587 if (RT_UNLIKELY(!pUrbSol)) 587 588 { 588 LogRel((USBPROXY ": usbProxySolarisUrbQueue: Failed to allocate URB.\n"));589 LogRel((USBPROXY ": usbProxySolarisUrbQueue: Failed to allocate URB\n")); 589 590 return VERR_NO_MEMORY; 590 591 } … … 605 606 UrbReq.fShortOk = !pUrb->fShortNotOk; 606 607 UrbReq.cbData = pUrb->cbData; 607 UrbReq.pvData = pUrb->abData; 608 UrbReq.pvData = &pUrb->abData[0]; 609 610 Log6((USBPROXY ": Sending: EndPt=%#x Dir=%d cbData=%u\n", pUrb->EndPt, pUrb->enmDir, pUrb->cbData)); 611 608 612 if (pUrb->enmType == VUSBXFERTYPE_ISOC) 609 613 { … … 621 625 { 622 626 if (pUrb->enmType == VUSBXFERTYPE_ISOC) 623 LogFlow((USBPROXY ":usbProxySolarisUrbQueue success cbData=%d.\n", pUrb->cbData));627 LogFlow((USBPROXY ":usbProxySolarisUrbQueue: Success cbData=%d\n", pUrb->cbData)); 624 628 pUrb->Dev.pvPrivate = pUrbSol; 625 629 return VINF_SUCCESS; … … 627 631 628 632 if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 629 LogRel((USBPROXY ":usbProxySolarisUrbQueue Failed!! pProxyDev=%s pUrb=%p EndPt=%#x bEndpoint=%#x enmType=%d enmDir=%d cbData=%u rc=%Rrc\n", 630 pProxyDev->pUsbIns->pszName, pUrb, pUrb->EndPt, UrbReq.bEndpoint, pUrb->enmType, pUrb->enmDir, pUrb->cbData, rc)); 633 { 634 LogRel((USBPROXY ": usbProxySolarisUrbQueue: Failed! pProxyDev=%s pUrb=%p EndPt=%#x bEndpoint=%#x enmType=%d " 635 "enmDir=%d cbData=%u rc=%Rrc\n", pProxyDev->pUsbIns->pszName, pUrb, pUrb->EndPt, 636 UrbReq.bEndpoint, pUrb->enmType, pUrb->enmDir, pUrb->cbData, rc)); 637 } 631 638 632 639 return rc; … … 647 654 AssertPtrReturn(pDevSol, VERR_INVALID_POINTER); 648 655 649 LogFlowFunc((USBPROXY ": usbProxySolarisUrbCancelpUrb=%p pUrbSol=%p pDevSol=%p\n", pUrb, pUrbSol, pUrbSol->pDevSol));656 LogFlowFunc((USBPROXY ": usbProxySolarisUrbCancel: pUrb=%p pUrbSol=%p pDevSol=%p\n", pUrb, pUrbSol, pUrbSol->pDevSol)); 650 657 651 658 /* Aborting the control pipe isn't supported, pretend success. */ … … 658 665 if ( RT_FAILURE(rc) 659 666 && rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 660 LogRel((USBPROXY ": usbProxySolarisUrbCancel failed to abort pipe. rc=%Rrc\n", rc));661 662 LogFlow((USBPROXY ": usbProxySolarisUrbCancel: rc=%Rrc.\n", rc));667 LogRel((USBPROXY ": usbProxySolarisUrbCancel: Failed to abort pipe. rc=%Rrc\n", rc)); 668 669 LogFlow((USBPROXY ": usbProxySolarisUrbCancel: returns rc=%Rrc\n", rc)); 663 670 return rc; 664 671 } … … 675 682 static DECLCALLBACK(PVUSBURB) usbProxySolarisUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies) 676 683 { 677 //LogFlowFunc((USBPROXY ":usbProxySolarisUrbReap pProxyDev=%p cMillies=%u\n", pProxyDev, cMillies));684 LogFlowFunc((USBPROXY ":usbProxySolarisUrbReap pProxyDev=%p cMillies=%u\n", pProxyDev, cMillies)); 678 685 679 686 PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL); … … 693 700 { 694 701 int cMilliesWait = cMillies == RT_INDEFINITE_WAIT ? -1 : (int)cMillies; 695 struct pollfd pfd[2]; 696 697 pfd[0].fd = RTFileToNative(pDevSol->hFile); 698 pfd[0].events = POLLIN; 699 pfd[0].revents = 0; 700 701 pfd[1].fd = RTPipeToNative(pDevSol->hPipeWakeupR); 702 pfd[1].events = POLLIN; 703 pfd[1].revents = 0; 704 705 int rc = poll(&pfd[0], 2, cMilliesWait); 702 703 struct pollfd aFd[2]; 704 size_t const cFds = RT_ELEMENTS(aFd); 705 706 aFd[0].fd = RTFileToNative(pDevSol->hFile); 707 aFd[0].events = POLLIN; 708 aFd[0].revents = 0; 709 710 aFd[1].fd = RTPipeToNative(pDevSol->hPipeWakeupR); 711 aFd[1].events = POLLIN; 712 aFd[1].revents = 0; 713 714 int rc = poll(&aFd[0], cFds, cMilliesWait); 706 715 if (rc > 0) 707 716 { 708 if ( pfd[0].revents & POLLHUP)717 if (aFd[0].revents & POLLHUP) 709 718 { 710 LogRel((USBPROXY ": Reaping failed,USB Device '%s' disconnected!\n", pDevSol->pProxyDev->pUsbIns->pszName));719 LogRel((USBPROXY ": USB Device '%s' disconnected!\n", pDevSol->pProxyDev->pUsbIns->pszName)); 711 720 pProxyDev->fDetached = true; 712 721 usbProxySolarisCloseFile(pDevSol); 713 722 } 714 723 715 if ( pfd[1].revents & POLLIN)724 if (aFd[1].revents & POLLIN) 716 725 { 717 726 /* Got woken up, drain pipe. */ … … 725 734 * immediately to the caller. 726 735 */ 727 if (!( pfd[0].revents & POLLIN))736 if (!(aFd[0].revents & POLLIN)) 728 737 return NULL; 729 738 } 730 731 739 break; 732 740 } 733 734 if (rc == 0) 735 { 736 //LogFlow((USBPROXY ":usbProxySolarisUrbReap: Timed out\n")); 741 else if (rc == 0) 737 742 return NULL; 738 } 739 else if (rc != EAGAIN) 743 else if (errno != EAGAIN) 740 744 { 741 745 LogFlow((USBPROXY ":usbProxySolarisUrbReap Poll rc=%d errno=%d\n", rc, errno)); … … 751 755 */ 752 756 PVUSBURB pUrb = NULL; 753 while (pDevSol->pTaxingHead) 757 while ( pDevSol->pTaxingHead 758 && !pUrb) 754 759 { 755 760 RTCritSectEnter(&pDevSol->CritSect); … … 761 766 if (pUrb) 762 767 { 768 /* 769 * Remove it from the taxing list and move it to the free list. 770 */ 763 771 pUrb->Dev.pvPrivate = NULL; 764 772 usbProxySolarisUrbFree(pDevSol, pUrbSol); … … 779 787 static PVUSBURB usbProxySolarisUrbComplete(PUSBPROXYDEVSOL pDevSol) 780 788 { 781 LogFlowFunc((USBPROXY ": usbProxySolarisUrbCompletepDevSol=%p\n", pDevSol));789 LogFlowFunc((USBPROXY ": usbProxySolarisUrbComplete: pDevSol=%p\n", pDevSol)); 782 790 783 791 VBOXUSBREQ_URB UrbReq; … … 809 817 } 810 818 811 LogFlow((USBPROXY ":usbProxySolarisUrbComplete ISOCcbData=%d cbActPktSum=%d\n", pUrb->cbData, cbData));819 LogFlow((USBPROXY ":usbProxySolarisUrbComplete: Isoc cbData=%d cbActPktSum=%d\n", pUrb->cbData, cbData)); 812 820 pUrb->cbData = cbData; 813 821 pUrb->enmStatus = UrbReq.enmStatus; … … 835 843 836 844 /* 837 * Link it intothe taxing list.845 * Add to the tail of the taxing list. 838 846 */ 839 847 pUrbSol->pNext = NULL; … … 847 855 RTCritSectLeave(&pDevSol->CritSect); 848 856 849 LogFlow((USBPROXY "usbProxySolarisUrbComplete: cb=%d EndPt=%#x enmDir=%d enmStatus=%s (%d) \n", 850 pUrb->cbData, pUrb->EndPt, pUrb->enmDir, pUrb->enmStatus == VUSBSTATUS_OK ? "OK" : "** Failed **", pUrb->enmStatus)); 851 // if (pUrb->cbData < 2049) 852 // LogFlow((USBPROXY "%.*Rhxd\n", pUrb->cbData, pUrb->abData)); 857 Log6((USBPROXY ": Reaping: EndPt=%#x Dir=%d cbData=%u\n", pUrb->EndPt, pUrb->enmDir, pUrb->cbData)); 858 if (pUrb->cbData < 1024) 859 Log6(("%.*Rhxd\n", pUrb->cbData, pUrb->abData)); 853 860 return pUrb; 854 861 } … … 858 865 { 859 866 if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED) 860 LogRel((USBPROXY ": Reaping URB failed. rc=%Rrc\n", rc));867 LogRel((USBPROXY ": Reaping URB failed. rc=%Rrc\n", rc)); 861 868 } 862 869
Note:
See TracChangeset
for help on using the changeset viewer.