Setting up hard buttons in Ubuntu 10.04

This board posts about running linux on your webdt366

Setting up hard buttons in Ubuntu 10.04

Postby quotaholic » Sat Aug 28, 2010 9:40 am

After trying to use the same trick I used in Debian 5 to get hard buttons working in Lucid ( Ubuntu 10.04) I realized that the way the Xserver initializes was different and modifying the Xsession file would not get one a custom mapping for the hard buttons.

After reading the lucid man page on Xsession I found this bit of information. Basically it examples a file that we need to put in /etc/X11/Xsession.d that gets read when x is loading and will call xmodmap.

In order to use this trick please make sure you have the x11-xserver-utils package installed as it includes the program xmodmap.

Because  the  order in which the various scripts in /etc/X11/Xsession.d
      are executed is important, files to be added to this  directory  should
      have a well-formed name.  The following format is recommended:

      * a two-digit number denoting sequence;

      *  the  name  of  the  package  providing  the  script (or �custom� for
      locally-created scripts);

      * an underscore;

      * a description of the script�s basic function, using  only  characters
      allowed by run-parts.

      Here  is  an  example  of  how  one  might  write  a  script,  named
      40custom_load-xmodmap, to invoke xmodmap(1):


      if [ -x /usr/bin/X11/xmodmap ]; then
          if [ -f "$SYSMODMAP" ]; then
              xmodmap "$SYSMODMAP"

      if [ -x /usr/bin/X11/xmodmap ]; then
          if [ -f "$USRMODMAP" ]; then
              xmodmap "$USRMODMAP"

I called my file 45custom_load-xmodmap, as 40 was already taken, put all the above code in to it and placed it in /etc/X11/Xsession.d.

In the home directory I made a file called .Xmodmap

in this file I put this:

keycode 74 = Right
keycode 73 = Left
keycode 72 = Down
keycode 71 = Up
keycode 70 = Return
keycode 69 = F14
keycode 68 = F15
keycode 67 = F16

Feel free to modify this. I got the d-pad working with the first 4 lines. and mapped the return key to the last button on the right. The first three buttons I mapped out of the range of a normal keyboard so we don't experience any overlap. Upon logging out and back in or upon reboot you should see that the hard buttons are no longer calling F1 - F8 and that your d-pad will work as expected.

I use E17 for a window manager and it provides key bindings through a nice gui. Most wm's provide ways to do this in their configs. From there it is not hard to call an on screen keyboard or a script that will toggle one on or off. Check this post for a xvkbd script I wrote that will act just like the wince keyboard. One button press to call it and another button press to make it disappear.


Last edited by quotaholic on Sat Aug 28, 2010 9:43 am, edited 1 time in total.
Posts: 555
Joined: Tue Mar 24, 2009 9:11 pm

Return to Linux on a WebDT366?

Who is online

Users browsing this forum: No registered users and 3 guests