Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -3
+7 -3
drivers/char/keyboard.c
··· 233 233 } 234 234 235 235 /* 236 - * Making beeps and bells. 236 + * Making beeps and bells. Note that we prefer beeps to bells, but when 237 + * shutting the sound off we do both. 237 238 */ 238 239 239 240 static int kd_sound_helper(struct input_handle *handle, void *data) ··· 243 242 struct input_dev *dev = handle->dev; 244 243 245 244 if (test_bit(EV_SND, dev->evbit)) { 246 - if (test_bit(SND_TONE, dev->sndbit)) 245 + if (test_bit(SND_TONE, dev->sndbit)) { 247 246 input_inject_event(handle, EV_SND, SND_TONE, *hz); 248 - if (test_bit(SND_BELL, handle->dev->sndbit)) 247 + if (*hz) 248 + return 0; 249 + } 250 + if (test_bit(SND_BELL, dev->sndbit)) 249 251 input_inject_event(handle, EV_SND, SND_BELL, *hz ? 1 : 0); 250 252 } 251 253