Thursday, 5 January 2012

Mobile map pages waiting to be tested

Although my mapping pages have been usable on mobile phones for a while, they've not been very mobile-friendly. I have now written more mobile-friendly versions:
* simple map display pages can be reached from: http://maps.peterrobins.co.uk/m.html
* using geolocation (GPS) to display your current position on a map: http://maps.peterrobins.co.uk/geolocate.html
* the same but with pilgrim routes in the vicinity displayed as well: http://maps.peterrobins.co.uk/geolocate.html?routes=y

Advantage of using a phone for this sort of map display is you can do a lot of other things with a phone which you can't with a dedicated GPS device. Disadvantage is you need access to both internet (which may be a problem in remote areas) and GPS satellite signal; having these on for any length of time soon chews up battery power. So an alternative is to get the maps while you have internet access and use screen capture to save a snapshot of the map, which you can then use in the field leaving internet access off.

Feedback welcome in comments below. Please state which device and browser you are using.

Saturday, 5 December 2009

Using skypephone modem in Linux

I've been having a frustrating few days trying to get the 3G modem in my mobile phone to work with my Linux boxes. For anyone with similar issues, I'm documenting here what I did.

The phone I have is made by the Chinese company Amoi, marketed in the UK by 3 as a skypephone, currently version 2 of this. Basically, this was the cheapest 3G phone/modem I could find. 3 include 150MB of internet access in their topup charge, either used via the internet programs on the phone itself (there are various apps including a browser which uses Google Wireless Transcoder to try and render full-size webpages for the mobile form factor), or by using the phone as a modem. The modem can be used via either bluetooth or a usb cable provided with the phone. My Asus netbook does not have a bluetooth connection ootb, so I wanted to use usb.

