lkml.org 
[lkml]   [2006]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] add input_enable_device()
Hello.

Andrew Morton wrote:
> 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.

Signed-off-by: Stas Sergeev <stsp@aknet.ru>
CC: Dmitry Torokhov <dtor_core@ameritech.net>
CC: Vojtech Pavlik <vojtech@suse.cz>

--- a/include/linux/input.h 2006-04-05 17:10:01.000000000 +0400
+++ b/include/linux/input.h 2006-04-05 17:36:49.000000000 +0400
@@ -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);

--- a/drivers/input/input.c 2006-01-12 11:23:09.000000000 +0300
+++ b/drivers/input/input.c 2006-04-05 17:51:27.000000000 +0400
@@ -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);
\
 
 \ /
  Last update: 2006-05-16 18:32    [W:0.077 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site