Difference between revisions of "Keyboard"

From Pandora Wiki
Jump to: navigation, search
m (Add XFCE tips : move window and resize window)
(merged remapping keys on the keyboard page)
Line 116: Line 116:
 
image:Keypadmatrix.png
 
image:Keypadmatrix.png
 
</gallery>
 
</gallery>
 +
 +
==THE FOLLOWING IS THE REMAPPING KEYS ON THE KEYBOARD PAGE==
 +
 +
==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
 +
* [[http://www.gp32x.com/board/index.php?/topic/55124-remapping-the-mouse-buttons-etc/ Remapping The Mouse Buttons, Etc?]]
 +
* [[http://www.gp32x.com/board/index.php?/topic/54077-changing-the-function-of-buttoms/ Changing The Function Of Buttoms]]
 +
* [[http://www.gp32x.com/board/index.php?/topic/54324-remap-gaming-buttons-within-xfce 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 :(
 +
 +
===Issues===
 +
Many apps (including the xfce window manager) have built in keyboard shortcuts which may clash with any good ideas you want to try. However, since people have different use cases, and hardware WILL break over time, it makes sense to help people to find their own problems. The default is probably set forever, but everything is re-configurable (even if it means re-writing the kernel input drivers).
 +
 +
The use of the Pandora button for menu/kill was un-reliable as of hotfix3. (Fixed in git, not released yet)
 +
The nub configuration app allows the nubs to be swapped, but currently only the nubs (or an external mouse) will generate mouse button events, and this is not trivial to change (for a user).
 +
 +
===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 <pre>/etc/pandora/conf/eventmap</pre> file. How  to reference additional special keys is TBD. A thread showing an example is [[http://www.gp32x.com/board/index.php?/topic/54944-xfce-style-changing-with-brightness-buttons-hack/ here]]
 +
It is also possible to configure xfce to capture events (forum thread is not locatable today)
 +
 +
===Using shoulder buttons for mouse===
 +
{{hint|Seems only to be reported working permanently on HF4 but see NOTE below}}
 +
As described in this [http://www.gp32x.com/board/index.php?/topic/55124-remapping-the-mouse-buttons-etc/page__view__findpost__p__896576 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)
 +
<source lang="bash">
 +
keycode 62 = Pointer_Button1 NoSymbol Pointer_Button1
 +
keycode 105 = Pointer_Button3 NoSymbol Pointer_Button3
 +
</source>
 +
# 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 [http://urjaman.dyndns.info/xkbset xkbset], copy to /usr/bin and chmod a+x /usr/bin/xkbset
 +
# Create a script (file) with this as content
 +
<source lang="bash">#!/bin/sh
 +
xkbset m
 +
xkbset exp =m</source>
 +
# Now open a terminal where the file is saved, and give it executable permissions:
 +
#:<source lang="bash">chmod +x nameofyourfile.sh</source>
 +
#Now install it:
 +
#:<source lang="bash">sudo cp nameofyourfile.sh /usr/bin/nameofyourfile</source>
 +
# 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)
 +
<pre>xkbset m
 +
xkbset exp m</pre>
 +
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):
 +
<pre>keysym Tab = Caps_Lock
 +
remove Lock = Caps_Lock
 +
keycode 66 = Tab NoSymbol Tab
 +
add Lock = Caps_Lock</pre>
 +
After you add this, just run "xmodmap ~/.pndXmodmap" to reload the keymappings
 +
 +
[[Category:Tutorials]]
 +
[[Category:Keyboard]]
 +
[[Category:Optimization]]
 +
  
 
[[Category:Keyboard]]
 
[[Category:Keyboard]]

Revision as of 16:29, 10 September 2013

Pandkey.png

XFCE

Key Function
Shoulder Button L Shift
Shoulder Button R Ctrl
D-pad Cursor Keys
L-Nub Mouse Cursor
R-Nub Mousebutton Mode (L=L mousebutton click, U=Double-L-click, R=R mousebutton click, D=Middle mousebutton click)
Game A Home
Game B End
Game Y PgUp
Game X PgDn
Fn key Sticky, so can be pressed before a key which you want to modify.
Shift-Enter Compose mode. Compose mode allows <shift><enter><fn> s a to combine " and a to get a special character, for example.
Alt/Ctrl/Start(1 sec) Kill(long hold)
Pandora key Quick-press pulls up start menu.
Longer press brings up kill-tasks menu.
Hold and flick power switch does a hard-reset of the Pandora (in case of software crashes; see also power modes).
Shift + mouse hold L + dragging
Shoulder Button L + mouse hold L + dragging
move window around
Shift + mouse hold R + dragging
Shoulder Button L + mouse hold R + dragging
resize window
  • In XFCE, if a program is greater than the Pandora's screen resolution, you can scroll by holding down shift (or the left shoulder button) then clicking anywhere in the window and dragging it around.

Minimenu

Key Function
Shoulder Buttons Move left or right through the categories
D-pad move through the PNDs and folders
Select Options
Game A Toggle detail panel
Game B or Start Select item (run PND or go inside folder)
Game Y Read documentation for PND, if it exists
Game X If detail panel is on, remind yourself of controls
Keyboard Type a letter to skip to the first PND beginning with the letter.
Space App menu
  • In minimenu, pressing Y when an icon is highlighted brings up the readme files.

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

See also:

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)

THE FOLLOWING IS THE REMAPPING KEYS ON THE KEYBOARD PAGE

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

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 :(

Issues

Many apps (including the xfce window manager) have built in keyboard shortcuts which may clash with any good ideas you want to try. However, since people have different use cases, and hardware WILL break over time, it makes sense to help people to find their own problems. The default is probably set forever, but everything is re-configurable (even if it means re-writing the kernel input drivers).

The use of the Pandora button for menu/kill was un-reliable as of hotfix3. (Fixed in git, not released yet) The nub configuration app allows the nubs to be swapped, but currently only the nubs (or an external mouse) will generate mouse button events, and this is not trivial to change (for a user).

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


As described in this post

  1. 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.
  2. 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
  1. If you want to use the 'a' and 'b' buttons, the codes are 110 and 115 respectively.
  2. As a test, open the XFCE Accessibility settings and enable mouse keys.
  3. To make this permanent, download a compiled version of xkbset, copy to /usr/bin and chmod a+x /usr/bin/xkbset
  4. Create a script (file) with this as content
#!/bin/sh
xkbset m
xkbset exp =m
  1. Now open a terminal where the file is saved, and give it executable permissions:
    chmod +x nameofyourfile.sh
    
  2. Now install it:
    sudo cp nameofyourfile.sh /usr/bin/nameofyourfile
    
  3. Add this script to XFCE autostarted stuff (Session and Startup->Application Autostart)

NOTE

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