From patchwork Sun Apr 11 04:05:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 57973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bilbo.ozlabs.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.3.1 X-Original-To: tony@bakeyournoodle.com Delivered-To: tony@bilbo.ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 0AF8DB7E76 for ; Sun, 11 Apr 2010 18:48:37 +1000 (EST) Received: by ozlabs.org (Postfix, from userid 1010) id 1F37CB7D1C; Sun, 11 Apr 2010 14:07:31 +1000 (EST) Date: Sun, 11 Apr 2010 14:05:59 +1000 From: Anton Blanchard To: yaboot-devel@lists.ozlabs.org Subject: [PATCH 7/10] prom_getchar eats characters Message-ID: <20100411040559.GD11751@kryten> References: <20100411040149.GA3142@kryten> <20100411040226.GB3142@kryten> <20100411040256.GC3142@kryten> <20100411040321.GD3142@kryten> <20100411040427.GA11751@kryten> <20100411040448.GB11751@kryten> <20100411040521.GC11751@kryten> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100411040521.GC11751@kryten> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Sun, 11 Apr 2010 18:48:32 +1000 X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: yaboot-devel-bounces+tony=bakeyournoodle.com@lists.ozlabs.org Errors-To: yaboot-devel-bounces+tony=bakeyournoodle.com@lists.ozlabs.org Content-Length: 1637 Lines: 53 This bug has been annoying me for a long time. If you copy and paste a string into the yaboot prompt, or even type too fast, characters get dropped. It turns out we were asking OF for 4 characters, but only using the first one. There is strange logic to look for \e[, and then oring the third character with 0x100. I haven't been able to find anyone that knows why that was there in the first place, so just remove it and fix this bug once and for all. Automated test infrastructures the world over will thank us for fixing this bug! Signed-off-by: Anton Blanchard Index: yaboot/second/prom.c =================================================================== --- yaboot.orig/second/prom.c 2010-04-11 11:17:21.000000000 +1000 +++ yaboot/second/prom.c 2010-04-11 11:31:05.000000000 +1000 @@ -387,16 +387,14 @@ prom_readblocks (prom_handle dev, int bl int prom_getchar () { - char c[4]; + char c; int a; - while ((a = (int)call_prom ("read", 3, 1, prom_stdin, c, 4)) == 0) + while ((a = (int)call_prom ("read", 3, 1, prom_stdin, &c, 1)) == 0) ; if (a == -1) prom_abort ("EOF on console\n"); - if (a == 3 && c[0] == '\e' && c[1] == '[') - return 0x100 | c[2]; - return c[0]; + return c; } int @@ -511,8 +509,6 @@ prom_readline (char *prompt, char *buf, while (i < len-1 && (c = prom_getchar ()) != '\r') { - if (c >= 0x100) - continue; if (c == 8) { if (i > 0)