Like most of these setups, the usb interface is heavily oriented to Windows users, to such an extent that it presents a cdrom drive which automatically installs Windows drivers when you initially plug the cable in. When you do so, the cdrom drive disappears and you can access the modem. As usual with Linux, there's no need for any drivers as these are already provided either in the kernel or as separate modules. So the main question is how to ignore the cdrom and access the modem. The best documentation I've found of this process, which varies depending on the device, is on the website for usb_modeswitch, a program which attempts to do this.

  1. The first thing to do is to switch on the phone and plug in the usb cable (a pitfall I fell into was that when you plug in the cable the phone immediately starts charging, which can give the impression that the phone is on even if it isn't - so make sure the phone's operating system is running).


  2. Then run lsusb on Linux. This should show the Amoi device, with an id of either 1614:1000 or 1614:0407. If the latter, you're in luck: that is the modem - proceed to the next step. If not, try unplugging the usb cable and plugging it back in again. With luck, it should now show 1614:0407. 'dmesg | tail' will show "Product: USB MMC Storage" for 1614:1000, or "Product: S2" for 1614:0407. I've found that you get different results depending on distro: according to the last post on this thread, both Ubuntu and Fedora find 0407 straightaway, my Debian testing/squeeze partition may need unplugging/replugging one or more times, and my Slackware partition doesn't seem able to find the modem at all, no matter how many times I replug the cable. Presumably, this is due to the way the kernel is configured, so if anyone can tell me what I have to configure on my Slackware kernel to enable this I'd be grateful. Fortunately, once the modem is set up it stays that way until you reinitialise the phone by switching it off or unplugging the cable, so once I have it set up in Debian I can then reboot in Slackware and it will then show as 1614:0407.


  3. Once you have 1614:0407, you can then load the driver. There are 2 possibilities: the old standard usbserial module and the newer option module, which it seems is now recommended for these kind of phone modems (tho IMHO it would be better if they renamed it).

    usbserial can be loaded with "modprobe usbserial vendor=0x1614 product=0x0407". option does not have the vendor/product (er) options, but thanks to a tip from usb_modeswitch, you can set them directly on sys bus:
    modprobe option
    echo "1614 0407" >/sys/bus/usb-serial/drivers/option1/new_id

    In both cases, udev then creates /dev/ttyUSB0 which pppd can use.


  4. For completeness, here is my pppd control file, which I put in /etc/ppp/peers/3:

    /dev/ttyUSB0
    115200
    crtscts
    idle 7200
    noipdefault
    defaultroute
    persist
    modem
    noauth
    nobsdcomp
    user three
    password three
    connect-delay 20000
    connect "/usr/sbin/chat -V -f /etc/ppp/chat3"

    I don't believe the modem speed has any effect for these devices, and I don't think user and password are used either.

    Here is /etc/ppp/chat3, the chatscript I use:
    ABORT        BUSY
    ABORT "NO CARRIER"
    ABORT ERROR
    REPORT CONNECT
    TIMEOUT 10
    "" ATZ
    OK 'ATE0V1Q0S0=0&C1&D2+FCLASS=0'
    OK 'AT+CGDCONT=1,"IP","three.co.uk"'
    SAY "Calling..."
    TIMEOUT 60
    OK 'ATDT*99#'
    CONNECT \c

    The important thing here is "three.co.uk", the APN, which is the important part of user validation; it will not work without this.


  5. The alert will notice that I do not have 'usepeerdns'. This is because, rather bizarrely, 3's nameservers do not appear to work. When I used 'usepeerdns' I got a connection and could do, for example, 'ping 74.125.47.103' (one of Google's servers, if you don't know) but no dns resolution was working. So I set up /etc/resolv.conf with OpenDNS's servers instead:
    nameserver 208.67.222.222
    nameserver 208.67.220.220


  6. You then start ppp with 'pppd call 3' and wait for the connection to be set up. You can monitor this from the logfile, /var/log/messages in the case of Slackware: when 'tail /var/log/messages' shows the local and remote IP addresses, the connection should be ready. On my setup, this takes about 30 seconds.


  7. When you have finished, you can kill pppd with "kill `cat /var/run/ppp0.pid`". And, as pppd also logs how much data transfer there was, you can do something like "cat /var/log/messages | grep 'bytes, received'" to find out how much of the 150MB you used during that connection.

Thursday, 12 November 2009

KDE4 multimedia in Slackware

Multimedia has always been a bit of a pain in Linux distros. It's riddled with patents and other restrictions, which free-software purists dislike. So even simple things like playing mp3 files often produce a lot of hassle. KDE3 had its own sound server, called arts, which in recent years has been unmaintained and generally unsatisfactory. KDE4 replaced this with a new multimedia framework called Phonon. This can work with different backends, of which the usual ones are gstreamer and xine.

In both Debian and Slackware, gstreamer is the default. When using xine in kde3, I used the Windows codecs from mplayer, but gstreamer uses its own plugins, of which there are several packages: gst-plugins-base includes quality open-source codecs like ogg and theora, gst-plugins-good adds others, including containers like flv and avi. The mpg codecs are in gst-plugins-ugly, i.e. those which are good-quality but have license/patent issues. Debian includes all these plugins somewhere in its repos, but Slack only has base and good, so you cannot use mp3 files with gstreamer in the standard Slack distro. Fortunately, ugly is available on slacky.eu which also includes the various libraries needed which are also not in standard Slack. Install all those and you can then listen to mp3 files in KDE programs like Juk.

Mind you, Slack does include mpg321 which enables you to play mp3 files on the command line, so you could set up a file association in kde to use mpg321 to play mp3 files.

Another of those areas where Linux distros create a lot of hassle for something that should be simple.

Back to Slack

