Dual keyboard (with thinkpad 560X)

Pavel Machek (pavel@bug.ucw.cz)
Sun, 27 Sep 1998 14:15:27 +0200


--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii

Hi!

It is possible to connect two keyoards to one computer. (I'll describe
concrete steps to do this with thinkpad 560X, altrough it should work
on any PS/2-mouse-capable computer).

0. Modify kernel to always detect psaux device

--- clean//drivers/char/psaux.c Fri Sep 11 20:54:24 1998
+++ linux/drivers/char/psaux.c Fri Sep 25 12:04:17 1998
@@ -617,7 +617,7 @@
psaux_fops.release = release_qp;
} else
#endif
- if (aux_device_present == 0xaa) {
+ if (1 || (aux_device_present == 0xaa)) {
printk(KERN_INFO "PS/2 auxiliary pointing device detected -- driver installed.\n");
aux_present = 1;
} else {

1. Thinkpad: Turn trackpoint off, reboot for change to take effect,
wait for linux to come up, CONNECT PS/2 KEYBOARD WHILE UP & RUNNING.
2. killall gpm (in case it touches /dev/psaux)
3. try attached software, leds on keyboard should blink and strange
scancodes should appear as you press keys on secondary
keyboard. (You'll need r/w privileges to /dev/psaux).

Strange is that keycodes are _not_ normal PC scancodes (I pressed ESC
F1 F2 F3 F4

(76)(f0)(76)(5)(f0)(5)(6)(f0)(6)(4)(f0)(4)(c)(f0)(c)

: release is prefixed with f0 etc. I would like to know what these
are...

And now, what issues it brings up: It is possible to create 2-console
machine from normally available components: you take PC, keyboard,
ps/2 keyboard, VGA and MDA (or good-PCI-VGA + good-PCI-VGA), and you
are done. I think that it would be nice to support this -
unfortunately this needs heavy modifications to current input device
support...

Pavel

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).
--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="delme.c"

#include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <fcntl.h>

#include "/usr/src/linux/drivers/char/pc_keyb.h"

int kbd; char translate[256];

void send(char c) { if (write (kbd, &c, 1)!=1) fprintf( stderr, "send: %m\n" ); }

unsigned char input(void) { unsigned char c; if (read (kbd, &c, 1)!=1) fprintf( stderr, "read: %m\n" ); fprintf( stderr, "(%x)", (int) c ); if (c == KBD_REPLY_ACK) fprintf( stderr, "==ACK" ); if (c == KBD_REPLY_RESEND) fprintf( stderr, "==RESEND" ); return c; }

void die(char *s) { fprintf(stderr, s); exit(1); }

void send_cmd( char c ) { do send(c); while (input() != KBD_REPLY_ACK); }

void leds( char c ) { send_cmd(KBD_CMD_SET_LEDS); send_cmd(c); }

#define X( a ) fprintf(stderr, "\n" a );

void main(void) { int c; kbd = open( "/dev/psaux", O_RDWR ); X( "Reseting keyboard..." ); send(KBD_CMD_RESET); input(); if (input()!=KBD_REPLY_POR) die("por expected\n"); leds(1); usleep(100000);

#if 0 X( "Disabling keyboard..." ); send_cmd(KBD_CMD_DISABLE); X( "Setting map mode..." ); send_cmd(0xf0); input(); send_cmd(0x01); input(); leds(7); sleep(1); #endif

X( "Enabling keyboard..." ); send_cmd(KBD_CMD_ENABLE); leds(4); usleep(100000);

X( "Setting autorepeat..." ); send_cmd(KBD_CMD_SET_RATE); send_cmd(0x00); leds(2); usleep(100000);

X( "Done.\n" ); leds(0); while(1) input(); }

--+QahgC5+KEYLbs62--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/