Re: [patch 1/1] pc-speaker: add SND_SILENT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

Dmitry Torokhov wrote:
etc. All these alternative bells would not disrupt operation of your
snd_pcsp module but it still would disable the bell because it does
not know better.
OK, I now used INPUT_DEVICE_ID_MATCH_BUS, and, with something
like the attached patch, it seems to work. So essentially my
driver has enough of the knowledge about the device in question,
and this seems to be possible exactly only with the input subsystem.
(which makes me confident again that using the input subsystem
was exactly the right choice :)
What do you think about that approach?

--- 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
@@ -862,7 +862,7 @@
 
 	struct pt_regs *regs;
 	int state;
-
+	int enabled;
 	int sync;
 
 	int abs[ABS_MAX + 1];
@@ -1019,6 +1019,8 @@
 int input_open_device(struct input_handle *);
 void input_close_device(struct input_handle *);
 
+void input_enable_device(struct input_handle *handle, int enab);
+
 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
@@ -36,6 +36,7 @@
 EXPORT_SYMBOL(input_release_device);
 EXPORT_SYMBOL(input_open_device);
 EXPORT_SYMBOL(input_close_device);
+EXPORT_SYMBOL(input_enable_device);
 EXPORT_SYMBOL(input_accept_process);
 EXPORT_SYMBOL(input_flush_device);
 EXPORT_SYMBOL(input_event);
@@ -52,7 +53,7 @@
 {
 	struct input_handle *handle;
 
-	if (type > EV_MAX || !test_bit(type, dev->evbit))
+	if (type > EV_MAX || !test_bit(type, dev->evbit) || !dev->enabled)
 		return;
 
 	add_input_randomness(type, code, value);
@@ -265,6 +266,11 @@
 	up(&dev->sem);
 }
 
+void input_enable_device(struct input_handle *handle, int enab)
+{
+	handle->dev->enabled = enab;
+}
+
 static void input_link_handle(struct input_handle *handle)
 {
 	list_add_tail(&handle->d_node, &handle->dev->h_list);
@@ -712,6 +718,7 @@
 		class_device_initialize(&dev->cdev);
 		INIT_LIST_HEAD(&dev->h_list);
 		INIT_LIST_HEAD(&dev->node);
+		dev->enabled = 1;
 	}
 
 	return dev;

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux