Changeset 95427 in vbox for trunk/src/VBox
- Timestamp:
- Jun 29, 2022 1:13:38 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/UsbKbd.cpp
r93115 r95427 1194 1194 1195 1195 iKeyCode = usbHidToInternalCode(idUsage); 1196 AssertReturn( iKeyCode > 0 && iKeyCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR);1196 AssertReturn((iKeyCode > 0 && iKeyCode <= VBOX_USB_MAX_USAGE_CODE) || (idUsage & PDMIKBDPORT_RELEASE_KEYS), VERR_INTERNAL_ERROR); 1197 1197 1198 1198 RTCritSectEnter(&pThis->CritSect); 1199 1199 1200 LogFlowFunc(("key %s: %08X (iKeyCode 0x%x)\n", fKeyDown ? "down" : "up", idUsage, iKeyCode));1201 1202 /*1203 * Due to host key repeat, we can get key events for keys which are 1204 * already depressed. Drop those right here.1205 */1206 if (fKeyDown && pThis->abDepressedKeys[iKeyCode])1207 fHaveEvent = false;1208 1209 /* If there is already a pending event, we won't accept a new one yet. */1210 if (pIf->fHasPendingChanges && fHaveEvent) 1211 {1212 rc = VERR_TRY_AGAIN;1213 }1214 else if (fHaveEvent)1215 {1216 if (RT_LIKELY(!(idUsage & PDMIKBDPORT_RELEASE_KEYS)))1200 if (RT_LIKELY(!(idUsage & PDMIKBDPORT_RELEASE_KEYS))) 1201 { 1202 LogFlowFunc(("key %s: %08X (iKeyCode 0x%x)\n", fKeyDown ? "down" : "up", idUsage, iKeyCode)); 1203 1204 /* 1205 * Due to host key repeat, we can get key events for keys which are 1206 * already depressed. Drop those right here. 1207 */ 1208 if (fKeyDown && pThis->abDepressedKeys[iKeyCode]) 1209 fHaveEvent = false; 1210 1211 /* If there is already a pending event, we won't accept a new one yet. */ 1212 if (pIf->fHasPendingChanges && fHaveEvent) 1213 { 1214 rc = VERR_TRY_AGAIN; 1215 } 1216 else if (fHaveEvent) 1217 1217 { 1218 1218 /* Regular key event - update keyboard state. */ … … 1221 1221 else 1222 1222 pThis->abDepressedKeys[iKeyCode] = 0; 1223 1224 /* 1225 * Try sending a report. Note that we already decided to consume the 1226 * event regardless of whether a URB is available or not. If it's not, 1227 * we will simply not accept any further events. 1228 */ 1229 usbHidSendReport(pThis, pIf); 1223 1230 } 1224 else 1225 { 1226 /* Clear all currently depressed keys. */ 1227 RT_ZERO(pThis->abDepressedKeys); 1228 } 1229 1230 /* 1231 * Try sending a report. Note that we already decided to consume the 1232 * event regardless of whether a URB is available or not. If it's not, 1233 * we will simply not accept any further events. 1234 */ 1235 usbHidSendReport(pThis, pIf); 1231 } 1232 else 1233 { 1234 LogFlowFunc(("Release all keys.\n")); 1235 1236 /* Clear all currently depressed keys. */ 1237 RT_ZERO(pThis->abDepressedKeys); 1236 1238 } 1237 1239
Note:
See TracChangeset
for help on using the changeset viewer.