Changeset 40096 in vbox for trunk/src/VBox/Devices/Input
- Timestamp:
- Feb 13, 2012 4:54:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/PS2K.cpp
r39977 r40096 246 246 247 247 /* Special key values. */ 248 #define NONE 0x9 0/* No PS/2 scan code returned. */249 #define UNAS 0x9 1/* No PS/2 scan assigned to key. */250 #define RSVD 0x9 2/* Reserved, do not use. */251 #define UNKN 0x9 3/* Translation unknown. */248 #define NONE 0x93 /* No PS/2 scan code returned. */ 249 #define UNAS 0x94 /* No PS/2 scan assigned to key. */ 250 #define RSVD 0x95 /* Reserved, do not use. */ 251 #define UNKN 0x96 /* Translation unknown. */ 252 252 253 253 /* Key definition structure. */ … … 488 488 /* Sun-specific keys. Most of the XT codes are made up */ 489 489 0xe6, 0x00, 0x00, 0x75, 0x76, 0x77, 0xA3, 0x78, /* 38-3F */ 490 0x80, 0x81, 0x82, 0x79, 0x00, 0x 48, 0x00, 0x4a, /* 40-47 */490 0x80, 0x81, 0x82, 0x79, 0x00, 0x00, 0x48, 0x4a, /* 40-47 */ 491 491 0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d, /* 48-4F */ 492 492 0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00, /* 50-57 */ … … 857 857 pKeyDef = u8HidCode >= HID_MODIFIER_FIRST ? &aPS2ModKeys[u8HidCode - HID_MODIFIER_FIRST] : &aPS2Keys[u8HidCode]; 858 858 859 /* Some keys are not processed at all; early return. */ 860 if (pKeyDef->makeS1 == NONE) 861 { 862 LogFlow(("Skipping key processing.\n")); 863 return VINF_SUCCESS; 864 } 865 859 866 /* Handle modifier keys (Ctrl/Alt/Shift/GUI). We need to keep track 860 867 * of their state in addition to sending the scan code. … … 881 888 if (fKeyDown) 882 889 { 890 /* Process key down event. */ 883 891 if (pKeyDef->keyFlags & KF_PB) 884 892 { … … 913 921 strcpy((char *)abCodes, "\xE0\xF0\x59"); 914 922 } 915 916 923 } 917 924 /* Feed the bytes to the queue if there is room. */ … … 921 928 Assert(i < sizeof(abCodes)); 922 929 923 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS | KF_PS)) 924 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 925 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 930 /* Standard processing for regular keys only. */ 931 if (!(pKeyDef->keyFlags & (KF_PB | KF_PS))) 932 { 933 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS)) 934 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 935 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 936 } 926 937 } 927 938 else if (!(pKeyDef->keyFlags & (KF_NB | KF_PB))) 928 939 { 929 930 /* Process base scan code. */ 931 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS | KF_PS)) 932 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 933 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xF0); 934 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 935 936 /* Restore shift state for gray keys. */ 937 if (pKeyDef->keyFlags & KF_GK) 940 /* Process key up event except for keys which produce none. */ 941 942 /* Handle Print Screen release. */ 943 if (pKeyDef->keyFlags & KF_PS) 938 944 { 939 if (pThis->fNumLockOn) 945 /* Undo faked Print Screen state as needed. */ 946 if (pThis->u8Modifiers & (MOD_LALT | MOD_RALT)) 947 strcpy((char *)abCodes, "\xF0\x84"); 948 else if (pThis->u8Modifiers & (MOD_LSHIFT | MOD_RSHIFT)) 949 strcpy((char *)abCodes, "\xE0\xF0\x7C"); 950 else 951 strcpy((char *)abCodes, "\xE0\xF0\x7C\xE0\xF0\x12"); 952 } 953 else 954 { 955 /* Process base scan code for less unusual keys. */ 956 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS)) 957 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 958 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xF0); 959 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 960 961 /* Restore shift state for gray keys. */ 962 if (pKeyDef->keyFlags & KF_GK) 940 963 { 941 if ((pThis->u8Modifiers & (MOD_LSHIFT | MOD_RSHIFT)) == 0) 942 strcpy((char *)abCodes, "\xE0\xF0\x12"); 943 } 944 else 945 { 946 if (pThis->u8Modifiers & MOD_LSHIFT) 947 strcpy((char *)abCodes, "\xE0\x12"); 948 if (pThis->u8Modifiers & MOD_RSHIFT) 949 strcpy((char *)abCodes, "\xE0\x59"); 964 if (pThis->fNumLockOn) 965 { 966 if ((pThis->u8Modifiers & (MOD_LSHIFT | MOD_RSHIFT)) == 0) 967 strcpy((char *)abCodes, "\xE0\xF0\x12"); 968 } 969 else 970 { 971 if (pThis->u8Modifiers & MOD_LSHIFT) 972 strcpy((char *)abCodes, "\xE0\x12"); 973 if (pThis->u8Modifiers & MOD_RSHIFT) 974 strcpy((char *)abCodes, "\xE0\x59"); 975 } 950 976 } 951 977 } 952 /* Feed the bytes to the queue if there is room. */ 978 979 /* Feed any additional bytes to the queue if there is room. */ 953 980 //@todo: check empty space! 954 981 while (abCodes[i]) … … 1165 1192 uint32_t u32Usage = 0; 1166 1193 1194 LogFlowFunc(("key code %02X\n", u8KeyCode )); 1167 1195 pThis->XlatState = ScancodeToHidUsage(pThis->XlatState, u8KeyCode, &u32Usage); 1168 1196
Note:
See TracChangeset
for help on using the changeset viewer.