From owner-freebsd-questions@FreeBSD.ORG Tue Feb 24 22:49:16 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C70A10656E6 for ; Tue, 24 Feb 2009 22:49:16 +0000 (UTC) (envelope-from bill@mi.celestial.com) Received: from dorsai-02.celestial.com (dorsai-02.celestial.com [192.136.111.19]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6718FC29 for ; Tue, 24 Feb 2009 22:49:16 +0000 (UTC) (envelope-from bill@mi.celestial.com) Received: from localhost (localhost.localdomain [127.0.0.1]) by dorsai-02.celestial.com (Postfix) with ESMTP id B767820676A1 for ; Tue, 24 Feb 2009 14:49:15 -0800 (PST) X-Virus-Scanned: amavisd-new at celestial.com Received: from dorsai-02.celestial.com ([127.0.0.1]) by localhost (dorsai-02.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id O-ercFq5zKr6 for ; Tue, 24 Feb 2009 14:49:15 -0800 (PST) Received: from ayn.mi.celestial.com (hayek.celestial.com [192.136.111.12]) by dorsai-02.celestial.com (Postfix) with ESMTP id 83E5A206663F for ; Tue, 24 Feb 2009 14:49:15 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by ayn.mi.celestial.com (Postfix) with ESMTP id 65E7868BBC567; Tue, 24 Feb 2009 14:49:15 -0800 (PST) X-Virus-Scanned: amavisd-new at mi.celestial.com Received: from ayn.mi.celestial.com ([127.0.0.1]) by localhost (ayn.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id V7mqDIAlKltx; Tue, 24 Feb 2009 14:49:15 -0800 (PST) Received: by ayn.mi.celestial.com (Postfix, from userid 203) id 45AE768BBC566; Tue, 24 Feb 2009 14:49:15 -0800 (PST) Date: Tue, 24 Feb 2009 14:49:15 -0800 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20090224224915.GA3611@ayn.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <93e00050902241328x6867e315vd7c3b63c46d685c0@mail.gmail.com> <20090224233742.6601b7d5@baby-jane.lamaiziere.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LQksG6bCIzRHxTLp" Content-Disposition: inline In-Reply-To: <20090224233742.6601b7d5@baby-jane.lamaiziere.net> User-Agent: Mutt/1.5.18 OpenPKG/% (2008-05-17) Subject: Re: Determining scancodes for obscure keyboard to modify keymap X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2009 22:49:16 -0000 --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 24, 2009, Patrick Lamaizi?re wrote: >Le Tue, 24 Feb 2009 14:28:54 -0700, >carnage : > >> I'm wondering how to go about determining the scancodes for keys on >> keypress. >> >> I am looking to remap an apple usb keyboard (a1048). It has F13-16, 3 >> volume control keys and an eject key but no scroll lock, num lock, >> pause/break, etc. I'm wondering how I would go about changing some >> of these not so useful keys into useful keys. >> >> The keymap files in /usr/share/syscons/keymaps seem easy enough to >> modify but I am unsure of how to determine what the scancodes >> associated with the actual keys on keypress are. > >I asked for this some times ago without any reply. Finally I added some >printf in the kbd driver. I don't remember exactly where, I think it was >in the function genkbd_keyaction() in kdb.c (something like printf("%i >- ", keycode) > >That's ugly... Is there a better way to get the scancode? As somebody else pointed out, xev is your friend. I am attaching the .Xmodmap file I use on OS X to allow the numeric keypad on the Microsoft 4000 natural keybaord to do the Right Thing(tm) (e.g. send numbers when using python curses). BTW: the emacs stuff at the end is supposed to work, but I have not been able to get it to work, but then I've never been able to get my fingers around emacs either -- they've been doing vi for 25+ years, and seem to be untrainable. Bill -- INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 A liberal is someone who feels a great debt to his fellow man, which debt he proposes to pay off with your money. -- G Gordon L iddy --LQksG6bCIzRHxTLp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=".Xmodmap" ! keypad mappings for Apple with Microsoft Natural keyboard keycode 91 = 1 keycode 90 = 0 keycode 92 = 2 keycode 93 = 3 keycode 94 = 4 keycode 95 = 5 keycode 96 = 6 keycode 97 = 7 keycode 99 = 8 keycode 100 = 9 keycode 73 = period keycode 83 = slash keycode 75 = asterisk keycode 86 = minus keycode 77 = plus keycode 84 = Return ! Microsoft Ergonomic 4000 keycode 89 = equal ! emacs mapping keys to Alt clear mod2 keycode 63 = Meta_L keycode 66 = Meta_L add mod2 = Meta_L --LQksG6bCIzRHxTLp--