public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Westermann <mw@microdata-pos.de>
To: Linux Kernel mailing list <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: i386 PC Keyboad Patch, for very exotic Keyboads
Date: Wed, 8 Nov 2000 10:32:03 +0100	[thread overview]
Message-ID: <20001108103203.B26847@microdata-pos.de> (raw)
In-Reply-To: <20001108102456.A26847@microdata-pos.de>
In-Reply-To: <20001108102456.A26847@microdata-pos.de>; from mw@microdata-pos.de on Wed, Nov 08, 2000 at 10:24:56AM +0100

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

Hello,


On Wed, Nov 08, 2000 at 10:24:56AM +0100, Michael Westermann wrote:
> Hallo,
> 
> ich have wrote a Patch, for all the PS2-Keyboards what
> use exotic Scancodes and Functions. Teh backgroud is 

Sorry i have the Patch forget. 


Michael Westermann

[-- Attachment #2: pc_keyb.patch.v0.2 --]
[-- Type: text/plain, Size: 5452 bytes --]

--- linux.old/drivers/char/pc_keyb.c	Thu Jul  6 22:21:31 2000
+++ linux/drivers/char/pc_keyb.c	Thu Nov  2 08:15:29 2000
@@ -13,10 +13,12 @@
  * Code fixes to handle mouse ACKs properly.
  * C. Scott Ananian <cananian@alumni.princeton.edu> 1999-01-29.
  *
+ * Include a interface for pc keyboard's with extentions
+ * M.Westermann <mw@microdata-pos.de> Tue, 10 Oct 2000
  */
 
 #include <linux/config.h>
-
+#include <linux/module.h>
 #include <asm/spinlock.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
@@ -41,6 +43,9 @@
 
 #include <linux/pc_keyb.h>
 
+EXPORT_SYMBOL(unregister_kbd_ex);
+EXPORT_SYMBOL(register_kbd_ex);
+
 /* Simple translation table for the SysRq keys */
 
 #ifdef CONFIG_MAGIC_SYSRQ
@@ -64,10 +69,9 @@
 static unsigned char handle_kbd_event(void);
 
 /* used only by send_data - set by keyboard_interrupt */
-static volatile unsigned char reply_expected = 0;
-static volatile unsigned char acknowledge = 0;
-static volatile unsigned char resend = 0;
-
+static volatile pc_keyb_t   kbd_ex_mem;    
+static volatile pc_keyb_t * kbd_ex;
+static volatile pc_keyb_t * kbd_store;
 
 #if defined CONFIG_PSMOUSE
 /*
@@ -260,19 +264,19 @@
 
 static int do_acknowledge(unsigned char scancode)
 {
-	if (reply_expected) {
+	if (kbd_ex->reply_expected) {
 	  /* Unfortunately, we must recognise these codes only if we know they
 	   * are known to be valid (i.e., after sending a command), because there
 	   * are some brain-damaged keyboards (yes, FOCUS 9000 again) which have
 	   * keys with such codes :(
 	   */
 		if (scancode == KBD_REPLY_ACK) {
-			acknowledge = 1;
-			reply_expected = 0;
+			kbd_ex->acknowledge = 1;
+			kbd_ex->reply_expected = 0;
 			return 0;
 		} else if (scancode == KBD_REPLY_RESEND) {
-			resend = 1;
-			reply_expected = 0;
+			kbd_ex->resend = 1;
+			kbd_ex->reply_expected = 0;
 			return 0;
 		}
 		/* Should not happen... */
@@ -448,11 +452,16 @@
 #  ifdef CHECK_RECONNECT_SCANCODE
     printk(KERN_INFO "-=db=-: kbd_read_input() : scancode == %d\n",scancode);
 #  endif
+    // printk("scancode = %02x\n",scancode);
 		if (status & KBD_STAT_MOUSE_OBF) {
 			handle_mouse_event(scancode);
 		} else {
-			if (do_acknowledge(scancode))
-				handle_scancode(scancode, !(scancode & 0x80));
+			if (kbd_ex->do_acknowledge(scancode)) {
+			    if (!kbd_ex->kbd_check_event || 
+			            (kbd_ex->kbd_check_event && 
+			                kbd_ex->kbd_check_event(&scancode)))  
+			    handle_scancode(scancode, !(scancode & 0x80));
+			}    
 			mark_bh(KEYBOARD_BH);
 		}
 
@@ -495,14 +504,14 @@
 	do {
 		unsigned long timeout = KBD_TIMEOUT;
 
-		acknowledge = 0; /* Set by interrupt routine on receipt of ACK. */
-		resend = 0;
-		reply_expected = 1;
+		kbd_ex->acknowledge = 0; /* Set by interrupt routine on receipt of ACK. */
+		kbd_ex->resend = 0;
+		kbd_ex->reply_expected = 1;
 		kbd_write_output_w(data);
 		for (;;) {
-			if (acknowledge)
+			if (kbd_ex->acknowledge)
 				return 1;
-			if (resend)
+			if (kbd_ex->resend)
 				break;
 			mdelay(1);
 			if (!--timeout) {
@@ -721,8 +730,66 @@
 	return NULL;
 }
 
+int register_kbd_ex (pc_keyb_t * kb)
+{
+    unsigned long flags;
+
+    save_flags(flags);
+    if (kbd_store)
+       return -1;
+    else {
+	cli();    
+        if (!kb->do_acknowledge)      /* we can ovlerload this function */
+	   kb->do_acknowledge = kbd_ex->do_acknowledge;    
+	kb->kbd_write_command_w = kbd_write_command_w; 
+    	kb->kbd_write_output_w  = kbd_write_output_w;
+    	kb->send_data           = send_data;
+	kb->reply_expected      = kbd_ex->reply_expected;
+        kb->acknowledge         = kbd_ex->acknowledge;
+        kb->resend	        = kbd_ex->resend;
+        kbd_store 	        = kbd_ex;
+	kbd_ex  	        = kb;
+        restore_flags(flags);    
+    }
+    return  0;
+}
+
+int unregister_kbd_ex (pc_keyb_t * kb)
+{
+    unsigned long flags;
+
+    save_flags(flags);
+    if (!kbd_store)
+	return -1;
+    else {
+	cli();
+	kbd_ex    	   	= kbd_store;
+	kbd_store  	   	= NULL;
+	kbd_ex->reply_expected  = kb->reply_expected;
+        kbd_ex->acknowledge     = kb->acknowledge;
+        kbd_ex->resend	   	= kb->resend;
+        restore_flags(flags);	
+    }
+    return 0;	    
+}
+
+void __init kbd_ex_init(void)
+{
+    kbd_ex = &kbd_ex_mem;    		/* later as malloc */
+    kbd_ex->kbd_write_command_w = kbd_write_command_w;
+    kbd_ex->kbd_write_output_w = kbd_write_output_w; 
+    kbd_ex->do_acknowledge = do_acknowledge;
+    kbd_ex->send_data = send_data;
+    kbd_ex->kbd_check_event = NULL;    
+    kbd_ex->reply_expected=0;
+    kbd_ex->acknowledge=0;
+    kbd_ex->resend=0;
+    kbd_store = NULL;
+}
+
 void __init pckbd_init_hw(void)
 {
+	kbd_ex_init();
 	kbd_request_region();
 
 	/* Flush any pending input. */
--- linux.old/include/linux/pc_keyb.h	Mon Aug  9 21:04:41 1999
+++ linux/include/linux/pc_keyb.h	Tue Oct 31 10:20:10 2000
@@ -128,3 +128,18 @@
 	struct fasync_struct *fasync;
 	unsigned char buf[AUX_BUF_SIZE];
 };
+ 
+typedef struct {
+    void (*kbd_write_command_w)(int data);
+    void (*kbd_write_output_w) (int data);
+    int  (*do_acknowledge)  (unsigned char scancode);
+    int  (*kbd_check_event) (unsigned char * scancode); 
+    int  (*send_data) (unsigned char data);
+    volatile unsigned char reply_expected;
+    volatile unsigned char acknowledge;
+    volatile unsigned char resend;
+} pc_keyb_t;
+
+int   register_kbd_ex (pc_keyb_t * kb);
+int unregister_kbd_ex (pc_keyb_t * kb);
+

      reply	other threads:[~2000-11-08  9:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-08  9:24 i386 PC Keyboad Patch, for very exotic Keyboads Michael Westermann
2000-11-08  9:32 ` Michael Westermann [this message]

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=20001108103203.B26847@microdata-pos.de \
    --to=mw@microdata-pos.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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