VirtualBox

Changeset 55073 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Apr 1, 2015 1:56:17 PM (10 years ago)
Author:
vboxsync
Message:

PS2K: HID LEDs sync: notify listener (GUI) about LEDs state on VM restore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Input/PS2K.cpp

    r54261 r55073  
    611611}
    612612
     613#ifdef IN_RING3
     614/**
     615 * Notify listener about LEDs state change.
     616 *
     617 * @param   pThis           The PS/2 keyboard instance data.
     618 * @param   u8State         Bitfield which reflects LEDs state.
     619 */
     620static void PS2KNotifyLedsState(PPS2K pThis, uint8_t u8State)
     621{
     622
     623    PDMKEYBLEDS enmLeds = PDMKEYBLEDS_NONE;
     624
     625    if (u8State & 0x01)
     626        enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_SCROLLLOCK);
     627    if (u8State & 0x02)
     628        enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_NUMLOCK);
     629    if (u8State & 0x04)
     630        enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_CAPSLOCK);
     631
     632    pThis->Keyboard.pDrv->pfnLedStatusChange(pThis->Keyboard.pDrv, enmLeds);
     633
     634}
     635#endif /* IN_RING3 */
     636
    613637/**
    614638 * Receive and process a byte sent by the keyboard controller.
     
    696720#else
    697721                    {
    698                         PDMKEYBLEDS enmLeds = PDMKEYBLEDS_NONE;
    699 
    700                         if (cmd & 0x01)
    701                             enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_SCROLLLOCK);
    702                         if (cmd & 0x02)
    703                             enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_NUMLOCK);
    704                         if (cmd & 0x04)
    705                             enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_CAPSLOCK);
    706                         pThis->Keyboard.pDrv->pfnLedStatusChange(pThis->Keyboard.pDrv, enmLeds);
     722                        PS2KNotifyLedsState(pThis, cmd);
    707723                        pThis->fNumLockOn = !!(cmd & 0x02); /* Sync internal Num Lock state. */
    708724                        ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK);
     
    13351351     */
    13361352    ps2kReleaseKeys(pThis);
     1353#ifdef IN_RING3
     1354    PS2KNotifyLedsState(pThis, pThis->u8LEDs);
     1355#endif
    13371356    return VINF_SUCCESS;
    13381357}
Note: See TracChangeset for help on using the changeset viewer.

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