public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stas Sergeev <stsp@aknet.ru>
To: dtor_core@ameritech.net
Cc: 7eggert@gmx.de, Linux kernel <linux-kernel@vger.kernel.org>,
	vojtech@suse.cz
Subject: Re: [patch 1/1] pc-speaker: add SND_SILENT
Date: Sat, 08 Apr 2006 12:02:54 +0400	[thread overview]
Message-ID: <44376E2E.3020201@aknet.ru> (raw)
In-Reply-To: <d120d5000603270834j79e707ffu760eba3062531b64@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

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?


[-- Attachment #2: input_en.diff --]
[-- Type: text/x-patch, Size: 1637 bytes --]

--- 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;

  parent reply	other threads:[~2006-04-08  8:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5TCqf-E6-49@gated-at.bofh.it>
     [not found] ` <5TCqf-E6-51@gated-at.bofh.it>
     [not found]   ` <5TCqf-E6-53@gated-at.bofh.it>
     [not found]     ` <5TCqg-E6-55@gated-at.bofh.it>
     [not found]       ` <5TCqf-E6-47@gated-at.bofh.it>
2006-03-24 22:43         ` [patch 1/1] pc-speaker: add SND_SILENT Bodo Eggert
2006-03-26  9:52           ` Stas Sergeev
2006-03-26 11:24             ` Bodo Eggert
2006-03-26 18:46             ` Jan Engelhardt
2006-03-26 20:15               ` Kyle Moffett
2006-03-27 16:34             ` Dmitry Torokhov
2006-03-27 17:36               ` Stas Sergeev
2006-04-08  8:02               ` Stas Sergeev [this message]
2006-03-28 18:31             ` Joseph Fannin
2006-03-28 18:43               ` Bodo Eggert
2006-03-28 18:51                 ` Vojtech Pavlik
2006-03-30 23:07                   ` Edgar Toernig
2006-03-31  7:46                     ` Vojtech Pavlik
2006-03-31 21:06                       ` Edgar Toernig
2006-04-01  6:11                         ` Vojtech Pavlik
     [not found] <200603220652.k2M6qZgi020656@shell0.pdx.osdl.net>
     [not found] ` <d120d5000603221332n6a6f9208x5651dc9ec993f4bf@mail.gmail.com>
     [not found]   ` <4422318C.407@aknet.ru>
     [not found]     ` <d120d5000603230651p6b43aad9ocad1aa3c2b51b388@mail.gmail.com>
2006-03-23 18:03       ` Stas Sergeev
2006-03-23 18:12         ` Dmitry Torokhov
2006-03-23 18:31           ` Stas Sergeev
2006-03-23 18:47             ` Dmitry Torokhov
2006-03-23 19:34               ` Stas Sergeev
2006-03-23 20:36                 ` Dmitry Torokhov
2006-03-24  4:59                   ` Stas Sergeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44376E2E.3020201@aknet.ru \
    --to=stsp@aknet.ru \
    --cc=7eggert@gmx.de \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox