[parisc-linux-cvs] 2.4.18-pa48: temporary keyboard changes for better HIL keyboard support

Helge Deller deller@gmx.de
Fri, 5 Jul 2002 00:42:15 +0200


--Boundary-00=_H9MJ9sCe3fdXlaK
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

On Friday 05 July 2002 00:41, Helge Deller wrote:
> CVSROOT:	/var/cvs
> Module name:	linux
> Changes by:	deller	02/07/04 16:41:50
>
> Modified files:
> 	.              : Makefile
> 	arch/parisc/kernel: Makefile keyboard.c
> 	drivers/char   : Makefile hp_psaux.c hp_keyb.c
> 	drivers/hil    : hil_kbd.c hil_ptr.c
>
> Log message:
> 2.4.18-pa48:
> - some really ugly hacks to better support HIL keyboards until
> we have converted all other keyb/mouse drivers to input layer.
> - not all HIL keys are supported right now, but it's a lot better than
> before.
>
> Our main goal is to get rid of that ugly arch/parisc/kernel/keyboard.c
> and include/asm/keyboard.h files. Do get there we need to convert all
> our remaining drivers (hp_psaux.c, hp_keyb.c and hilbkd.c) to the official
> input infrastructure.


--Boundary-00=_H9MJ9sCe3fdXlaK
Content-Type: text/plain;
  charset="iso-8859-1";
  name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="diff"

Index: linux/Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.318
diff -u -p -r1.318 Makefile
--- linux/Makefile	2002/07/04 19:33:01	1.318
+++ linux/Makefile	2002/07/04 22:32:53
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 18
-EXTRAVERSION = -pa47
+EXTRAVERSION = -pa48
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
Index: linux/arch/parisc/kernel/Makefile
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- linux/arch/parisc/kernel/Makefile	2002/02/04 19:29:43	1.43
+++ linux/arch/parisc/kernel/Makefile	2002/07/04 22:32:53
@@ -26,7 +26,7 @@ obj-y           += cache.o pacache.o set
 		signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
 		processor.o power.o
 
-export-objs	:= parisc_ksyms.o superio.o
+export-objs	:= parisc_ksyms.o superio.o keyboard.o
 
 
 obj-$(CONFIG_SMP) += smp.o irq_smp.o
Index: linux/arch/parisc/kernel/keyboard.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/keyboard.c,v
retrieving revision 1.6
diff -u -p -r1.6 keyboard.c
--- linux/arch/parisc/kernel/keyboard.c	2002/06/25 20:32:07	1.6
+++ linux/arch/parisc/kernel/keyboard.c	2002/07/04 22:32:53
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/keyboard.h>
 #include <asm/keyboard.h>
+#include <linux/module.h>
 
 static int def_setkeycode(unsigned int x, unsigned int y)
 {
@@ -65,6 +66,7 @@ void unregister_kbd_ops(void)
 	struct kbd_ops new_kbd_ops = { DEFAULT_KEYB_OPS };
 	register_kbd_ops(&new_kbd_ops);
 }
