Re: Keyboard adapter

Daniel Thompson <[email protected]>
Newsgroups gmane.linux.ports.game-cube.devel
Message-ID <[email protected]>
On Sat, 2005-04-30 at 17:36 -0700, Shaun Jackman wrote:
> I have a PS/2 keyboard to GameCube joystick port adapter labelled "GC
> Keyboard & PS Controller Adapter 2 in 1 for GameCube". It works with
> Action Replay and Phantasy Star Online, but I haven't managed to get
> it working with Linux. Does this device work with GC Linux? I'm
> running Linux 2.6.11-isobel-nfs9.

Try the attached patch.

-- 
Daniel Thompson (Merlin) <[email protected]>
signature.asc? http://www.redfelineninja.dsl.pipex.com/signature.html

Did Sigmund's wife wear Freudian slips?
si-liksang_adaptor.patch (text/x-patch, 1.5 KB)
--- linux/drivers/input/gcn-si.c	2004-12-03 21:33:45.000000000 +0000
+++ linux-2.6.10/drivers/input/gcn-si.c	2005-02-13 16:42:06.000000000 +0000
@@ -95,7 +95,7 @@
 };
 
 typedef struct {
-	unsigned char old[3];
+	unsigned char old[6];
 } keyboard_status;
 
 typedef enum {CTL_PAD,CTL_KEYBOARD,CTL_UNKNOWN} control_type;
@@ -264,7 +264,7 @@
 static void gcn_si_timer(unsigned long portno)
 {
 	unsigned long raw[2];
-	unsigned char key[3];
+	unsigned char key[6];
 	unsigned char oldkey;
 	int i;
 
@@ -327,18 +327,24 @@
 		key[1] = (raw[0] >> 4) & 0xFF;
 		key[2] = (raw[0] << 4) & 0xFF;
 		key[2] |= (raw[1] << 28) & 0xFF;
+		key[3] = (raw[1] >> 24) & 0xFF;
+		key[4] = (raw[1] >> 16) & 0xFF;
+		key[5] = (raw[1] >> 8) & 0xFF;
+
+		/*si_printk(KERN_INFO, "raw state = %08x %08x; key state = %02x %02x %02x\n", raw[0], raw[1], key[0], key[1], key[2]);*/
 
 		/* check if anything was released */
-		for (i = 0; i < 3; ++i) {
+		for (i = 0; i < 6; ++i) {
 			oldkey = port[portno].keyboard.old[i];
-			if (oldkey != key[0] &&
-			    oldkey != key[1] && oldkey != key[2])
+			if (oldkey != key[0] && oldkey != key[1] &&
+                            oldkey != key[2] && oldkey != key[3] &&
+			    oldkey != key[4] && oldkey != key[5])
 				input_report_key(&port[portno].idev,
 						 gamecube_keymap[oldkey], 0);
 		}
 
 		/* report keys */
-		for (i = 0; i < 3; ++i) {
+		for (i = 0; i < 6; ++i) {
 			if (key[i])
 				input_report_key(&port[portno].idev,
 						 gamecube_keymap[key[i]], 1);
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCdJoyrr8Ifkjg/MwRAlZkAKCaopnue1vf1LhG6P8AS0UIaAO2SQCbBHeS
bh9B2D+pwviWupiHXzC4JsY=
=i6Ui
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.