lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1205698451-1640-1-git-send-email-hmh@hmh.eng.br>
Date:	Sun, 16 Mar 2008 17:14:11 -0300
From:	Henrique de Moraes Holschuh <hmh@....eng.br>
To:	linux-kernel@...r.kernel.org
Cc:	Henrique de Moraes Holschuh <hmh@....eng.br>,
	Dmitry Torokhov <dtor@...l.ru>,
	Richard Purdie <rpurdie@...ys.net>
Subject: [PATCH] Input: add flags bitfield

Add a flags bitfield to the input_dev structure, which can be used for
internal coordination among kernel input devices and input handlers without
the need to use ever-expanding blacklists on the input handlers.

Add initial flag bits which allows an input driver to request that joystick
emulation (joydev) or mouse emulation (mousedev) not be attached to an
input device.

This will be used by accelerometer drivers exporting a raw interface which
is not to be used as a joystick device (not to confuse this with the usual
fuzzed joystick interface these drivers export for enhanced Neverball
productivity), for example.

Signed-off-by: Henrique de Moraes Holschuh <hmh@....eng.br>
Cc: Dmitry Torokhov <dtor@...l.ru>
Cc: Richard Purdie <rpurdie@...ys.net>
---
 drivers/input/joydev.c   |    3 +++
 drivers/input/mousedev.c |    3 +++
 include/linux/input.h    |   10 ++++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 22b2789..3837389 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -727,6 +727,9 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
 	int i, j, t, minor;
 	int error;
 
+	if (dev->flags & EV_F_NOJOYSTICK)
+		return -ENODEV;
+
 	for (minor = 0; minor < JOYDEV_MINORS; minor++)
 		if (!joydev_table[minor])
 			break;
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index bbbe5e8..716975f 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -962,6 +962,9 @@ static int mousedev_connect(struct input_handler *handler,
 	int minor;
 	int error;
 
+	if (dev->flags & EV_F_NOMOUSE)
+		return -ENODEV;
+
 	for (minor = 0; minor < MOUSEDEV_MINORS; minor++)
 		if (!mousedev_table[minor])
 			break;
diff --git a/include/linux/input.h b/include/linux/input.h
index 1bdc39a..a5654fe 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -951,12 +951,20 @@ struct ff_effect {
 #include <linux/timer.h>
 #include <linux/mod_devicetable.h>
 
+/*
+ * input device special flags
+ */
+
+#define EV_F_NOMOUSE		0x0001	/* Do not attach mousedev */
+#define EV_F_NOJOYSTICK		0x0002	/* Do not attach joydev */
+
 /**
  * struct input_dev - represents an input device
  * @name: name of the device
  * @phys: physical path to the device in the system hierarchy
  * @uniq: unique identification code for the device (if device has it)
  * @id: id of the device (struct input_id)
+ * @flags: bitmap of special flags (EV_F_*)
  * @evbit: bitmap of types of events supported by the device (EV_KEY,
  *	EV_REL, etc.)
  * @keybit: bitmap of keys/buttons this device has
@@ -1034,6 +1042,8 @@ struct input_dev {
 	const char *uniq;
 	struct input_id id;
 
+	unsigned long flags;
+
 	unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
 	unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
 	unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
-- 
1.5.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