foxtrotgps / landscape mode X apps on qtmoko / QX

I’ve been playing with the latest QTmoko on my freerunner after a couple of years of not updating my distro.

Some thoughts:

It’s great! Very snappy and responsive – congrats and thank-you to Radek and the other contributors, you’ve done a fantastic job and you’ve made some great strides over the last couple of years.

I haven’t tried using it as a phone yet (I’m still put-off by my previous experiences, and don’t have a second SIM), but it looks like it might be *gasp* almost usable! :O I’m tempted to try it out as a phone…

I particularly like what you’ve done with the keyboard – I think it’s about as good as an on-screen keyboard is going to get on this device. Very nice. though I wish I could have it default to qwerty mode.

But it’s not perfect – everything I want doesn’t “just work” yet (though it is very good – things like wifi and bluetooth seem to just work). But that means I get to have some fun tinkering!

I’ve been messing about with making foxtrotgps work under QX on qtmoko for a little while, and wanted to jot down some notes and tips:

  • When QX asks which X server to install, I recommend xorg – xglamo doesn’t seem to like being rotated. I’d love to make xglamo work, because it seems faster. (Performance with foxtrot on xorg is very usable, but faster == better.)
  • You very likely want to apt-get install gconf2, or foxtrot won’t save user prefs (e.g mapset, postiion, etc) when you close it.
  • Rotating the X screen with xrandr doesn’t rotate the touchscreen input properly. To fix this, you need to use xinput to swap the x-axis.
  • I’m using ‘xrandr -o right’ for my landscape orientation. This means that the USB plug on the freerunner is at the top. If you want to use ‘-o left’ you’ll need to play around with the axis swapping.

  • There’s no onscreen keyboard for X apps. To fix this, apt-get install matchbox-keyboard matchbox-keyboard-im, and launch matchbox-keyboard –daemon before you start foxtrot. This will give you a keyboard which pops up when you select a textbox. After foxtrot closes, I kill matchbox-keyboard.
  • QX has a ‘display always on’ option, but X has its own screensaver and blanking/dpms stuff. you’ll want to use xset to turn these off if you want your display always on.
  • You need to start gpsd before you start foxtrot. I also kill gpsd when foxtrot closes. This means it can take a while to get a fix, but I haven’t done a huge amount of outdoor testing yet – all I’ve done is confirmed that it will get a fix.
  • Pressing the AUX button to multitask while X is rotated under QT is ugly – qtmoko will work, but its display will be broken – it looks kinda like QVGA mode and is incorrectly rotated. If you can manage to hit AUX a couple of times to get back to QX, and then press ‘resume’ or ‘stop’ in QX, qtmoko will revert to an un-broken state. Ideally I’d like to disable qtmoko’s AUX-button handler while foxtrot is running, or capture focus events to unrotate on lostfocus and rotate on gotfocus, but I haven’t yet found a way to do either of these.
  • The above ugliness will also happen if X dies while rotated, so you need to xrandr -o normal after foxtrot exits. This means you want to exit foxtrot gracefully. Since foxtrot doesn’t have an ‘exit’ menu item, this means you want to ‘use matchbox’ in the QX settings. You also want fullscreen.

I ended up doing the following to make a wrapper script for foxtrot. It’s a bit of a nasty hack, but it works for me. A slightly nicer way would be to use update-alternatives to use an alternate foxtrotgps launcher script, or saving the script as ‘foxtrot_launcher’, building a desktop entry for it, and setting up a QX favourite for it.

the script below could very easily be modified/generalised to run things other than foxtrotgps!

root@neo:~$ mv /usr/bin/foxtrotgps /usr/bin/foxtrotgps.bin
root@neo:~$ vi /usr/bin/foxtrotgps
              (insert content, below)
root@neo:~$ chmod a+x /usr/bin/foxtrotgps
 

/usr/bin/foxtrotgps:


#!/bin/bash
#Custom script for starting gpsd and foxtrotGPS in landscape mode:
#xinput stuff liberated from: http://lists.openmoko.org/nabble.html#nabble-td7561815

#ensure GPS is powered up:
om gps power 1
om gps om gps keep-on-in-suspend 1

#gpsd
#service gpsd start
gpsd /dev/ttySAC1

#sleep 1 
# we might have to wait some time before sending commands (I didnt)

#rotate:
xrandr -o right

#disable screen blanking:
xset s off -dpms 

#swap x axis:
xinput set-int-prop "Touchscreen" "Evdev Axis Inversion" 8 1 0
#no axis inversion
xinput set-int-prop "Touchscreen" "Evdev Axes Swap" 8 0
xinput set-int-prop "Touchscreen" "Evdev Axis Calibration" 32 98 911 918 107

#run the matchbox keyboard in daemon mode:
#with matchbox-keyboard-im this pops up automatically
matchbox-keyboard --daemon &

#run the real foxtrot:
foxtrotgps.bin --fullscreen

#foxtrot has closed, cleanup:

#kill keyboard:
killall matchbox-keyboard

#unrotate:
xrandr -o normal

#stop gpsd:
#service gpsd stop
killall gpsd

Leave a Reply