Ticket #5163: boot_keys.patch

File boot_keys.patch, 1.6 KB (added by Grey, 14 years ago)
  • src/system/boot/platform/bios_ia32/keyboard.cpp

     
    5858extern "C" uint32
    5959check_for_boot_keys(void)
    6060{
    61     union key key;
    6261    uint32 options = 0;
    63 
    64     while ((key.ax = check_for_key()) != 0) {
    65         switch (key.code.ascii) {
    66             case ' ':
    67                 options |= BOOT_OPTION_MENU;
    68                 break;
    69             case 0x1b:  // escape
    70                 options |= BOOT_OPTION_DEBUG_OUTPUT;
    71                 break;
    72             case 0:
    73                 // evaluate BIOS scan codes
    74                 // ...
    75                 break;
    76         }
     62    bios_regs regs;
     63    regs.eax = 0x0200;
     64    call_bios(0x16, &regs);
     65        // Read Keyboard flags
     66        // bit 7 Insert, bit 6 CapsLock, bit 5 NumLock, bit 4 Scroll Lock
     67    if( (regs.eax & 0x40) != 0 ) {
     68            // CapsLock - option menu
     69        options |= BOOT_OPTION_MENU;
     70    } else if( (regs.eax & 0x10) != 0 ) {
     71            // Scroll Lock - debug output
     72        options |= BOOT_OPTION_DEBUG_OUTPUT;
    7773    }
    7874
    7975    dprintf("options = %ld\n", options);
  • src/system/boot/platform/bios_ia32/start.c

     
    129129    mmu_init();
    130130    parse_multiboot_commandline(&args);
    131131
    132     // wait a bit to give the user the opportunity to press a key
    133     spin(750000);
    134 
    135132    // reading the keyboard doesn't seem to work in graphics mode
    136133    // (maybe a bochs problem)
    137134    sBootOptions = check_for_boot_keys();