Skip to contentSkip to conversation

config option to make at keyboards beep when too many keys are pressed

PATCH In review ameer armaly 2 participants 2 messages Apr 19, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config option to make at keyboards beep when too many keys are pressed

Hi all.
Here are two patches, that should be applied in /usr/src/linux/drivers/input. These make a config option, that if selected, allows atd keyboards to beep rather than cluttering the screen
with messages about too many keys pressed. This has been patched
against the latest kernel tree from bitkeeper.

atkbd.c renamed from atkbd.orig +5 -1
@@ -284,8 +284,12 @@
 			atkbd_report_key(&atkbd->dev, regs, KEY_HANJA, 3);
 			goto out;
 		case ATKBD_RET_ERR:
+#ifndef CONFIG_BEEP_TOMANY_KEYS
 			printk(KERN_WARNING "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys);
-			goto out;
+
+#else
+printk(KERN_ALERT, "\007");
+#endif			goto out;
 	}
 
 	if (atkbd->set != 3)
kconfig renamed from Kconfig +3 -0
@@ -29,6 +29,9 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called atkbd.
 
+config BEEP_TOMANEY_KEYS
+bool "Beep when too many keys are pressed on at keyboards"
+depends on KEYBOARD_ATKBD
 config KEYBOARD_SUNKBD
 	tristate "Sun Type 4 and Type 5 keyboard support"
 	depends on INPUT && INPUT_KEYBOARD
#1 lore raw

atkbd.c line 292

Quoted 3 lines · ameer armaly
atkbd.c renamed from atkbd.orig +3 -0
+#else
+printk(KERN_ALERT, "\007");
+#endif			goto out;

Not speaking about poor indentation, this is not the right solution. You will pollute system logs with \007, and you might even send the beep far away from the keyboard, if the console is on a serial terminal. A better solution would be to call a function which activates the local speaker, typically the one used to output "\007" on a vt.

kconfig line 34

Quoted 3 lines
kconfig renamed from Kconfig +3 -0
+config BEEP_TOMANEY_KEYS
+bool "Beep when too many keys are pressed on at keyboards"
+depends on KEYBOARD_ATKBD

please respect indentation here too, just as it is below :

kconfig line 37

Quoted 3 lines

config KEYBOARD_SUNKBD

kconfig renamed from Kconfig +0 -0
 	tristate "Sun Type 4 and Type 5 keyboard support"
 	depends on INPUT && INPUT_KEYBOARD

Regards,
Willy