VirtualBox

Ignore:
Timestamp:
Feb 23, 2012 4:08:49 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76445
Message:

BIOS: Do not let fake shift keys modify shift flags.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS-new/keyboard.c

    r39946 r40236  
    346346{
    347347    uint8_t scancode, asciicode, shift_flags;
    348     uint8_t mf2_flags, mf2_state;
     348    uint8_t mf2_flags, mf2_state, flag;
    349349   
    350350    //
     
    377377        write_byte(0x0040, 0x18, mf2_flags);
    378378        break;
    379    
     379
    380380    case 0x2a: /* L Shift press */
    381         shift_flags |= 0x02;
    382         write_byte(0x0040, 0x17, shift_flags);
    383         break;
    384381    case 0xaa: /* L Shift release */
    385         shift_flags &= ~0x02;
    386         write_byte(0x0040, 0x17, shift_flags);
    387         break;
    388    
    389382    case 0x36: /* R Shift press */
    390         shift_flags |= 0x01;
    391         write_byte(0x0040, 0x17, shift_flags);
    392         break;
    393383    case 0xb6: /* R Shift release */
    394         shift_flags &= ~0x01;
    395         write_byte(0x0040, 0x17, shift_flags);
    396         break;
    397    
     384        /* If this was an extended (i.e. faked) key, leave flags alone. */
     385        if (!(mf2_state & 0x02)) {
     386            flag = (scancode & 0x7f) == 0x2a ? 0x02 : 0x01;
     387            if (scancode & 0x80)
     388                shift_flags &= ~flag;
     389            else
     390                shift_flags |= flag;
     391            write_byte(0x0040, 0x17, shift_flags);
     392        }
     393        break;
     394
    398395    case 0x1d: /* Ctrl press */
    399396        if ((mf2_state & 0x01) == 0) {
     
    551548        *ascii_code = acode;
    552549        *scan_code  = scode;
    553        
     550        BX_DEBUG_INT16("dequeue_key: ascii=%02x scan=%02x \n", acode, scode);
     551
    554552        if (incr) {
    555553            buffer_head += 2;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette