fix for broken pc_keyb.c (late 2.2.x all 2.4.x kernel)

WHarms@bfs.de
Sat, 27 Oct 2001 16:09:51 +0100


hi list,
there is a logical problem with pc_keyb.c. if setting the leds does not work the keyboard will no longer exists.
attention:
pckbd_leds() is also know as kbd_leds() what is used quit often !

This is a quick fix ! (read: no real solution !)

some comments from my side:

1. the kbd_exists stuff is not realy documented. I should be removed or explaind properly.

2. the next better way is to check for the returncode from
send_data() and send kbd_exists accordingly.

3. kdb_rate works the same way but does not set kbd_exists

walter

*** pc_keyb.c Sat Oct 27 15:57:20 2001
--- pc_keyb.c.broken Sat Oct 27 15:46:45 2001
***************
*** 525,543 ****
return 0;
}

-
- /* someone added kbd_exists i dont know when or why */
- /* but there a few routines that ever check kdb_exists */
- /* if somebody understands it *please* document */
- /* The old code liked to shut down my keyboad */
- /* the routine is also known as kbd_leds() */
- /* walter.harms@informatik.uni-oldenburg.de */
-
void pckbd_leds(unsigned char leds)
{
if (kbd_exists && (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds))) {
send_data(KBD_CMD_ENABLE); /* re-enable kbd if any errors */
! kbd_exists = 1;
}
}

--- 525,535 ----
return 0;
}

void pckbd_leds(unsigned char leds)
{
if (kbd_exists && (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds))) {
send_data(KBD_CMD_ENABLE); /* re-enable kbd if any errors */
! kbd_exists = 0;
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/