VirtualBox

Changeset 37388 in vbox


Ignore:
Timestamp:
Jun 8, 2011 3:49:55 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72173
Message:

Devices/Input/UsbMouse, UsbKbd: Support explicit USB HID descriptor requests (USB HID spec 6.2.1), logging fix.

Location:
trunk/src/VBox/Devices/Input
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/UsbKbd.cpp

    r36445 r37388  
    4343/** @name USB HID specific descriptor types
    4444 * @{ */
     45#define DT_IF_HID_DESCRIPTOR        0x21
    4546#define DT_IF_HID_REPORT            0x22
    4647/** @} */
     
    318319        /* .MaxPower = */           50 /* 100mA */
    319320    },
    320     NULL,
    321     &g_aUsbHidInterfaces[0]
     321    NULL,                           /* pvMore */
     322    &g_aUsbHidInterfaces[0],
     323    NULL                            /* pvOriginal */
    322324};
    323325
     
    904906        AssertReturn(u8HidCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR);
    905907
    906         LogRelFlowFunc(("key %s: 0x%x->0x%x\n",
     908        LogFlowFunc(("key %s: 0x%x->0x%x\n",
    907909                        fKeyDown ? "down" : "up", u8KeyCode, u8HidCode));
    908910
     
    10841086                        switch (pSetup->wValue >> 8)
    10851087                        {
     1088                            case DT_IF_HID_DESCRIPTOR:
     1089                            {
     1090                                uint32_t    cbCopy;
     1091
     1092                                /* Returned data is written after the setup message. */
     1093                                cbCopy = pUrb->cbData - sizeof(*pSetup);
     1094                                cbCopy = RT_MIN(cbCopy, sizeof(g_UsbHidIfHidDesc));
     1095                                Log(("usbHidKbd: GET_DESCRIPTOR DT_IF_HID_DESCRIPTOR wValue=%#x wIndex=%#x cbCopy=%#x\n", pSetup->wValue, pSetup->wIndex, cbCopy));
     1096                                memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbHidIfHidDesc, cbCopy);
     1097                                return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
     1098                            }
     1099
    10861100                            case DT_IF_HID_REPORT:
     1101                            {
    10871102                                uint32_t    cbCopy;
    10881103
     
    10931108                                memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbHidReportDesc, cbCopy);
    10941109                                return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
     1110                            }
     1111
    10951112                            default:
    10961113                                Log(("usbHid: GET_DESCRIPTOR, huh? wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));
  • trunk/src/VBox/Devices/Input/UsbMouse.cpp

    r36445 r37388  
    4343/** @name USB HID specific descriptor types
    4444 * @{ */
     45#define DT_IF_HID_DESCRIPTOR        0x21
    4546#define DT_IF_HID_REPORT            0x22
    4647/** @} */
     
    409410        /* .MaxPower = */           50 /* 100mA */
    410411    },
    411     NULL,
    412     &g_aUsbHidMInterfaces[0]
     412    NULL,                           /* pvMore */
     413    &g_aUsbHidMInterfaces[0],
     414    NULL                            /* pvOriginal */
    413415};
    414416
     
    425427        /* .MaxPower = */           50 /* 100mA */
    426428    },
    427     NULL,
    428     &g_aUsbHidTInterfaces[0]
     429    NULL,                           /* pvMore */
     430    &g_aUsbHidTInterfaces[0],
     431    NULL                            /* pvOriginal */
    429432};
    430433
     
    960963                        switch (pSetup->wValue >> 8)
    961964                        {
     965                            case DT_IF_HID_DESCRIPTOR:
     966                            {
     967                                uint32_t        cbCopy;
     968                                uint32_t        cbDesc;
     969                                const uint8_t   *pDesc;
     970
     971                                if (pThis->isAbsolute)
     972                                {
     973                                    cbDesc = sizeof(g_UsbHidTIfHidDesc);
     974                                    pDesc = (const uint8_t *)&g_UsbHidTIfHidDesc;
     975                                }
     976                                else
     977                                {
     978                                    cbDesc = sizeof(g_UsbHidMIfHidDesc);
     979                                    pDesc = (const uint8_t *)&g_UsbHidMIfHidDesc;
     980                                }
     981                                /* Returned data is written after the setup message. */
     982                                cbCopy = pUrb->cbData - sizeof(*pSetup);
     983                                cbCopy = RT_MIN(cbCopy, cbDesc);
     984                                Log(("usbHidMouse: GET_DESCRIPTOR DT_IF_HID_DESCRIPTOR wValue=%#x wIndex=%#x cbCopy=%#x\n", pSetup->wValue, pSetup->wIndex, cbCopy));
     985                                memcpy(&pUrb->abData[sizeof(*pSetup)], pDesc, cbCopy);
     986                                return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
     987                            }
     988
    962989                            case DT_IF_HID_REPORT:
     990                            {
    963991                                uint32_t        cbCopy;
    964992                                uint32_t        cbDesc;
     
    9811009                                memcpy(&pUrb->abData[sizeof(*pSetup)], pDesc, cbCopy);
    9821010                                return usbHidCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
     1011                            }
     1012
    9831013                            default:
    9841014                                Log(("usbHid: GET_DESCRIPTOR, huh? wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));
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