VirtualBox

Ignore:
Timestamp:
Jan 24, 2014 10:48:13 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
91835
Message:

USB/Proxy: More code cleanup and finish a few todos, also some new ones so it doesn't get boring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/solaris/USBProxyDevice-solaris.cpp

    r50232 r50234  
    494494    SetConfigReq.bConfigValue = iCfg;
    495495    int rc = usbProxySolarisIOCtl(pDevSol, VBOXUSB_IOCTL_SET_CONFIG, &SetConfigReq, sizeof(SetConfigReq));
    496     if (RT_SUCCESS(rc))
    497         return true;
    498 
    499     if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
     496    if (   RT_FAILURE(rc)
     497        && rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
    500498        LogRel((USBPROXY ":usbProxySolarisSetConfig failed to switch configuration. rc=%Rrc\n", rc));
    501499
    502     return false;
     500    return rc;
    503501}
    504502
     
    514512static DECLCALLBACK(int) usbProxySolarisClaimInterface(PUSBPROXYDEV pProxyDev, int iIf)
    515513{
    516     return true;
     514    return VINF_SUCCESS;
    517515}
    518516
     
    528526static DECLCALLBACK(int) usbProxySolarisReleaseInterface(PUSBPROXYDEV pProxyDev, int iIf)
    529527{
    530     return true;
     528    return VINF_SUCCESS;
    531529}
    532530
     
    548546    SetInterfaceReq.bAlternate = iAlt;
    549547    int rc = usbProxySolarisIOCtl(pDevSol, VBOXUSB_IOCTL_SET_INTERFACE, &SetInterfaceReq, sizeof(SetInterfaceReq));
    550     if (RT_SUCCESS(rc))
    551         return true;
    552 
    553     if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
     548    if (   RT_FAILURE(rc)
     549        && rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
    554550        LogRel((USBPROXY ":usbProxySolarisSetInterface failed to set interface. rc=%Rrc\n", rc));
    555551
    556     return false;
     552    return rc;
    557553}
    558554
     
    561557 * Clears the halted endpoint 'EndPt'.
    562558 */
    563 static DECLCALLBACK(bool) usbProxySolarisClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int EndPt)
     559static DECLCALLBACK(int) usbProxySolarisClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int EndPt)
    564560{
    565561    LogFlowFunc((USBPROXY ":usbProxySolarisClearHaltedEp pProxyDev=%p EndPt=%#x\n", pProxyDev, EndPt));
     
    571567    ClearEpReq.bEndpoint = EndPt;
    572568    int rc = usbProxySolarisIOCtl(pDevSol, VBOXUSB_IOCTL_CLEAR_EP, &ClearEpReq, sizeof(ClearEpReq));
    573     if (RT_SUCCESS(rc))
    574         return true;
    575 
    576     if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
     569    if (   RT_FAILURE(rc)
     570        && rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
    577571        LogRel((USBPROXY ":usbProxySolarisClearHaltedEp failed! rc=%Rrc\n", rc));
    578572
    579     return false;
     573    return rc;
    580574}
    581575
     
    596590    {
    597591        LogRel((USBPROXY ":usbProxySolarisUrbQueue: Failed to allocate URB.\n"));
    598         return false;
     592        return VERR_NO_MEMORY;
    599593    }
    600594
     
    632626            LogFlow((USBPROXY ":usbProxySolarisUrbQueue success cbData=%d.\n", pUrb->cbData));
    633627        pUrb->Dev.pvPrivate = pUrbSol;
    634         return true;
     628        return VINF_SUCCESS;
    635629    }
    636630
     
    639633             pProxyDev->pUsbIns->pszName, pUrb, pUrb->EndPt, UrbReq.bEndpoint, pUrb->enmType, pUrb->enmDir, pUrb->cbData, rc));
    640634
    641     return false;
     635    return rc;
    642636}
    643637
     
    650644 *          on Solaris. So we just abort pending URBs on the pipe.
    651645 */
    652 static DECLCALLBACK(void) usbProxySolarisUrbCancel(PVUSBURB pUrb)
     646static DECLCALLBACK(int) usbProxySolarisUrbCancel(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb)
    653647{
    654648    PUSBPROXYURBSOL pUrbSol = (PUSBPROXYURBSOL)pUrb->Dev.pvPrivate;
    655 
    656     PUSBPROXYDEV pProxyDev = PDMINS_2_DATA(pUrb->pUsbIns, PUSBPROXYDEV);
    657649    PUSBPROXYDEVSOL pDevSol = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVSOL);
    658650    AssertPtrReturnVoid(pDevSol);
     
    662654    /* Aborting the control pipe isn't supported, pretend success. */
    663655    if (!pUrb->EndPt)
    664         return;
     656        return VINF_SUCCESS;
    665657
    666658    VBOXUSBREQ_ABORT_PIPE AbortPipeReq;
    667659    AbortPipeReq.bEndpoint = pUrb->EndPt | (pUrb->enmDir == VUSBDIRECTION_IN ? VUSB_DIR_TO_HOST : VUSB_DIR_TO_DEVICE);
    668660    int rc = usbProxySolarisIOCtl(pDevSol, VBOXUSB_IOCTL_ABORT_PIPE, &AbortPipeReq, sizeof(AbortPipeReq));
    669     if (RT_FAILURE(rc))
    670     {
    671         if (rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
    672             LogRel((USBPROXY ":usbProxySolarisUrbCancel failed to abort pipe. rc=%Rrc\n", rc));
    673         return;
    674     }
    675 
    676     LogFlow((USBPROXY ":usbProxySolarisUrbCancel success.\n", rc));
     661    if (   RT_FAILURE(rc)
     662        && rc != VERR_VUSB_DEVICE_NOT_ATTACHED)
     663        LogRel((USBPROXY ":usbProxySolarisUrbCancel failed to abort pipe. rc=%Rrc\n", rc));
     664
     665    LogFlow((USBPROXY ":usbProxySolarisUrbCancel: rc=%Rrc.\n", rc));
     666    return rc;
    677667}
    678668
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette