- Timestamp:
- Nov 26, 2019 2:08:48 AM (5 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r82208 r82213 735 735 * @param pQHdr The queue header. 736 736 * @param cElements The queue size. 737 * @param abElements The queue element array.737 * @param pbElements The queue element array. 738 738 * @param bValue The byte to store. 739 739 */ … … 771 771 * @param pQHdr The queue header. 772 772 * @param cElements The queue size. 773 * @param abElements The queue element array.773 * @param pbElements The queue element array. 774 774 * @param pbValue Where to return the byte on success. 775 775 * … … 817 817 * @param pQHdr The queue header. 818 818 * @param cElements The queue size. 819 * @param abElements The queue element array.819 * @param pbElements The queue element array. 820 820 */ 821 821 void PS2CmnR3SaveQueue(PCPDMDEVHLPR3 pHlp, PSSMHANDLE pSSM, PPS2QHDR pQHdr, size_t cElements, uint8_t const *pbElements) … … 842 842 * @param pQHdr The queue header. 843 843 * @param cElements The queue size. 844 * @param abElements The queue element array.844 * @param pbElements The queue element array. 845 845 * 846 846 * @returns VBox status/error code. -
trunk/src/VBox/Devices/Input/DevPS2K.cpp
r82208 r82213 914 914 915 915 /** 916 * @callback_ function_impl{FNTMTIMERDEV}916 * @callback_method_impl{FNTMTIMERDEV} 917 917 * 918 918 * Throttling timer to emulate the finite keyboard communication speed. A PS/2 keyboard is … … 950 950 951 951 /** 952 * @callback_ function_impl{FNTMTIMERDEV,952 * @callback_method_impl{FNTMTIMERDEV, 953 953 * Timer handler for emulating typematic keys.} 954 954 * … … 978 978 979 979 /** 980 * @callback_ function_impl{FNTMTIMERDEV}980 * @callback_method_impl{FNTMTIMERDEV} 981 981 * 982 982 * The keyboard BAT is specified to take several hundred milliseconds. We need … … 1056 1056 * @param pDevIns The device instance. 1057 1057 * @param pThis The PS2 keyboard instance data. 1058 * @param u32UsageUSB HID usage code with key press/release flag.1059 */ 1060 static int ps2kR3PutEventWorker(PPDMDEVINS pDevIns, PPS2K pThis, uint32_t u32Usage)1058 * @param idUsage USB HID usage code with key press/release flag. 1059 */ 1060 static int ps2kR3PutEventWorker(PPDMDEVINS pDevIns, PPS2K pThis, uint32_t idUsage) 1061 1061 { 1062 1062 uint32_t u32HidCode; … … 1068 1068 1069 1069 /* Extract the usage page and ID and ensure it's valid. */ 1070 fKeyDown = !( u32Usage & 0x80000000);1071 u32HidCode = u32Usage & 0xFFFFFF;1072 u8HidPage = RT_LOBYTE(RT_HIWORD( u32Usage));1073 u8KeyCode = RT_LOBYTE( u32Usage);1070 fKeyDown = !(idUsage & UINT32_C(0x80000000)); 1071 u32HidCode = idUsage & 0xFFFFFF; 1072 u8HidPage = RT_LOBYTE(RT_HIWORD(idUsage)); 1073 u8KeyCode = RT_LOBYTE(idUsage); 1074 1074 if (u8HidPage == USB_HID_KB_PAGE) 1075 1075 AssertReturn(u8KeyCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR); … … 1107 1107 * @interface_method_impl{PDMIKEYBOARDPORT,pfnPutEventHid} 1108 1108 */ 1109 static DECLCALLBACK(int) ps2kR3KeyboardPort_PutEventHid(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageCode)1109 static DECLCALLBACK(int) ps2kR3KeyboardPort_PutEventHid(PPDMIKEYBOARDPORT pInterface, uint32_t idUsage) 1110 1110 { 1111 1111 PPS2KR3 pThisCC = RT_FROM_MEMBER(pInterface, PS2KR3, Keyboard.IPort); … … 1114 1114 int rc; 1115 1115 1116 LogRelFlowFunc(("key code %08X\n", u32UsageCode));1116 LogRelFlowFunc(("key code %08X\n", idUsage)); 1117 1117 1118 1118 rc = PDMDevHlpCritSectEnter(pDevIns, pDevIns->pCritSectRoR3, VERR_SEM_BUSY); … … 1122 1122 * key is allowed to use this scancode. 1123 1123 */ 1124 if (RT_LIKELY( u32UsageCode != KRSP_BAT_FAIL))1125 ps2kR3PutEventWorker(pDevIns, pThis, u32UsageCode);1124 if (RT_LIKELY(idUsage != KRSP_BAT_FAIL)) 1125 ps2kR3PutEventWorker(pDevIns, pThis, idUsage); 1126 1126 else 1127 1127 ps2kR3ReleaseKeys(pDevIns, pThis); -
trunk/src/VBox/Devices/Input/DevPS2M.cpp
r82208 r82213 416 416 * 417 417 * @param pDevIns The device instance. 418 * @param pThis The PS/2 auxiliary device instance data.418 * @param pThis The PS/2 auxiliary device shared instance data. 419 419 * @param cmd The command (or data) byte. 420 420 */ … … 638 638 * 639 639 * @returns VINF_SUCCESS or VINF_TRY_AGAIN. 640 * @param pThis The PS/2 auxiliary deviceinstance data.641 * @param pb 640 * @param pThis The PS/2 auxiliary device shared instance data. 641 * @param pb Where to return the byte we've read. 642 642 * @remarks Caller must have entered the device critical section. 643 643 */ … … 673 673 674 674 /** 675 * @callback_ function_impl{FNTMTIMERDEV,675 * @callback_method_impl{FNTMTIMERDEV, 676 676 * Event rate throttling timer to emulate the auxiliary device sampling rate.} 677 677 */ … … 704 704 705 705 /** 706 * @callback_ function_impl{FNTMTIMERDEV}706 * @callback_method_impl{FNTMTIMERDEV} 707 707 * 708 708 * The auxiliary device reset is specified to take up to about 500 milliseconds. … … 768 768 * @returns VBox status code. 769 769 * @param pDevIns The device instance. 770 * @param pThis The PS/2 auxiliary device instance data.770 * @param pThis The PS/2 auxiliary device shared instance data. 771 771 * @param dx X direction movement delta. 772 772 * @param dy Y direction movement delta. … … 883 883 * 884 884 * @returns VBox status code. 885 * @param pThis The PS/2 auxiliary device instance data.886 885 * @param pDevIns The device instance. 886 * @param pThisCC The PS/2 auxiliary device instance data for ring-3. 887 887 * @param iLUN The logical unit which is being detached. 888 888 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. -
trunk/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
r81214 r82213 83 83 PDMQUEUEITEMCORE Core; 84 84 /** The keycode. */ 85 uint32_t u32UsageCode;85 uint32_t idUsage; 86 86 } DRVKBDQUEUEITEM, *PDRVKBDQUEUEITEM; 87 87 … … 212 212 213 213 /** 214 * Queues a scancode-based keyboard event. 214 * @interface_method_impl{PDMIKEYBOARDPORT,pfnPutEventScan} 215 * 215 216 * Because of the event queueing the EMT context requirement is lifted. 216 *217 * @returns VBox status code.218 * @param pInterface Pointer to this interface structure.219 * @param u8ScanCode The scan code to translate/queue.220 217 * @thread Any thread. 221 218 */ … … 227 224 return VINF_SUCCESS; 228 225 229 uint32_t u32Usage = 0; 230 pDrv->XlatState = ScancodeToHidUsage(pDrv->XlatState, u8ScanCode, &u32Usage); 231 232 if (pDrv->XlatState == SS_IDLE) { 226 uint32_t idUsage = 0; 227 pDrv->XlatState = ScancodeToHidUsage(pDrv->XlatState, u8ScanCode, &idUsage); 228 229 if (pDrv->XlatState == SS_IDLE) 230 { 233 231 PDRVKBDQUEUEITEM pItem = (PDRVKBDQUEUEITEM)PDMQueueAlloc(pDrv->pQueue); 234 232 if (pItem) … … 239 237 * key up into a key up/key down sequence. 240 238 */ 241 if ( u32Usage == 0x80000090 || u32Usage == 0x80000091)239 if (idUsage == UINT32_C(0x80000090) || idUsage == UINT32_C(0x80000091)) 242 240 { 243 241 PDRVKBDQUEUEITEM pItem2 = (PDRVKBDQUEUEITEM)PDMQueueAlloc(pDrv->pQueue); … … 249 247 { 250 248 /* Manufacture a key down event. */ 251 pItem2-> u32UsageCode = u32Usage & ~0x80000000;249 pItem2->idUsage = idUsage & ~UINT32_C(0x80000000); 252 250 PDMQueueInsert(pDrv->pQueue, &pItem2->Core); 253 251 } 254 252 } 255 253 256 pItem-> u32UsageCode = u32Usage;254 pItem->idUsage = idUsage; 257 255 PDMQueueInsert(pDrv->pQueue, &pItem->Core); 258 256 … … 269 267 270 268 /** 271 * Queues a HID-usage-based keyboard event. 269 * @interface_method_impl{PDMIKEYBOARDPORT,pfnPutEventHid} 270 * 272 271 * Because of the event queueing the EMT context requirement is lifted. 273 *274 * @returns VBox status code.275 * @param pInterface Pointer to this interface structure.276 * @param u32UsageCode The HID usage code to queue.277 272 * @thread Any thread. 278 273 */ 279 static DECLCALLBACK(int) drvKbdQueuePutEventHid(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageCode)274 static DECLCALLBACK(int) drvKbdQueuePutEventHid(PPDMIKEYBOARDPORT pInterface, uint32_t idUsage) 280 275 { 281 276 PDRVKBDQUEUE pDrv = IKEYBOARDPORT_2_DRVKBDQUEUE(pInterface); … … 287 282 if (pItem) 288 283 { 289 pItem-> u32UsageCode = u32UsageCode;284 pItem->idUsage = idUsage; 290 285 PDMQueueInsert(pDrv->pQueue, &pItem->Core); 291 286 … … 357 352 PDRVKBDQUEUE pThis = PDMINS_2_DATA(pDrvIns, PDRVKBDQUEUE); 358 353 PDRVKBDQUEUEITEM pItem = (PDRVKBDQUEUEITEM)pItemCore; 359 int rc = pThis->pUpPort->pfnPutEventHid(pThis->pUpPort, pItem-> u32UsageCode);354 int rc = pThis->pUpPort->pfnPutEventHid(pThis->pUpPort, pItem->idUsage); 360 355 return RT_SUCCESS(rc); 361 356 } -
trunk/src/VBox/Devices/Input/UsbKbd.cpp
r76553 r82213 700 700 701 701 /** 702 * Keyboard event handler. 703 * 704 * @returns VBox status code. 705 * @param pInterface Pointer to the keyboard port interface (KBDState::Keyboard.IPort). 706 * @param u32UsageCode The key usage ID. 707 */ 708 static DECLCALLBACK(int) usbHidKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageCode) 702 * @interface_method_impl{PDMIKEYBOARDPORT,pfnPutEventHid} 703 */ 704 static DECLCALLBACK(int) usbHidKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint32_t idUsage) 709 705 { 710 706 PUSBHID pThis = RT_FROM_MEMBER(pInterface, USBHID, Lun0.IPort); … … 714 710 int rc = VINF_SUCCESS; 715 711 712 /* Let's see what we got... */ 713 fKeyDown = !(idUsage & UINT32_C(0x80000000)); 714 u8HidCode = idUsage & 0xFF; 715 AssertReturn(u8HidCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR); 716 716 717 RTCritSectEnter(&pThis->CritSect); 717 718 /* Let's see what we got... */719 fKeyDown = !(u32UsageCode & 0x80000000);720 u8HidCode = u32UsageCode & 0xFF;721 AssertReturn(u8HidCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR);722 718 723 719 LogFlowFunc(("key %s: 0x%x\n", fKeyDown ? "down" : "up", u8HidCode)); … … 737 733 else if (fHaveEvent) 738 734 { 739 if (RT_UNLIKELY(u32UsageCode == KRSP_BAT_FAIL)) 740 { 741 /* Clear all currently depressed and unreported keys. */ 742 RT_ZERO(pThis->abDepressedKeys); 743 } 744 else 735 if (RT_LIKELY(idUsage != KRSP_BAT_FAIL)) 745 736 { 746 737 /* Regular key event - update keyboard state. */ … … 749 740 else 750 741 pThis->abDepressedKeys[u8HidCode] = 0; 742 } 743 else 744 { 745 /* Clear all currently depressed and unreported keys. */ 746 RT_ZERO(pThis->abDepressedKeys); 751 747 } 752 748 -
trunk/src/VBox/Main/src-client/KeyboardImpl.cpp
r81369 r82213 255 255 return S_OK; 256 256 257 int vrc = VINF_SUCCESS; 258 uint32_t u32Usage; 259 u32Usage = (uint16_t)aUsageCode | ((uint32_t)(uint8_t)aUsagePage << 16) | (fKeyRelease ? 0x80000000 : 0); 260 vrc = pUpPort->pfnPutEventHid(pUpPort, u32Usage); 257 uint32_t idUsage = (uint16_t)aUsageCode | ((uint32_t)(uint8_t)aUsagePage << 16) | (fKeyRelease ? UINT32_C(0x80000000) : 0); 258 int vrc = pUpPort->pfnPutEventHid(pUpPort, idUsage); 261 259 if (RT_FAILURE(vrc)) 262 260 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc,
Note:
See TracChangeset
for help on using the changeset viewer.