Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Feb 2009 14:49:15 -0800
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Determining scancodes for obscure keyboard to modify keymap
Message-ID:  <20090224224915.GA3611@ayn.mi.celestial.com>
In-Reply-To: <20090224233742.6601b7d5@baby-jane.lamaiziere.net>
References:  <93e00050902241328x6867e315vd7c3b63c46d685c0@mail.gmail.com> <20090224233742.6601b7d5@baby-jane.lamaiziere.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <carnagewashere@gmail.com>:
>
>> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090224224915.GA3611>