aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/keyboard.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-15 16:26:53 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-12-15 21:48:55 -0800
commit18f7ad59b0ef341fb9390cb79b2a39707c48257d (patch)
treedf251646709f2d402ec06fe603784f7f46da2de2 /drivers/char/keyboard.c
parentInput: altera_ps2 - fix test of unsigned in altera_ps2_probe() (diff)
downloadlinux-dev-18f7ad59b0ef341fb9390cb79b2a39707c48257d.tar.xz
linux-dev-18f7ad59b0ef341fb9390cb79b2a39707c48257d.zip
Input: keyboard - don't override beep with a bell
The commit 66d2a5952eab875f1286e04f738ef029afdaf013 introduces a bug: for every beep requested, a bell is also generated. Reported-by: Paul Martin <pm@debian.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r--drivers/char/keyboard.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 5619007e7e05..f706b1dffdb3 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -233,7 +233,8 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
}
/*
- * Making beeps and bells.
+ * Making beeps and bells. Note that we prefer beeps to bells, but when
+ * shutting the sound off we do both.
*/
static int kd_sound_helper(struct input_handle *handle, void *data)
@@ -242,9 +243,12 @@ static int kd_sound_helper(struct input_handle *handle, void *data)
struct input_dev *dev = handle->dev;
if (test_bit(EV_SND, dev->evbit)) {
- if (test_bit(SND_TONE, dev->sndbit))
+ if (test_bit(SND_TONE, dev->sndbit)) {
input_inject_event(handle, EV_SND, SND_TONE, *hz);
- if (test_bit(SND_BELL, handle->dev->sndbit))
+ if (*hz)
+ return 0;
+ }
+ if (test_bit(SND_BELL, dev->sndbit))
input_inject_event(handle, EV_SND, SND_BELL, *hz ? 1 : 0);
}