In a previous post, I said that I was using Debian on my EEE. I have though become increasingly frustrated at the length of time it takes Debian to move programs from sid to testing. When I first installed Debian, I used the default option, which is stable (i.e. Lenny at the moment) with Gnome desktop. That was, however, not really what I wanted, so I went off and RTFM, and found that you can change this by using expert mode. So, I kept Lenny on his own partition, and installed KDE on another partition. I first tried with sid, but couldn't get X to load - gave me strange error msgs which I didn't have time to try and fathom - so I installed testing instead. In theory, programs are quickly moved from sid to testing unless there are major issues, but the new versions of KDE seem to have got stuck in sid. In the meantime, KDE have released 4.3.3, but Debian have still not moved 4.3.2 to testing, let alone 4.3.3. As Slackware made 4.3.3 available in current just a couple of days after the KDE folk released it, I decided to go back to using Slackware. In fact, I kept testing, and installed Slack on top of the Lenny partition, as I wasn't really using this for anything.

In principle, the big advantage of Debian is the vast package repos, which Slack doesn't have. However, there is now an excellent collection of additional Slackware packages at http://repository.slacky.eu/ I've so far found only 2 packages I use that are in Debian and not available for Slack: mapserver, and Google Gadgets for Linux, which can be used as KDE plasmoids. I could compile for Slack, but, if necessary, can also boot my testing partition and use that. There are a couple of curious little bugs in Slack I've not got to the bottom of yet: those icons that are in Hicolor but not in Oxygen are not displayed; and Ark seems unable to open tar.gz files (I think this is because a compile option was missing).

Thursday, 5 November 2009

Zoho remote api

In a previous blog on strategies for replacing the desktop, I wrote: "In theory, there is another alternative - data local, software on the web - but I never heard of anyone implementing that!"

Turns out that zoho.com's Remote API does precisely that. This enables you to keep all your data on your own server but use Zoho's editing program to change them. Piotr Malinski has example code to do that with Curl in Django or PHP

Monday, 2 November 2009

KDE and HTML5

I've just been looking at Mark Pilgrim's interesting pages on HTML5, especially his browser tests for various new features. Here's the results for the various browsers that I use on my KDE setup.

Edit: 14.11: I have now updated this to show Slackware Firefox as well as Debian's Iceweasel which appears to be far less capable. I've also included Arora (not surprisingly as they both use QtWebKit, this is the same as KDE plasmoid).











Konqueror (KHTML)Plasmoid/Arora (QtWebKit)Firefox (Gecko)Iceweasel (Gecko)Chrome (WebKit)
Canvasyyyyy
Canvas textnyyny
Videonny (Ogg Theora)ny (Ogg Theora and H.264)
Storagenyyny
Web workersnnyny
Offline appsnyyyy
Geolocationnnynn
Input typessearch, rangesearch, tel, url, email, number, range, color
Placeholder textnynny
Form autofocusnynny

Clearly, Konqueror is worst. After only testing Iceweasel I thought Gecko wasn't much better, but Firefox is far superior at these tests, so it looks like this is browser dependent, not browser engine. Firefox even manages geolocation, though I tested this via my ADSL link which is pretty useless as it gives the ISP's location not mine. The WebKit browsers also score well at these tests.

Centralising bookmarks

It's always the way that no sooner do you post something than you discover additional information. Since writing my previous post, I've discovered two attempts to provide exactly the kind of centralised bookmarks and password managers I've been looking for.

The first is Xmarks which provides exactly this kind of service, albeit only for Firefox (though Chrome is promised). This can sync both bookmarks and passwords. Although it's run by a private company and by default stores the data on their server, you're not tied to it - you can use your own WebDAV or ftp server to store the data, and you can export the stored bookmarks at any time. An additional nice feature is the ability to create 'sync profiles' , which enable you to limit certain bookmark folders to a particular computer.

Meanwhile, Google recently introduced their sync facility, though frustratingly this does not seem to be available on the Linux version as yet. This stores the bookmarks in with the Google account, though it seems they plan to open-source all this, so presumably could be done elsewhere too. It will also use the standard XMPP for syncing.

Now all that's needed is to persuade KDE to use this instead of the built-in bookmarks.