[patch 1/2] input: add soft release key mask to keyboard driver

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

 



Add keysrlmask to input_dev and add soft release handling in atkbd.c

Signed-off-by: Giel de Nijs <[email protected]>
---

Index: linux-2.6.21.1/drivers/input/keyboard/atkbd.c
===================================================================
--- linux-2.6.21.1.orig/drivers/input/keyboard/atkbd.c	2007-05-10 18:34:48.000000000 +0200
+++ linux-2.6.21.1/drivers/input/keyboard/atkbd.c	2007-05-11 19:21:03.000000000 +0200
@@ -201,6 +201,7 @@
 
 	unsigned short id;
 	unsigned char keycode[512];
+	unsigned long keysrlmask[NBITS(512)];
 	unsigned char set;
 	unsigned char translated;
 	unsigned char extra;
@@ -412,14 +413,6 @@
 			       "Some program might be trying access hardware directly.\n",
 			       data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
 			goto out;
-		case ATKBD_RET_HANGEUL:
-		case ATKBD_RET_HANJA:
-			/*
-			 * These keys do not report release and thus need to be
-			 * flagged properly
-			 */
-			add_release_event = 1;
-			break;
 		case ATKBD_RET_ERR:
 			atkbd->err_count++;
 #ifdef ATKBD_DEBUG
@@ -438,6 +431,9 @@
 	if (keycode != ATKBD_KEY_NULL)
 		input_event(dev, EV_MSC, MSC_SCAN, code);
 
+	if (test_bit(code, atkbd->keysrlmask))
+		add_release_event = 1;
+
 	switch (keycode) {
 		case ATKBD_KEY_NULL:
 			break;
@@ -832,6 +828,7 @@
 	int i, j;
 
 	memset(atkbd->keycode, 0, sizeof(atkbd->keycode));
+	bitmap_zero(atkbd->keysrlmask, 512);
 
 	if (atkbd->translated) {
 		for (i = 0; i < 128; i++) {
@@ -854,6 +851,11 @@
 
 	atkbd->keycode[atkbd_compat_scancode(atkbd, ATKBD_RET_HANGEUL)] = KEY_HANGUEL;
 	atkbd->keycode[atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA)] = KEY_HANJA;
+
+	set_bit(atkbd_compat_scancode(atkbd, ATKBD_RET_HANGEUL),
+		atkbd->keysrlmask);
+	set_bit(atkbd_compat_scancode(atkbd, ATKBD_RET_HANJA),
+		atkbd->keysrlmask);
 }
 
 /*
@@ -911,6 +913,7 @@
 	}
 
 	input_dev->keycode = atkbd->keycode;
+	input_dev->keysrlmask = atkbd->keysrlmask;
 	input_dev->keycodesize = sizeof(unsigned char);
 	input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
 
Index: linux-2.6.21.1/include/linux/input.h
===================================================================
--- linux-2.6.21.1.orig/include/linux/input.h	2007-05-10 18:32:39.000000000 +0200
+++ linux-2.6.21.1/include/linux/input.h	2007-05-10 18:56:50.000000000 +0200
@@ -962,6 +962,7 @@
 	unsigned int keycodemax;
 	unsigned int keycodesize;
 	void *keycode;
+	unsigned long *keysrlmask; /* soft-release scancodes key mask */
 
 	struct ff_device *ff;
 

-- 

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

[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