https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e00ea7daddfa21ba692d6d9a22d460d79920c6fc

commit e00ea7daddfa21ba692d6d9a22d460d79920c6fc
Author:     Dmitry Borisov <[email protected]>
AuthorDate: Wed Jan 29 21:49:31 2020 +0600
Commit:     GitHub <[email protected]>
CommitDate: Wed Jan 29 16:49:31 2020 +0100

    [FREELDR] Properly set keyboard flags in hardware detection (#2288)
    
    See 
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_cm_keyboard_device_data
---
 boot/freeldr/freeldr/arch/i386/machpc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/boot/freeldr/freeldr/arch/i386/machpc.c 
b/boot/freeldr/freeldr/arch/i386/machpc.c
index 95253971c02..3ca5578aa4b 100644
--- a/boot/freeldr/freeldr/arch/i386/machpc.c
+++ b/boot/freeldr/freeldr/arch/i386/machpc.c
@@ -919,6 +919,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA 
ControllerKey)
     PCM_KEYBOARD_DEVICE_DATA KeyboardData;
     PCONFIGURATION_COMPONENT_DATA PeripheralKey;
     ULONG Size;
+    REGS Regs;
 
     /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2
     if (DetectKeyboardDevice()) */
@@ -944,12 +945,21 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA 
ControllerKey)
         PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
         PartialDescriptor->u.DeviceSpecificData.DataSize = 
sizeof(CM_KEYBOARD_DEVICE_DATA);
 
+        /* Int 16h AH=02h
+         * KEYBOARD - GET SHIFT FLAGS
+         *
+         * Return:
+         * AL - shift flags
+         */
+        Regs.b.ah = 0x02;
+        Int386(0x16, &Regs, &Regs);
+
         KeyboardData = (PCM_KEYBOARD_DEVICE_DATA)(PartialDescriptor + 1);
         KeyboardData->Version = 1;
         KeyboardData->Revision = 1;
         KeyboardData->Type = 4;
         KeyboardData->Subtype = 0;
-        KeyboardData->KeyboardFlags = 0x20;
+        KeyboardData->KeyboardFlags = Regs.b.al;
 
         /* Create controller key */
         FldrCreateComponentKey(ControllerKey,

Reply via email to