Skip to contentSkip to conversation

More on HID keyboard handling.

PATCH Zephaniah E. Hull 1 participant 1 message Mar 31, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I still have not heard anything back from you either way on the attached patch.

It goes on top of the grabbing patch you already accepted, but it allows for /much/ more flexibility.

If this is not an approach you would like to take, do you have any alternate ideas?

Signature · 10 lines
	1024D/E65A7801 Zephaniah E. Hull <[email protected]>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

     "First they came for the Jews, and I didn't speak out - because I
was not a jew. Then they came for the Communists, and I did not speak
out - because I was not a Communist. Then they came for the trade
unionists, and I did not speak out - because I was not a trade unionist.
Then they came for me and there was no one left to speak for me!"
  - Pastor Niemoeller - victim of Hitler's Nazis
drivers/char/keyboard.c +1 -0
diff -ur linux-2.5.63/drivers/char/keyboard.c linux-2.5.63.input/drivers/char/keyboard.c
@@ -1174,6 +1174,7 @@
 	handle->dev = dev;
 	handle->handler = handler;
 	handle->name = kbd_name;
+	handle->mask = ~BIT(0);
 
 	input_open_device(handle);
 	kbd_refresh_leds(handle);
drivers/input/evdev.c +36 -8

73 lines not on this page · raw message

drivers/input/input.c +13 -1
diff -ur linux-2.5.63/drivers/input/input.c linux-2.5.63.input/drivers/input/input.c
@@ -33,6 +33,8 @@
 EXPORT_SYMBOL(input_unregister_handler);
 EXPORT_SYMBOL(input_register_minor);
 EXPORT_SYMBOL(input_unregister_minor);
+EXPORT_SYMBOL(input_get_device_mask);
+EXPORT_SYMBOL(input_set_device_mask);
 EXPORT_SYMBOL(input_grab_device);
 EXPORT_SYMBOL(input_release_device);
 EXPORT_SYMBOL(input_open_device);
@@ -183,7 +185,7 @@
 		dev->grab->handler->event(dev->grab, type, code, value);
 	else
 		list_for_each_entry(handle, &dev->h_list, d_node)
-			if (handle->open)
+			if (handle->open && (~handle->mask & ~dev->mask))
 				handle->handler->event(handle, type, code, value);
 }
 
@@ -208,6 +210,16 @@
 	return 0;
 }
 
+unsigned long input_get_device_mask (struct input_dev *dev)
+{
+	return ~dev->mask;
+}
+
+void input_set_device_mask (struct input_dev *dev, unsigned long mask)
+{
+	dev->mask = ~mask;
+}
+
 int input_grab_device(struct input_handle *handle)
 {
 	if (handle->dev->grab)
drivers/input/joydev.c +1 -0
diff -ur linux-2.5.63/drivers/input/joydev.c linux-2.5.63.input/drivers/input/joydev.c
@@ -400,6 +400,7 @@
 	joydev->handle.name = joydev->name;
 	joydev->handle.handler = handler;
 	joydev->handle.private = joydev;
+	joydev->handle.mask = ~BIT(0);
 	sprintf(joydev->name, "js%d", minor);
 
 	for (i = 0; i < ABS_MAX; i++)
drivers/input/mousedev.c +1 -0
diff -ur linux-2.5.63/drivers/input/mousedev.c linux-2.5.63.input/drivers/input/mousedev.c
@@ -419,6 +419,7 @@
 	mousedev->handle.name = mousedev->name;
 	mousedev->handle.handler = handler;
 	mousedev->handle.private = mousedev;
+	mousedev->handle.mask = ~BIT(0);
 	sprintf(mousedev->name, "mouse%d", minor);
 
 	if (mousedev_mix.open)
include/linux/input.h +10 -1
diff -ur linux-2.5.63/include/linux/input.h linux-2.5.63.input/include/linux/input.h
@@ -77,7 +77,11 @@
 #define EVIOCRMFF		_IOW('E', 0x81, int)			/* Erase a force effect */
 #define EVIOCGEFFECTS		_IOR('E', 0x84, int)			/* Report number of effects playable at the same time */
 
-#define EVIOCGRAB		_IOW('E', 0x90, int)			/* Grab/Release device */
+#define EVIOCGRAB		_IOW('E', 0x90, int)	/* Grab/Release device */
+#define EVIOCGMASK		_IOR('E', 0x91, unsigned long *)	/* Get our input mask */
+#define EVIOCSMASK		_IOW('E', 0x92, unsigned long)		/* Set our input mask */
+#define EVIOCGDMASK		_IOR('E', 0x93, unsigned long *)	/* Get device input mask */
+#define EVIOCSDMASK		_IOW('E', 0x94, unsigned long)		/* Set device input mask */
 
 /*
  * Event types
@@ -801,6 +805,7 @@
 	int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
 	int (*erase_effect)(struct input_dev *dev, int effect_id);
 
+	unsigned long mask;
 	struct input_handle *grab;
 
 	struct list_head	h_list;
@@ -874,6 +879,7 @@
 
 	int open;
 	char *name;
+	unsigned long mask;
 
 	struct input_dev *dev;
 	struct input_handler *handler;
@@ -893,6 +899,9 @@
 void input_register_handler(struct input_handler *);
 void input_unregister_handler(struct input_handler *);
 
+unsigned long input_get_device_mask(struct input_dev *);
+void input_set_device_mask(struct input_dev *, unsigned long mask);
+
 int input_grab_device(struct input_handle *);
 void input_release_device(struct input_handle *);