VirtualBox

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


Ignore:
Timestamp:
Jul 7, 2022 1:18:09 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152176
Message:

DrvKeyboardQueue: Added PS/2 to USB HID translation for consumer control and desktop control keys (see bugref:10256).

File:
1 edited

Legend:

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

    r93115 r95551  
    113113};
    114114
    115 /** Lookup table for extended scancodes (arrow keys etc.). */
    116 static const uint8_t aExtScan2Hid[] =
    117 {
    118     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00-07 */
    119     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 08-1F */
    120     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10-17 */
    121     0x00, 0x00, 0x00, 0x00, 0x58, 0xe4, 0x00, 0x00, /* 18-1F */
    122     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20-27 */
    123     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28-2F */
    124     0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46, /* 30-37 */
     115/* Keyboard usage page (07h). */
     116#define KB(key)     (RT_MAKE_U32(0, USB_HID_KB_PAGE) | (uint16_t)key)
     117/* Consumer Control usage page (0Ch). */
     118#define CC(key)     (RT_MAKE_U32(0, USB_HID_CC_PAGE) | (uint16_t)key)
     119/* Generic Desktop Control usage page (01h). */
     120#define DC(key)     (RT_MAKE_U32(0, USB_HID_DC_PAGE) | (uint16_t)key)
     121
     122/** Lookup table for extended scancodes (arrow keys etc.).
     123 *  Some of these keys use HID usage pages other than the
     124 *  standard (07). */
     125static const uint32_t aExtScan2Hid[] =
     126{
     127    KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), /* 00-07 */
     128    KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), /* 08-1F */
     129    CC(0x0B6), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), /* 10-17 */
     130    KB(0x000), CC(0x0B5), KB(0x000), KB(0x000), KB(0x058), KB(0x0e4), KB(0x000), KB(0x000), /* 18-1F */
     131    CC(0x0E2), CC(0x192), CC(0x0CD), KB(0x000), CC(0x0B7), KB(0x000), KB(0x000), KB(0x000), /* 20-27 */
     132    KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), CC(0x0EA), KB(0x000), /* 28-2F */
     133    CC(0x0E9), KB(0x000), CC(0x223), KB(0x000), KB(0x000), KB(0x054), KB(0x000), KB(0x046), /* 30-37 */
    125134    /* Sun-specific keys.  Most of the XT codes are made up  */
    126     0xe6, 0x00, 0x00, 0x75, 0x76, 0x77, 0xA3, 0x78, /* 38-3F */
    127     0x80, 0x81, 0x82, 0x79, 0x00, 0x00, 0x48, 0x4a, /* 40-47 */
    128     0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d, /* 48-4F */
    129     0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00, /* 50-57 */
    130     0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x66, 0x00, /* 58-5F */
    131     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60-67 */
    132     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68-6F */
    133     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
    134     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 78-7F */
     135    KB(0x0e6), KB(0x000), KB(0x000), KB(0x075), KB(0x076), KB(0x077), KB(0x0A3), KB(0x078), /* 38-3F */
     136    KB(0x080), KB(0x081), KB(0x082), KB(0x079), KB(0x000), KB(0x000), KB(0x048), KB(0x04a), /* 40-47 */
     137    KB(0x052), KB(0x04b), KB(0x000), KB(0x050), KB(0x000), KB(0x04f), KB(0x000), KB(0x04d), /* 48-4F */
     138    KB(0x051), KB(0x04e), KB(0x049), KB(0x04c), KB(0x000), KB(0x000), KB(0x000), KB(0x000), /* 50-57 */
     139    KB(0x000), KB(0x000), KB(0x000), KB(0x0e3), KB(0x0e7), KB(0x065), KB(0x066), DC(0x082), /* 58-5F */
     140    KB(0x000), KB(0x000), KB(0x000), DC(0x083), KB(0x000), CC(0x221), CC(0x22A), CC(0x227), /* 60-67 */
     141    CC(0x226), CC(0x225), CC(0x224), CC(0x194), CC(0x18A), CC(0x183), KB(0x000), KB(0x000), /* 68-6F */
     142    KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), /* 70-77 */
     143    KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000), KB(0x000)  /* 78-7F */
    135144};
    136145
     
    148157{
    149158    uint32_t    keyUp;
     159    uint32_t    usagePg;
    150160    uint8_t     usage;
    151161
     
    169179        break;
    170180    case SS_EXT:
    171         usage = aExtScan2Hid[scanCode & 0x7F];
    172         AssertMsg(usage, ("SS_EXT: scanCode=%02X\n", scanCode));
    173         *pUsage = usage | keyUp | HID_PG_KB_BITS;
     181        usagePg = aExtScan2Hid[scanCode & 0x7F];
     182        AssertMsg(usagePg, ("SS_EXT: scanCode=%02X\n", scanCode));
     183        *pUsage = usagePg | keyUp;
    174184        state = SS_IDLE;
    175185        break;
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