2 klavesnice a 2 monitory u jednoho PC?

Pavel Machek pavel na suse.cz
Pondělí Říjen 25 23:57:58 CEST 1999


Hi!

> > > >      existuje nejaka moznost jak k 1 PC 
> > > > pripojit 2 uzivatele se 2 klavesnicema a 2 monitory?
> > > > Nemyslim pres sit :)
> > > 
> > >   2 monitory jdou (kdysi jsem delal na 386sx s normalnim a cernobilym
> > >   monitorem - na prikazy v AutoCADu - samozrejme se dvema grafickymi kartami)
> > > 
> > >   2 klavesnice bez bastleni nepujdou (ani nevim, zda to nekdo s nejakym
> > >   boadrem zprovoznil)
> > 
> > Proste se ps2 klavesnice pripoji do ps2 mysoveho portu. Vsechna magie
> > je v softwaru.
> 
>   To by me zajimalo, nemate to jako modul do kernelu? :-)

Zasah ;-). Potrebujete preklopit #undef na #define a oddelit dva
proudy eventu, zbytek je attachnut.

							Pavel

--- clean//drivers/char/pc_keyb.c	Sat Oct 16 10:24:22 1999
+++ linux/drivers/char/pc_keyb.c	Tue Oct 12 08:42:43 1999
@@ -15,6 +15,10 @@
  *
  */
 
+/* Uncomment this if you have keyboard in ps/2 port, not mouse */
+
+#undef KEYBOARD_IN_PSAUX
+
 #include <linux/config.h>
 
 #include <linux/spinlock.h>
@@ -272,7 +276,7 @@
 			return 0;
 		}
 		/* Should not happen... */
-#if 0
+#if 1
 		printk(KERN_DEBUG "keyboard reply expected - got %02x\n",
 		       scancode);
 #endif
@@ -385,6 +389,51 @@
 	    return 0200;
 }
 
+#ifdef KEYBOARD_IN_PSAUX
+static void *psaux_id;
+
+static char strange_xlat[ 256 ] = {
+/*         0    1    2    3    4    5    6    7    8    9    a    b    c    d    e    f */
+/* 0 */ 0x00,0x43,0x00,0x3f,0x3d,0x3b,0x3c,0x58,0x00,0x44,0x42,0x40,0x3e,0x0f,0x29,0x00,
+/* 1 */ 0x00,  56,0x2a,0x00,  29,0x10,0x02,0x00,0x00,0x00,0x2c,0x1f,0x1e,0x11,0x03,0x00,
+/* 2 */ 0x00,0x2e,0x2d,0x20,0x12,0x05,0x04,0x00,0x00,  57,0x2f,0x21,0x14,0x13,0x06,0x00,
+/* 3 */ 0x00,0x31,0x30,0x23,0x22,0x15,0x07,0x00,0x00,0x00,0x32,0x24,0x16,0x08,0x09,0x00,
+/* 4 */ 0x00,0x33,0x25,0x17,0x18,0x0b,0x0a,0x00,0x00,0x34,0x35,0x26,0x27,0x19,0x0c,0x00,
+/* 5 */ 0x00,0x00,0x28,0x00,0x1a,0x0d,0x00,0x00,0x3a,0x36,0x1c,0x1b,0x00,0x2b,0x00,0x00,
+/* 6 */ 0x00,0x00,0x00,0x00,0x00,0x00,  14,0x00,0x00,0x4f,0x00,0x4b,0x47,0x00,0x00,0x00,
+/* 7 */ 0x52,0x53,0x50,0x00,0x4d,0x48,0x01,0x00,0x57,0x00,0x51,0x00,0x37,0x49,0x46,0x00,
+/* 8 */ 0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* 9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* a */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* b */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* c */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* d */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* e */ 0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+/* f */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
+};
+
+#ifdef KEYBOARD_IN_PSAUX
+/* We are handling keyboard, in fact */
+static inline void handle_mouse_event(int c)
+{
+	static int or = 0, i;
+
+	switch (c) {
+	case 0xf0:
+		or = 0x80;
+		return;
+	}
+	
+	i = strange_xlat[c];
+	if (!i)
+		printk( "Unknown strangecode %x\n", c );
+	kbd_handle_scancode( i|or );
+	or = 0;
+}
+#endif
+
+#else
+
 static inline void handle_mouse_event(unsigned char scancode)
 {
 #ifdef CONFIG_PSMOUSE
@@ -411,6 +460,7 @@
 	}
 #endif
 }
+#endif
 
 /*
  * This reads the keyboard status port, and does the
@@ -504,8 +554,10 @@
 
 void pckbd_leds(unsigned char leds)
 {
-	if (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds))
+	if (!send_data(KBD_CMD_SET_LEDS) || !send_data(leds)) {
+	    printk("Could not set leds\n" );
 	    send_data(KBD_CMD_ENABLE);	/* re-enable kbd if any errors */
+	}
 }
 
 /*
@@ -996,6 +1048,9 @@
 	kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable aux device. */
 	kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints. */
 
+#ifdef KEYBOARD_IN_PSAUX
+	open_aux(NULL, NULL);
+#endif
 	return 0;
 }
 


-- 
I'm really pavel na ucw.cz. Look at http://195.113.31.123/~pavel.  Pavel
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!


Další informace o konferenci Linux