VirtualBox

Changeset 60486 in vbox


Ignore:
Timestamp:
Apr 14, 2016 9:57:02 AM (9 years ago)
Author:
vboxsync
Message:

VBoxUSB.sys: We will never see TRANSFER_TYPE_CTRL (only MSG).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp

    r60273 r60486  
    10761076        switch(pContext->ulTransferType)
    10771077        {
    1078             case USBSUP_TRANSFER_TYPE_CTRL:
    10791078            case USBSUP_TRANSFER_TYPE_MSG:
    10801079                pUrbInfo->len = pUrb->UrbControlTransfer.TransferBufferLength;
     
    11181117        switch(pContext->ulTransferType)
    11191118        {
    1120             case USBSUP_TRANSFER_TYPE_CTRL:
    11211119            case USBSUP_TRANSFER_TYPE_MSG:
    1122                 LogRel(("Ctrl/Msg length=%d\n", pUrb->UrbControlTransfer.TransferBufferLength));
     1120                LogRel(("Msg (CTRL) length=%d\n", pUrb->UrbControlTransfer.TransferBufferLength));
    11231121                break;
    11241122            case USBSUP_TRANSFER_TYPE_ISOC:
     
    12721270        switch (pUrbInfo->type)
    12731271        {
    1274             case USBSUP_TRANSFER_TYPE_CTRL:
    12751272            case USBSUP_TRANSFER_TYPE_MSG:
    12761273            {
     
    12851282                    pUrb->UrbControlTransfer.TransferFlags |= USBD_DEFAULT_PIPE_TRANSFER;
    12861283
    1287                 if (pUrbInfo->type == USBSUP_TRANSFER_TYPE_MSG)
    1288                 {
    1289                    /* QUSB_TRANSFER_TYPE_MSG is a control transfer, but it is special
    1290                     * the first 8 bytes of the buffer is the setup packet so the real
    1291                     * data length is therefore pUrb->len - 8
    1292                     */
    1293                     PVBOXUSB_SETUP pSetup = (PVBOXUSB_SETUP)pUrb->UrbControlTransfer.SetupPacket;
    1294                     memcpy(pUrb->UrbControlTransfer.SetupPacket, pBuffer, min(sizeof (pUrb->UrbControlTransfer.SetupPacket), pUrbInfo->len));
    1295 
    1296                     if (pUrb->UrbControlTransfer.TransferBufferLength <= sizeof (pUrb->UrbControlTransfer.SetupPacket))
    1297                         pUrb->UrbControlTransfer.TransferBufferLength = 0;
    1298                     else
    1299                         pUrb->UrbControlTransfer.TransferBufferLength -= sizeof (pUrb->UrbControlTransfer.SetupPacket);
    1300 
    1301                     pUrb->UrbControlTransfer.TransferBuffer = (uint8_t *)pBuffer + sizeof(pUrb->UrbControlTransfer.SetupPacket);
    1302                     pUrb->UrbControlTransfer.TransferBufferMDL = 0;
    1303                     pUrb->UrbControlTransfer.TransferFlags |= USBD_SHORT_TRANSFER_OK;
    1304                 }
     1284                /* QUSB_TRANSFER_TYPE_MSG is a control transfer, but it is special
     1285                 * the first 8 bytes of the buffer is the setup packet so the real
     1286                 * data length is therefore pUrb->len - 8
     1287                 */
     1288                PVBOXUSB_SETUP pSetup = (PVBOXUSB_SETUP)pUrb->UrbControlTransfer.SetupPacket;
     1289                memcpy(pUrb->UrbControlTransfer.SetupPacket, pBuffer, min(sizeof (pUrb->UrbControlTransfer.SetupPacket), pUrbInfo->len));
     1290
     1291                if (pUrb->UrbControlTransfer.TransferBufferLength <= sizeof (pUrb->UrbControlTransfer.SetupPacket))
     1292                    pUrb->UrbControlTransfer.TransferBufferLength = 0;
    13051293                else
    1306                 {
    1307                     pUrb->UrbControlTransfer.TransferBuffer = 0;
    1308                     pUrb->UrbControlTransfer.TransferBufferMDL = pMdlBuf;
    1309                 }
     1294                    pUrb->UrbControlTransfer.TransferBufferLength -= sizeof (pUrb->UrbControlTransfer.SetupPacket);
     1295
     1296                pUrb->UrbControlTransfer.TransferBuffer = (uint8_t *)pBuffer + sizeof(pUrb->UrbControlTransfer.SetupPacket);
     1297                pUrb->UrbControlTransfer.TransferBufferMDL = 0;
     1298                pUrb->UrbControlTransfer.TransferFlags |= USBD_SHORT_TRANSFER_OK;
    13101299                break;
    13111300            }
Note: See TracChangeset for help on using the changeset viewer.

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