Changeset 5173


Ignore:
Timestamp:
Feb 28, 2010, 8:12:37 PM (5 years ago)
Author:
stepan
Message:

use names instead of numbers where possible, also print a better message if no
keyboard is connected.

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Stefan Reinauer <stepan@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/pc80/keyboard.c

    r5152 r5173  
    155155                regval = inb(KBD_DATA);
    156156                --resend;
    157         } while (regval == 0xFE && resend > 0);
     157        } while (regval == KBD_REPLY_RESEND && resend > 0);
    158158
    159159        return regval;
     
    184184        /* reset keyboard and self test (keyboard side) */
    185185        regval = send_keyboard(0xFF);
    186         if (regval != 0xFA) {
     186        if (regval == KBD_REPLY_RESEND) {
     187                /* keeps sending RESENDs, probably no keyboard. */
     188                printk_info("No PS/2 keyboard detected.\n");
     189                return;
     190        }
     191
     192        if (regval != KBD_REPLY_ACK) {
    187193                printk_err("Keyboard selftest failed ACK: 0x%x\n", regval);
    188194                return;
     
    207213        /* disable the keyboard */
    208214        regval = send_keyboard(0xF5);
    209         if (regval != 0xFA) {
     215        if (regval != KBD_REPLY_ACK) {
    210216                printk_err("Keyboard disable failed ACK: 0x%x\n", regval);
    211217                return;
     
    214220        /* Set scancode command */
    215221        regval = send_keyboard(0xF0);
    216         if (regval != 0xFA) {
     222        if (regval != KBD_REPLY_ACK) {
    217223                printk_err("Keyboard set scancode cmd failed ACK: 0x%x\n", regval);
    218224                return;
     
    220226        /* Set scancode mode 2 */
    221227        regval = send_keyboard(0x02);
    222         if (regval != 0xFA) {
     228        if (regval != KBD_REPLY_ACK) {
    223229                printk_err("Keyboard set scancode mode failed ACK: 0x%x\n", regval);
    224230                return;
     
    227233        /* enable the keyboard */
    228234        regval = send_keyboard(0xF4);
    229         if (regval != 0xFA) {
     235        if (regval != KBD_REPLY_ACK) {
    230236                printk_err("Keyboard enable failed ACK: 0x%x\n", regval);
    231237                return;
Note: See TracChangeset for help on using the changeset viewer.