Skip to content

Commit

Permalink
Input: send key up events at disconnect
Browse files Browse the repository at this point in the history
Emit key up events for all pressed keys/buttons when disconnecting
an input device. Cures "stuck" enter key effect when unloading
keyboard module.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Sep 11, 2006
1 parent e38de67 commit 6d2750c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,9 +1014,12 @@ EXPORT_SYMBOL(input_register_device);
void input_unregister_device(struct input_dev *dev)
{
struct list_head *node, *next;
int code;

if (!dev)
return;
for (code = 0; code <= KEY_MAX; code++)
if (test_bit(code, dev->key))
input_report_key(dev, code, 0);
input_sync(dev);

del_timer_sync(&dev->timer);

Expand Down

0 comments on commit 6d2750c

Please sign in to comment.