+EXPORT_SYMBOL(unregister_kbd_ops);
 
 void register_kbd_ops(struct kbd_ops *ops)
 {
Index: linux/drivers/char/Makefile
===================================================================
RCS file: /var/cvs/linux/drivers/char/Makefile,v
retrieving revision 1.30
diff -u -p -r1.30 Makefile
--- linux/drivers/char/Makefile	2002/06/25 19:53:07	1.30
+++ linux/drivers/char/Makefile	2002/07/04 22:32:53
@@ -21,7 +21,7 @@ obj-y	 += mem.o tty_io.o n_tty.o tty_ioc
 # All of the (potential) objects that export symbols.
 # This list comes from 'grep -l EXPORT_SYMBOL *.[hc]'.
 
-export-objs     :=	busmouse.o console.o \
+export-objs     :=	busmouse.o console.o hp_psaux.o \
 			keyboard.o sysrq.o misc.o pty.o random.o selection.o \
                         serial.o sonypi.o tty_io.o tty_ioctl.o generic_serial.o
 
Index: linux/drivers/char/hp_psaux.c
===================================================================
RCS file: /var/cvs/linux/drivers/char/hp_psaux.c,v
retrieving revision 1.18
diff -u -p -r1.18 hp_psaux.c
--- linux/drivers/char/hp_psaux.c	2001/12/20 12:08:19	1.18
+++ linux/drivers/char/hp_psaux.c	2002/07/04 22:32:55
@@ -146,6 +146,9 @@ static void lasikbd_leds(unsigned char l
 {
 	int loop = 1000;
 
+	if (!lasikbd_hpa)
+		return;
+
 	cmd_status=2;
 	while (cmd_status!=0 && --loop > 0) {
 		write_output(KBD_CMD_SET_LEDS, lasikbd_hpa);
@@ -504,6 +507,21 @@ static struct kbd_ops gsc_ps2_kbd_ops = 
 	sysrq_xlate:	hp_ps2kbd_sysrq_xlate,
 #endif
 };
+
+
+
+#if 1
+/* XXX: HACK !!!
+ * remove this function and the call in hil_kbd.c 
+ * if hp_psaux.c/hp_keyb.c is converted to the input layer... */
+int register_ps2_keybfuncs(void)
+{
+	gsc_ps2_kbd_ops.leds = NULL;
+	register_kbd_ops(&gsc_ps2_kbd_ops);
+}
+EXPORT_SYMBOL(register_ps2_keybfuncs);
+#endif
+
 
 static int __init
 lasi_ps2_register(struct parisc_device *dev)
Index: linux/drivers/char/hp_keyb.c
===================================================================
RCS file: /var/cvs/linux/drivers/char/hp_keyb.c,v
retrieving revision 1.8
diff -u -p -r1.8 hp_keyb.c
--- linux/drivers/char/hp_keyb.c	2002/01/08 20:31:55	1.8
+++ linux/drivers/char/hp_keyb.c	2002/07/04 22:32:57
@@ -176,7 +176,7 @@ static unsigned char keycode_translate[2
 /* 30 */  K_NONE, K_N   , K_B   , K_H   , K_G   , K_Y   , K_6   , K_NONE,
 /* 38 */  K_NONE, K_NONE, K_M   , K_J   , K_U   , K_7   , K_8   , K_NONE,
 /* 40 */  K_NONE, K_COMA, K_K   , K_I   , K_O   , K_0   , K_9   , K_NONE,
-/* 48 */  K_NONE, K_DOT , K_FSLH, K_L   , K_SEMI, K_P   , K_MINS, K_NONE,
+/* 48 */  K_PGUP, K_DOT , K_FSLH, K_L   , K_SEMI, K_P   , K_MINS, K_NONE,
 /* 50 */  K_NONE, K_NONE, K_SQOT, K_NONE, K_LSBK, K_EQLS, K_NONE, K_NONE,
 /* 58 */  K_CAPS, K_RSFT, K_ENTR, K_RSBK, K_NONE, K_BSLH, K_NONE, K_NONE,
 /* 60 */  K_NONE, K_HASH, K_NONE, K_NONE, K_NONE, K_NONE, K_BKSP, K_NONE,
Index: linux/drivers/hil/hil_kbd.c
===================================================================
RCS file: /var/cvs/linux/drivers/hil/hil_kbd.c,v
retrieving revision 1.4
diff -u -p -r1.4 hil_kbd.c
--- linux/drivers/hil/hil_kbd.c	2002/07/02 21:03:35	1.4
+++ linux/drivers/hil/hil_kbd.c	2002/07/04 22:32:57
@@ -39,6 +39,11 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 
+#ifdef DEBUG	/* DEBUG */
+#undef input_report_key
+#define input_report_key(a,b,c) { printk("input_report_key(%p, %d, %d)\n", a, b, !!(c)); input_event(a, EV_KEY, b, !!(c)); }
+#endif
+
 #define PREFIX "HIL KEYB: "
 #define HIL_GENERIC_NAME "generic HIL keyboard device"
 
@@ -56,12 +61,12 @@ uint8_t hil_kbd_set1[128] = {
    KEY_RIGHTSHIFT,	KEY_LEFTSHIFT,	KEY_LEFTCTRL,	KEY_SYSRQ,
    KEY_KP4,		KEY_KP8,	KEY_KP5,	KEY_KP9,
    KEY_KP6,		KEY_KP7,	KEY_KPCOMMA,	KEY_KPENTER,
-   KEY_KP1,		KEY_SLASH/*KP*/,KEY_KP2,	KEY_KPPLUS,
+   KEY_KP1,		KEY_KPSLASH,	KEY_KP2,	KEY_KPPLUS,
    KEY_KP3,		KEY_KPASTERISK,	KEY_KP0,	KEY_KPMINUS,
    KEY_B,		KEY_V,		KEY_C,		KEY_X,
    KEY_Z,		KEY_UNKNOWN,	KEY_RESERVED,   KEY_ESC,
    KEY_6,		KEY_F10,	KEY_3,		KEY_F11,
-   KEY_KPDOT,		KEY_F9,		KEY_TAB/*KPTAB*/,KEY_F12,
+   KEY_KPDOT,		KEY_F9,		KEY_TAB /*KP*/,	KEY_F12,
    KEY_H,		KEY_G,		KEY_F,		KEY_D,
    KEY_S,		KEY_A,		KEY_RESERVED,	KEY_CAPSLOCK,
    KEY_U,		KEY_Y,		KEY_T,		KEY_R,
@@ -204,11 +209,9 @@ static void hil_kbd_process_record(struc
 			unsigned int key;
 			int up;
 			key = kbd->data[cnt++];
-/* printk("KEY1 = 0x%02x  ",key); */
 			up = key & HIL_KBD_SET1_UPBIT;
 			key &= (~HIL_KBD_SET1_UPBIT & 0xff);
 			key = key >> HIL_KBD_SET1_SHIFT;
-/* printk("send = %d\n",hil_kbd_set1[key]); */
 			if (key != KEY_RESERVED && key != KEY_UNKNOWN)
 				input_report_key(dev, hil_kbd_set1[key], !up);
 		}
@@ -376,14 +379,24 @@ static void hil_kbd_connect(struct serio
 		set_bit(hil_kbd_set1[i], kbd->dev.keybit);
 		set_bit(hil_kbd_set3[i], kbd->dev.keybit);
 	}
+	clear_bit(0, kbd->dev.keybit);
 
+#if 1
+	/* XXX: HACK !!!
+	 * remove this call if hp_psaux.c/hp_keyb.c is converted
+	 * to the input layer... */
+	register_ps2_keybfuncs();
+#endif
+	
 	input_register_device(&kbd->dev);
+	printk(KERN_INFO "input%d: %s on hil%d\n",
+		kbd->dev.number, "HIL keyboard", 0);
 
 	/* HIL keyboards don't have a numlock key,
 	 * simulate a up-down sequence of numlock to 
 	 * make the keypad work at expected. */
 	input_report_key(&kbd->dev, KEY_NUMLOCK, 1);
-	input_report_key(&kbd->dev, KEY_NUMLOCK, 0);
+/*	input_report_key(&kbd->dev, KEY_NUMLOCK, 0); */
 
 	return;
  bail1:
@@ -409,6 +422,13 @@ static int __init hil_kbd_init(void)
 static void __exit hil_kbd_exit(void)
 {
 	serio_unregister_device(&hil_kbd_serio_dev);
+
+#if 1
+	/* XXX: HACK !!!
+	 * remove this call if hp_psaux.c/hp_keyb.c is converted
+	 * to the input layer... */
+	unregister_kbd_ops();
+#endif
 }
                         
 module_init(hil_kbd_init);
Index: linux/drivers/hil/hil_ptr.c
===================================================================
RCS file: /var/cvs/linux/drivers/hil/hil_ptr.c,v
retrieving revision 1.2
diff -u -p -r1.2 hil_ptr.c
--- linux/drivers/hil/hil_ptr.c	2002/06/30 15:00:12	1.2
+++ linux/drivers/hil/hil_ptr.c	2002/07/04 22:32:57
@@ -371,6 +371,11 @@ static void hil_ptr_connect(struct serio
 	ptr->dev.idversion = 0x0100; /* TODO: get from ptr->rsc */
 
 	input_register_device(&ptr->dev);
+	printk(KERN_INFO "input%d: %s on hil%d\n",
+		ptr->dev.number, 
+		(btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
+		0);
+
 	return;
  bail1:
 	serio_close(serio);

--Boundary-00=_H9MJ9sCe3fdXlaK--