- Timestamp:
- Nov 4, 2013 2:32:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/PS2K.cpp
r49254 r49384 75 75 #define KRSP_ID2 0x83 76 76 #define KRSP_BAT_OK 0xAA 77 #define KRSP_BAT_FAIL 0xFC 77 #define KRSP_BAT_FAIL 0xFC /* Also a 'release keys' signal. */ 78 78 #define KRSP_ECHO 0xEE 79 79 #define KRSP_ACK 0xFA … … 1141 1141 } 1142 1142 1143 /* Release any and all currently depressed keys. Used whenever the guest keyboard 1144 * is likely to be out of sync with the host, such as when loading a saved state 1145 * or resuming a suspended host. 1146 */ 1147 static void ps2kReleaseKeys(PPS2K pThis) 1148 { 1149 LogFlowFunc(("Releasing keys...\n")); 1150 LogRel(("Releasing keys...\n")); 1151 1152 for (unsigned uKey = 0; uKey < sizeof(pThis->abDepressedKeys); ++uKey) 1153 if (pThis->abDepressedKeys[uKey]) 1154 { 1155 LogRel(("Releasing key %02X\n", uKey)); 1156 psk2ProcessKeyEvent(pThis, uKey, false /* key up */); 1157 pThis->abDepressedKeys[uKey] = 0; 1158 } 1159 LogFlowFunc(("Done releasing keys\n")); 1160 } 1161 1143 1162 1144 1163 /** … … 1240 1259 PPS2K pThis = RT_FROM_MEMBER(pInterface, PS2K, Keyboard.IPort); 1241 1260 uint32_t u32Usage = 0; 1261 int rc; 1242 1262 1243 1263 LogFlowFunc(("key code %02X\n", u8KeyCode)); 1244 pThis->XlatState = ScancodeToHidUsage(pThis->XlatState, u8KeyCode, &u32Usage); 1245 1246 if (pThis->XlatState == SS_IDLE) 1247 { 1248 /* Stupid Korean key hack: convert a lone break key into a press/release sequence. */ 1249 if (u32Usage == 0x80000090 || u32Usage == 0x80000091) 1250 ps2kPutEventWorker(pThis, u32Usage & ~0x80000000); 1251 1252 ps2kPutEventWorker(pThis, u32Usage); 1264 1265 /* The 'BAT fail' scancode is reused as a signal to release keys. No actual 1266 * key is allowed to use this scancode. 1267 */ 1268 if (RT_UNLIKELY(u8KeyCode == KRSP_BAT_FAIL)) 1269 { 1270 rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY); 1271 AssertReleaseRC(rc); 1272 1273 ps2kReleaseKeys(pThis); 1274 1275 PDMCritSectLeave(pThis->pCritSectR3); 1276 } 1277 else 1278 { 1279 pThis->XlatState = ScancodeToHidUsage(pThis->XlatState, u8KeyCode, &u32Usage); 1280 1281 if (pThis->XlatState == SS_IDLE) 1282 { 1283 /* Stupid Korean key hack: convert a lone break key into a press/release sequence. */ 1284 if (u32Usage == 0x80000090 || u32Usage == 0x80000091) 1285 ps2kPutEventWorker(pThis, u32Usage & ~0x80000000); 1286 1287 ps2kPutEventWorker(pThis, u32Usage); 1288 } 1253 1289 } 1254 1290 … … 1341 1377 SSMR3PutU32(pSSM, cPressed); 1342 1378 1343 for (unsigned i = 0; i < sizeof(pThis->abDepressedKeys); ++i)1344 if (pThis->abDepressedKeys[ i])1345 SSMR3PutU8(pSSM, pThis->abDepressedKeys[i]);1379 for (unsigned uKey = 0; uKey < sizeof(pThis->abDepressedKeys); ++uKey) 1380 if (pThis->abDepressedKeys[uKey]) 1381 SSMR3PutU8(pSSM, uKey); 1346 1382 1347 1383 /* Save the typematic settings for Scan Set 3. */ … … 1389 1425 AssertRCReturn(rc, rc); 1390 1426 1391 while (cPressed--) 1392 { 1393 rc = SSMR3GetU8(pSSM, &u8); 1394 AssertRCReturn(rc, rc); 1395 psk2ProcessKeyEvent(pThis, u8, false /* key up */); 1427 /* If any keys were down, load and then release them. */ 1428 if (cPressed) 1429 { 1430 for (unsigned i = 0; i < cPressed; ++i) 1431 { 1432 rc = SSMR3GetU8(pSSM, &u8); 1433 AssertRCReturn(rc, rc); 1434 pThis->abDepressedKeys[u8] = 1; 1435 } 1436 ps2kReleaseKeys(pThis); 1396 1437 } 1397 1438
Note:
See TracChangeset
for help on using the changeset viewer.