Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread 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.

As an interesting aside: in x, control + option (alt) + backspace works to
terminate x yet control + option (alt) + Fn (F1, F2, etc.) does not work to
switch back to the virtual terminals.


dmesg.out
Description: Binary data
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread Patrick Lamaizière
Le Tue, 24 Feb 2009 14:28:54 -0700,
carnage carnagewash...@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?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread Roland Smith
On Tue, Feb 24, 2009 at 02:28:54PM -0700, carnage wrote:
 I'm wondering how to go about determining the scancodes for keys on
 keypress.

Try xev(1). 

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgpfjW7e4uPo2.pgp
Description: PGP signature


Re: Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread Bill Campbell
On Tue, Feb 24, 2009, Patrick Lamaizi?re wrote:
Le Tue, 24 Feb 2009 14:28:54 -0700,
carnage carnagewash...@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:   b...@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
! 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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

Re: Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread Polytropon
On Tue, 24 Feb 2009 14:28:54 -0700, carnage carnagewash...@gmail.com wrote:
 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.

I have the same keyboard on a secondary system and would know the
answert to your question, too. :-)

As I knew from configuring my Sun USB Type 6 keyboard, xev is a good
tool to check the keyboard output. It works for the Apple keys next
to the space bar, but not for PF13 -- PR16, the volume keys and the
eject key - xev doesn't show anything when they're pressed.

Maybe you can use my ~/.xmodmaprc for the Sun keyboard, at least for
educational purposes. :-)

(I'll add the english key names; because I have the german version,
I've initially named *them* within the comments.)


! 
! $XFree86: xc/programs/Xserver/hw/xfree86/etc/xmodmap.std,v 3.5 1996/12/23 
06:47:28 dawes Exp $
! $XConsortium: xmodmap.std /main/7 1996/02/21 17:48:55 kaleb $

!clear mod3
!clear mod4

add mod4 = Multi_key

! Hilfe / Help
keycode 144 = F13
! Stop / Stop
keycode 145 = F14
! Wiederholen / Again
keycode 146 = F15
! Eigenschaften / Props
keycode 147 = F16
! Zurücknehmen / Undo
keycode 148 = F17
! Vordergrund / Front
keycode 149 = F18
! Kopieren / Copy
keycode 150 = F19
! Öffnen / Open
keycode 151 = F20
! Einsetzen / Insert
keycode 152 = F21
! Suchen / Find
keycode 153 = F22
! Ausschneiden / Cut
keycode 154 = F23


! Ton aus / Entmagnetisieren / Mute / Degauss
keycode 141 = F24
! Leiser / Mehr Kontrast / Lower volume / contrast
keycode 142 = F25
! Lauter / Weniger Kontrast / Raise volume / contrast
keycode 143 = F26
! Ausschalten (Mond) / Switch off (Moon)
keycode 140 = F27


! Meta links / Meta left
keycode 115 = Meta_L
! Meta rechts / Meta right
keycode 116 = Meta_R
! Compose
keycode 117 = Multi_key
! 

It's easy to find out what the keys send using xev. Then, you can
easily assign any key name to them that is present in the symbol
file for xkb stuff. Note that this worked with XFree86 and X.org
so far, but due to the newest improvements, it may be possible
that settings have to be done very differently now... (I've not
taken the update yet.)



If you got the keys working, please report back to the list. I'd
be very interested in using them. They work fine when the keyboard
is attached to an iBook.



-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Determining scancodes for obscure keyboard to modify keymap

2009-02-24 Thread Michel Talon
Bill Campbell wrote:

 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).

Scancodes have nothing (*) to do with keycodes. Xev will be of absolutely no
help for remapping if it doesn't see the key at all, which frequently
occurs with exotic keys. As Patrick said, you need to dig into the OS
keyboard driver to solve the problem when working on the console. On
Linux it is easier there are commands to detect and remap scancodes.
Getting those keys working under X is still another problem, it may be
that you have to hack the keyboard controller of the X server to do
that. In other words, it is extremely inconvenient. Windows works
directly with scancodes and they can be remapped in the registry, with
all the problems this entails. On the other hand one can find scancode
documentation on Microsoft site.

(*) more precisely there is a partial mapping of scancodes to keycodes.
xmodmap manages a second mapping from keycodes to symbols, as
recognized by your X applications.

-- 

Michel TALON

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org