add input_enable_device()
Hello.
Quoted 2 lines · Andrew Morton
Separate functions
input_enable_device(struct input_handle *handle)andinput_disable_device(struct input_handle *handle)would be preferred.
Right, and here it goes.
---
add input_enable_device() and input_disable_device()
include/linux/input.h +4 -1
@@ -878,7 +878,7 @@struct pt_regs *regs;int state; - +int disabled;int sync;int abs[ABS_MAX +1 ];
@@ -1038,6 +1038,9 @@int input_open_device (struct input_handle *);void input_close_device (struct input_handle *); +void input_enable_device (struct input_handle *handle); +void input_disable_device (struct input_handle *handle); +int input_accept_process (struct input_handle *handle,struct file *file);int input_flush_device (struct input_handle * handle,struct file * file);
drivers/input/input.c +13 -1
@@ -37,6 +37,8 @@EXPORT_SYMBOL (input_release_device);EXPORT_SYMBOL (input_open_device);EXPORT_SYMBOL (input_close_device); +EXPORT_SYMBOL (input_enable_device); +EXPORT_SYMBOL (input_disable_device);EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event);
@@ -53,7 +55,7 @@ {struct input_handle *handle; -if (type >EV_MAX || !test_bit (type, dev->evbit)) +if (type >EV_MAX || !test_bit (type, dev->evbit) || dev->disabled)return ;add_input_randomness (type, code, value);
@@ -269,6 +271,16 @@mutex_unlock (&dev->mutex); } +void input_enable_device (struct input_handle *handle) +{ + handle->dev->disabled =0 ; +} + +void input_disable_device (struct input_handle *handle) +{ + handle->dev->disabled =1 ; +} +static void input_link_handle (struct input_handle *handle) {list_add_tail (&handle->d_node, &handle->dev->h_list);
Quoted 6 lines · Stas Sergeev
add
input_enable_device()andinput_disable_device()Signed-off-by Stas Sergeev <[email protected]>CC Dmitry Torokhov <[email protected]>CC Vojtech Pavlik <[email protected]>
uh, that's not a complete changelog - it describes what the code does (which is obvious), but doesn't describe why it does it.
iirc it had to do with the pc-speaker driver, but I don't seem to be able to locate the original email.
Hello.
Quoted 2 lines · Andrew Morton
iirc it had to do with the pc-speaker driver, but I don't seem to be able to locate the original email.
OK, sorry, I haven't realized its important.
---
The patch below adds input_enable_device() and input_disable_device() to the input subsystem, that allows to enable and disable the input devices. The reason to have it, is the snd-pcsp PC-Speaker driver in an ALSA tree that needs an ability to disable the pcspkr driver.
include/linux/input.h +4 -1
@@ -878,7 +878,7 @@struct pt_regs *regs;int state; - +int disabled;int sync;int abs[ABS_MAX +1 ];
@@ -1038,6 +1038,9 @@int input_open_device (struct input_handle *);void input_close_device (struct input_handle *); +void input_enable_device (struct input_handle *handle); +void input_disable_device (struct input_handle *handle); +int input_accept_process (struct input_handle *handle,struct file *file);int input_flush_device (struct input_handle * handle,struct file * file);
drivers/input/input.c +13 -1
@@ -37,6 +37,8 @@EXPORT_SYMBOL (input_release_device);EXPORT_SYMBOL (input_open_device);EXPORT_SYMBOL (input_close_device); +EXPORT_SYMBOL (input_enable_device); +EXPORT_SYMBOL (input_disable_device);EXPORT_SYMBOL (input_accept_process);EXPORT_SYMBOL (input_flush_device);EXPORT_SYMBOL (input_event);
@@ -53,7 +55,7 @@ {struct input_handle *handle; -if (type >EV_MAX || !test_bit (type, dev->evbit)) +if (type >EV_MAX || !test_bit (type, dev->evbit) || dev->disabled)return ;add_input_randomness (type, code, value);
@@ -269,6 +271,16 @@mutex_unlock (&dev->mutex); } +void input_enable_device (struct input_handle *handle) +{ + handle->dev->disabled =0 ; +} + +void input_disable_device (struct input_handle *handle) +{ + handle->dev->disabled =1 ; +} +static void input_link_handle (struct input_handle *handle) {list_add_tail (&handle->d_node, &handle->dev->h_list);
Quoted 22 lines · Stas Sergeev
Hello.
Quoted 2 lines · Andrew Morton
iirc it had to do with the pc-speaker driver, but I don't seem to be able to locate the original email.
OK, sorry, I haven't realized its important.
---
The patch below addsinput_enable_device()andinput_disable_device()to the input subsystem, that allows to enable and disable the input devices. The reason to have it, is the snd-pcsp PC-Speaker driver in an ALSA tree that needs an ability to disable the pcspkr driver.Signed-off-by Stas Sergeev <[email protected]>CC Dmitry Torokhov <[email protected]>CC Vojtech Pavlik <[email protected]>
include/linux/input.h line 884
Quoted 8 lines
include/linux/input.h +1
-1@@ -878,7 +878,7 @@struct pt_regs *regs;int state; - +int disabled;int sync;int abs[ABS_MAX +1 ];
Why eat an entire word here? It seems we already have a "dynalloc" boolean/int... perhaps some of these things could be rolled up into a bitfield.
Cheers,
Chase