Difference between revisions of "Keyboard"
m (removed cruft) |
(All issues were fixed, so section removed) |
||
Line 66: | Line 66: | ||
The os should allow the standard keypad and modifier keys to be defined to generate any key. So if you want shift '1' to be anything other than 'section', it is possible. somehow :( | The os should allow the standard keypad and modifier keys to be defined to generate any key. So if you want shift '1' to be anything other than 'section', it is possible. somehow :( | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===Linking events to Keys=== | ===Linking events to Keys=== |
Revision as of 06:55, 31 October 2013
Many desirable applications require a keyboard,general consensus was that an on-screen keyboard wasn't good enough. Forcomputing mode, the game controls are used for mouse, cursor and control keys.
Some classic systems such as the Atari and C64, which had keyboards, are far more comfortably emulated on a device with a keyboard.
Contents
Keycodes
This table might be useful if you're trying to map keys in some program, or writing a program:
Pandora button | Keycode | Hex Equivalent |
---|---|---|
Space | key 32 | 0020 |
Pandora | key 147 | 0093 |
D-pad up | key 273 | 0111 |
D-pad down | key 274 | 0112 |
D-pad right | key 275 | 0113 |
D-pad left | key 276 | 0114 |
Game A | key 278 | 0116 |
Game B | key 279 | 0117 |
Game Y | key 280 | 0118 |
Game X | key 281 | 0119 |
Shoulder L | key 303 | 012f |
Shoulder R | key 305 | 0131 |
Select | key 306 | 0132 |
Start | key 308 | 0134 |
Sources: 1, 2, 3 4 (note: the last two links give different keycodes for the gaming buttons. Possibly both numbers will work?)
Other notes
- In DOSBox, in order to use the colon symbol, you have to press shift (left shoulder button) + Fn + ";". This also goes for the underscore symbol.
History
In the months before the first preorders were taken, there was much discussion and community voting about the best layout. This was one of the final votes. The final layout was different from either one of the two most popular community proposals, but incorporated some of the suggestions such as having a "Pandora" button.
Matrix
The matrix layout is detailed on p.20 of the Hardware hacker's guide (here). A more readable version appears below. A .svg version of the Pandora's keyboard layout (made by cosurgi) can be downloaded here. (broken link)
Remapping keys on the keyboard
First, an apology - I'm writing this without knowing how to remap the keys on the keyboard, so this is not really a tutorial. It is currently just a collection point for information on the subject.
Reference
Forum Threads
- [Remapping The Mouse Buttons, Etc?]
- [Changing The Function Of Buttoms]
- [Remap Gaming Buttons Within Xfce]
The os should allow the standard keypad and modifier keys to be defined to generate any key. So if you want shift '1' to be anything other than 'section', it is possible. somehow :(
Linking events to Keys
There is a Pandora event map daemon, which reacts to the lid close, Pandora button and power button.
It can be configured using the
/etc/pandora/conf/eventmap
file. How to reference additional special keys is TBD. A thread showing an example is [here]
It is also possible to configure xfce to capture events (forum thread is not locatable today)
Using shoulder buttons for mouse
Seems only to be reported working permanently on HF4 but see NOTE below |
As described in this post
- Find the keycodes which you want to modify. Run xev (this needs to be installed from angstrom repo) from the terminal, and record the numbers.
- Edit the .pndXmodmap file in your home directory, modify or add (in the correct numerical order for ease) lines like this (for the shoulder buttons)
keycode 62 = Pointer_Button1 NoSymbol Pointer_Button1
keycode 105 = Pointer_Button3 NoSymbol Pointer_Button3
- If you want to use the 'a' and 'b' buttons, the codes are 110 and 115 respectively.
- As a test, open the XFCE Accessibility settings and enable mouse keys.
- To make this permanent, download a compiled version of xkbset, copy to /usr/bin and chmod a+x /usr/bin/xkbset
- Create a script (file) with this as content
#!/bin/sh
xkbset m
xkbset exp =m
- Now open a terminal where the file is saved, and give it executable permissions:
chmod +x nameofyourfile.sh
- Now install it:
sudo cp nameofyourfile.sh /usr/bin/nameofyourfile
- Add this script to XFCE autostarted stuff (Session and Startup->Application Autostart)
NOTE
- For HF5 you only need add these two commands to .xinitrc (located in your home directory)
xkbset m xkbset exp m
note the missing =(equals) sign
Swapping Caps Lock and Tab
As a command line junkie, I was pretty frustrated with where Tab is. I decided to remap it to where Caps Lock is (Fn + Shift). I added the following to .pndXmodmap (in your home directory):
keysym Tab = Caps_Lock remove Lock = Caps_Lock keycode 66 = Tab NoSymbol Tab add Lock = Caps_Lock
After you add this, just run "xmodmap ~/.pndXmodmap" to reload the keymappings
KEYBOARD LAYOUT CHANGER
The keyboard layout changer is a simple tool to easily change keyboard layout. Possible uses are for typing in a different language on your Pandora, for using an external keyboard, or simply for making small key modifications.
Usage guide
- Download the PND to your Pandora from either Slaeshjag's site or from the Repo (see here for instructions on where to place PNDs)
- Run the PND; it's called "Keyboard Layout" and is in the "Settings" category
- You will now see a choice of keyboard layouts. Choose one, and your layout will change!
(if the program doesn't run, find the/tmp/pndrun_kblayout.out
file and post its contents in the official forum thread, so that the author can see what went wrong)
Making your own custom keyboard layouts
- Go to the
/media/yourSDcard/pandora/appdata/kblayout/keymaps
directory. Inside, you will see a bunch of files. Open any one with a text editor, and you'll see something like this:
./setxkbmap -layout us xmodmap ~/.pndXmodmap
What this means is that it's using the "us" layout with the modifications specified in the ".pndXmodmap" file (the Pandora needs these modifications because its keyboard isn't the same as a standard one).
So there are two basic things you could change: you could replace "us" with a different base layout, or you could replace "~/.pndXmodmap" with a different file.
Base layouts
The default layout is "us". The full list of base layouts included with the Pandora is listed in the file /usr/share/X11/xkb/keymap/xfree86
. Here's the full list:
us ar be bg br cz de ch_de ch_fr dk dvorak en_US es fr fr-latin9 fr_CA gb hr it jp106 lt lt_std lv mk mt no pl pt ro ro_microsoft ru se_FI se_SE sl sl_SI sk syr th th_tis th_pat tr uk us_flexpro us_intl us_microsoft uz cz_qwerty de_CH fr_CH mt_us sk_qwerty
If you just want to use one of these base layouts with no modifications, make a new file in the /media/yourSDcard/pandora/appdata/kblayout/keymaps
directory, name it anything, open it in a text editor and place the following text inside, replacing "xx" with any of the codes in the above list:
./setxkbmap -layout xx
Save the file. Then just start Keyboard Layout Changer, and you'll be able to select it.
xmodmap
This type of file modifies whatever base layout is selected. One of these comes by default with your Pandora OS. You can find the .pndXmodmap
file in the /home/username
directory. It might be hidden, so press Ctrl+H to make it visible. If you open it with a text editor, you'll see this:
keycode 9 = Escape NoSymbol Escape keycode 10 = 1 section 1 section keycode 11 = 2 braceleft 2 braceleft keycode 12 = 3 braceright 3 braceright keycode 13 = 4 asciitilde 4 asciitilde keycode 14 = 5 percent 5 percent keycode 15 = 6 asciicircum 6 asciicircum keycode 16 = 7 ampersand 7 ampersand keycode 17 = 8 asterisk 8 asterisk keycode 18 = 9 bracketleft 9 bracketleft keycode 19 = 0 bracketright 0 bracketright keycode 22 = BackSpace Delete BackSpace Delete keycode 24 = q Q q Q keycode 25 = w W w W keycode 26 = e E e E keycode 27 = r R r R keycode 28 = t T t T keycode 29 = y Y y Y keycode 30 = u U u U keycode 31 = i I i I keycode 32 = o O o O keycode 33 = p P p P keycode 34 = parenleft NoSymbol parenleft keycode 35 = parenright NoSymbol parenright keycode 36 = Return Multi_key Return keycode 37 = Control_L NoSymbol Control_L keycode 38 = a A a A keycode 39 = s S s S keycode 40 = d D d D keycode 41 = f F f F keycode 42 = g G g G keycode 43 = h H h H keycode 44 = j J j J keycode 45 = k K k K keycode 46 = l L l L keycode 47 = semicolon NoSymbol semicolon keycode 48 = apostrophe NoSymbol apostrophe keycode 49 = grave NoSymbol grave keycode 50 = Shift_L NoSymbol Shift_L keycode 52 = z Z z Z keycode 53 = x X x X keycode 54 = c C c C keycode 55 = v V v V keycode 56 = b B b B keycode 57 = n N n N keycode 58 = m M m M keycode 59 = comma less comma less keycode 60 = period greater period greater keycode 61 = slash NoSymbol slash keycode 62 = Shift_R NoSymbol Shift_R keycode 64 = Alt_L NoSymbol Alt_L keycode 65 = space NoSymbol space keycode 66 = Caps_Lock NoSymbol Caps_Lock keycode 67 = F1 NoSymbol F1 keycode 68 = F2 NoSymbol F2 keycode 69 = F3 NoSymbol F3 keycode 70 = F4 NoSymbol F4 keycode 71 = F5 NoSymbol F5 keycode 72 = F6 NoSymbol F6 keycode 73 = F7 NoSymbol F7 keycode 74 = F8 NoSymbol F8 keycode 75 = F9 NoSymbol F9 keycode 76 = F10 NoSymbol F10 keycode 82 = minus NoSymbol minus NoSymbol keycode 83 = Home quotedbl Home quotedbl keycode 86 = plus NoSymbol plus NoSymbol keycode 87 = Prior Multi_key Prior Multi_key keycode 88 = End XF86_Switch_VT_2 End XF86_Switch_VT_2 keycode 89 = Next XF86_Switch_VT_1 Next XF86_Switch_VT_1 keycode 95 = F11 NoSymbol F11 keycode 96 = F12 NoSymbol F12 keycode 118 = Insert NoSymbol Insert keycode 132 = yen NoSymbol yen keycode 187 = parenleft NoSymbol parenleft keycode 188 = parenright NoSymbol parenright keycode 191 = acute NoSymbol acute keycode 192 = bar NoSymbol bar keycode 193 = underscore NoSymbol underscore keycode 194 = numbersign NoSymbol numbersign keycode 195 = exclam NoSymbol exclam keycode 196 = sterling NoSymbol sterling keycode 197 = quotedbl NoSymbol quotedbl keycode 198 = at NoSymbol at keycode 199 = colon NoSymbol colon keycode 200 = dollar NoSymbol dollar keycode 201 = EuroSign NoSymbol EuroSign keycode 222 = question NoSymbol question keycode 235 = Tab NoSymbol Tab
Ok, now let's break this down a little. keycode 38 = a A a A
- the first two letters after the = sign are what you'll get if you press the button marked A with and without holding "shift". The next two are with and without shift modifier together with a second modifier, but since there's no second modifier on the Pandora, this is redundant really. What about Fn, you may ask, isn't that a second modifier? The Fn-key acts on a lower level, and is not seen as a separate key. Instead, there are separate keycode entries for all Fn keys (the ones marked in blue on your Pandora). "NoSymbol" means that the combination doesn't produce a character. You can find a full list of symbols (or "keysyms") that you can use over here.
You can edit the .pndXmodmap file itself if you want to. That'll change the default keyboard layout you have at startup.
But you can also make secondary custom keyboard layouts.
For example, here's how to make a selectable custom Russian keyboard layout:
Making a custom Russian keyboard layout
Make two new files inside /media/yourSDcard/pandora/appdata/kblayout/keymaps
. One called "RU-translit" (the name doesn't matter), one called ".rumodmap" (the dot at the start of the name is to make it not show up in the Keyboard Layout Changer menu as a keymap; that's the function of the first file you made). Put this text in the RU-translit file:
./setxkbmap -layout us xmodmap keymaps/.rumodmap
Put this text in the .rumodmap file:
keycode 9 = Escape NoSymbol Escape keycode 10 = 1 section 1 section keycode 11 = 2 braceleft 2 braceleft keycode 12 = 3 braceright 3 braceright keycode 13 = 4 asciitilde 4 asciitilde keycode 14 = 5 percent 5 percent keycode 15 = 6 asciicircum 6 asciicircum keycode 16 = 7 ampersand 7 ampersand keycode 17 = 8 asterisk 8 asterisk keycode 18 = 9 bracketleft 9 bracketleft keycode 19 = 0 bracketright 0 bracketright keycode 22 = BackSpace Delete BackSpace Delete keycode 24 = Cyrillic_ya Cyrillic_YA Cyrillic_ya Cyrillic_YA keycode 25 = Cyrillic_zhe Cyrillic_ZHE Cyrillic_zhe Cyrillic_ZHE keycode 26 = Cyrillic_ie Cyrillic_IE Cyrillic_ie Cyrillic_IE keycode 27 = Cyrillic_er Cyrillic_ER Cyrillic_er Cyrillic_ER keycode 28 = Cyrillic_te Cyrillic_TE Cyrillic_te Cyrillic_TE keycode 29 = Cyrillic_yeru Cyrillic_YERU Cyrillic_yeru Cyrillic_YERU keycode 30 = Cyrillic_u Cyrillic_U Cyrillic_u Cyrillic_U keycode 31 = Cyrillic_i Cyrillic_I Cyrillic_i Cyrillic_I keycode 32 = Cyrillic_o Cyrillic_O Cyrillic_o Cyrillic_O keycode 33 = Cyrillic_pe Cyrillic_PE Cyrillic_pe Cyrillic_PE keycode 34 = parenleft NoSymbol parenleft keycode 35 = parenright NoSymbol parenright keycode 36 = Return Multi_key Return keycode 37 = Control_L NoSymbol Control_L keycode 38 = Cyrillic_a Cyrillic_A Cyrillic_a Cyrillic_A keycode 39 = Cyrillic_es Cyrillic_ES Cyrillic_es Cyrillic_ES keycode 40 = Cyrillic_de Cyrillic_DE Cyrillic_de Cyrillic_DE keycode 41 = Cyrillic_ef Cyrillic_EF Cyrillic_ef Cyrillic_EF keycode 42 = Cyrillic_ghe Cyrillic_GHE Cyrillic_ghe Cyrillic_GHE keycode 43 = Cyrillic_che Cyrillic_CHE Cyrillic_che Cyrillic_CHE keycode 44 = Cyrillic_shorti Cyrillic_SHORTI Cyrillic_shorti Cyrillic_SHORTI keycode 45 = Cyrillic_ka Cyrillic_KA Cyrillic_ka Cyrillic_KA keycode 46 = Cyrillic_el Cyrillic_EL Cyrillic_el Cyrillic_EL keycode 47 = semicolon NoSymbol semicolon keycode 48 = apostrophe NoSymbol apostrophe keycode 49 = grave NoSymbol grave keycode 50 = Shift_L NoSymbol Shift_L keycode 52 = Cyrillic_ze Cyrillic_ZE Cyrillic_ze Cyrillic_ZE keycode 53 = Cyrillic_ha Cyrillic_HA Cyrillic_ha Cyrillic_HA keycode 54 = Cyrillic_tse Cyrillic_TSE Cyrillic_tse Cyrillic_TSE keycode 55 = Cyrillic_ve Cyrillic_VE Cyrillic_ve Cyrillic_VE keycode 56 = Cyrillic_be Cyrillic_BE Cyrillic_be Cyrillic_BE keycode 57 = Cyrillic_en Cyrillic_EN Cyrillic_en Cyrillic_EN keycode 58 = Cyrillic_em Cyrillic_EM Cyrillic_em Cyrillic_EM keycode 59 = comma less comma less keycode 60 = period greater period greater keycode 61 = slash NoSymbol slash keycode 62 = Shift_R NoSymbol Shift_R keycode 64 = Alt_L NoSymbol Alt_L keycode 65 = space NoSymbol space keycode 66 = Caps_Lock NoSymbol Caps_Lock keycode 67 = Cyrillic_yu Cyrillic_YU Cyrillic_yu Cyrillic_YU keycode 68 = Cyrillic_e Cyrillic_E Cyrillic_e Cyrillic_E keycode 69 = Cyrillic_softsign Cyrillic_SOFTSIGN Cyrillic_softsign Cyrillic_SOFTSIGN keycode 70 = Cyrillic_sha Cyrillic_SHA Cyrillic_sha Cyrillic_SHA keycode 71 = Cyrillic_shcha Cyrillic_SHCHA Cyrillic_shcha Cyrillic_SHCHA keycode 72 = Cyrillic_io Cyrillic_IO Cyrillic_io Cyrillic_IO keycode 73 = Cyrillic_hardsign Cyrillic_HARDSIGN Cyrillic_hardsign Cyrillic_HARDSIGN keycode 74 = F8 NoSymbol F8 keycode 75 = F9 NoSymbol F9 keycode 76 = F10 NoSymbol F10 keycode 82 = minus Prior minus Prior keycode 83 = Home quotedbl Home quotedbl keycode 86 = plus NoSymbol plus NoSymbol keycode 87 = Prior Multi_key Prior Multi_key keycode 88 = End XF86_Switch_VT_2 End XF86_Switch_VT_2 keycode 89 = Next XF86_Switch_VT_1 Next XF86_Switch_VT_1 keycode 95 = F11 NoSymbol F11 keycode 96 = F12 NoSymbol F12 keycode 118 = Delete Insert Delete keycode 132 = yen NoSymbol yen keycode 187 = parenleft NoSymbol parenleft keycode 188 = parenright NoSymbol parenright keycode 191 = acute NoSymbol acute keycode 192 = bar NoSymbol bar keycode 193 = underscore NoSymbol underscore keycode 194 = numbersign NoSymbol numbersign keycode 195 = exclam NoSymbol exclam keycode 196 = sterling NoSymbol sterling keycode 197 = quotedbl NoSymbol quotedbl keycode 198 = at NoSymbol at keycode 199 = colon NoSymbol colon keycode 200 = dollar NoSymbol dollar keycode 201 = EuroSign NoSymbol EuroSign keycode 222 = question NoSymbol question keycode 235 = Tab NoSymbol Tab
Once that's done, you can open the Keyboard Layout Changer, choose "RU-translit", and your keyboard layout will change to a layout similar to this one, with extra letters replacing F1-F7 (note: for those 7 letters, you can only use the Shift on the Pandora's front face, not the left shoulder button). To change back, open Keyboard Layout Changer again and select "default".
In the same way, you can create any other sorts of custom layouts. The easiest way to create a new modmap file is to copy+paste the contents of /home/username/.pndXmodmap
into a new file in the /media/yourSDcard/pandora/appdata/kblayout/keymaps
directory and make adjustments to whatever you want to change.
How many keypresses can it detect at once?
It can detect two "regular" keys being pressed at once[1]. However, this restriction does not apply to the game controls, or the central "Menu" keys.
- The keyboard is listed on p.20 of the hackers manual