Free navigation software

There is quite a lot of free navigation software based on OpenStreetMap, but it’s somewhat difficult to find something that actually works for the given purpose. I feel like I need to document for myself what to use. And why not share the documentation? Hence this blog post.

It’s easy on Android – there’s OsmAnd there. OsmAnd is somewhat difficult to use but otherwise it’s nice, working well and providing a lot of useful features.

It’s less easy on desktop. After some searching I got amazed by BRouter, which is a navigation backend capable of offline OpenStreetMap based navigation. That’s a killer feature itself, but BRouter also provides another outstanding feature. You can create complex BRouter profiles describing your navigational preferences, which is especially useful for bike navigation. BRouter can’t be used without reading its documentation first and it takes some effort to make it running. But it’s not too difficult and once BRouter is up, it’s amazing.

BRouter can be used on both desktop and Android, but it’s just a backend server. You need some frontend to actually use it. You can use OsmAnd on Android. There is a very plain BRouter application to set up the server and then BRouter can be chosen as the navigation backend in OsmAnd preferences. As for desktop, you can use Web client for BRouter. It can be used locally or as an online Web application, with your selected set of profiles. There is also an online demo for testing BRouter with its included profiles (there are more profiles available from third parties, see documentation).

For simpler planning, especially for making simple sequences of track points used e.g. by some Garmin devices, FoxtrotGPS is well usable. Unfortunately FoxtrotGPS seems incapable of displaying complex GPX tracks. But then there is GPX Viewer, which is nice for viewing GPX tracks.

Using Polar M460 on GNU/Linux

In short: Use Garmin if you can afford it.

The problem with Polar devices is that they are not only proprietary themselves but you can’t operate them without using additional proprietary software. If you don’t like the default Polar M460 sport profiles and screens (and no, you won’t like them), you must find someone with Windows (or Apple) computer. You must install Polar software on the computer and use it twice: First to register the device at Polar and upgrade its firmware and then, after you prepare your setup in the Polar Web application, to change the device settings.

Good news is that then you won’t need Windows anymore, unless you want to change device profiles and screens or to upgrade firmware again. But you’ll still want to retrieve data from your device regularly. You can do that using the Windows application, using a proprietary Polar Android application or (fortunately!) you can do that even on GNU/Linux.

Thanks to the authors of bipolar and v800_downloader it’s possible to download and convert data from some Polar devices. It’s also the only way to get the data without sharing it with Polar. To download and convert data from Polar M460 you need a slightly modified version of v800_downloader (v800_downloader is unfortunately abandoned, so the changes can’t be integrated into the original version). It works for me and I can get complete recorded data: time, GPS position, GPS altitude, barometric altitude, temperature, distance, speed, cadence, heart rate, heart rate variability, and some summary data. There are sometimes problems such as that stored sessions can’t be listed or the downloaded data is incomplete. Reconnecting and/or restarting v800_downloader helps in such cases.

To use online and other features such as syncing data to Polar Web, mobile notifications, Strava segments, or route upload, you still need Polar Android or Windows proprietary applications (so no luck if you have a free software OS without Google Play on your mobile phone). All you can do with Polar M460 without using additional proprietary software is to use its built-in display functions and to download logged data. But that’s already quite a lot, especially for those who don’t race, don’t want to upload their private data anywhere and don’t need proprietary fitness analysis functions.

Why do I think that using Garmin devices instead of Polar or other vendors’ devices might be a better idea? As far as I know Garmin devices still expose logged data via USB mass storage protocol and it’s possible to set up most of their functionality without using external software. So there is no trouble with their basic usage, Garmin allows at least using the basic device functions. You also get navigation functions and ANT+ support with most devices.

Is there still any reason to use Polar M460 then? Well, Polar M460 is a nice device equipped with all the common sensors, either internal or external. Up until recently, only very expensive Garmin devices supported Bluetooth (which matters if you want to use devices such as Polar OH1). You can buy Polar M460 for a good price today, Garmin is much more expensive and since Garmin devices are still proprietary (although with less need to use additional proprietary software) you waste your money on a proprietary device. But the price difference may be erased with the new Garmin Edge 130, which looks interesting (I don’t know whether it works with GNU/Linux though).

BTW, very similar problems are with Polar OH1. You need a Windows computer to initialize the device and to upgrade its firmware. If you are interested in using it as an independent device, there is still some chance to download logged heart rate from it.

Capturing Web content from Firefox to Org

Emacs is a powerful tool but it’s better to use other means for Web browsing, such as Firefox. Now the question is how to transfer pieces of Web content from Firefox to Org mode. Org mode already provides means for communication with external applications. org-protocol.el is a general mechanism for importing information to Org mode via emacsclient, but its setup is not instant and I hadn’t bothered to configure it until I met org-protocol-capture-html. The screenshot of the captured content converted to Org markup was irresistible so I decided to give capturing Web content another try.

That attempt reminded me that I hadn’t ranted about software setup and bugs for quite long time here. I’m not going to fix that now, it suffices to say that utilizing a relatively simple function shouldn’t require advanced technical knowledge and/or several hours of googling and experimenting; I really can’t imagine how a non-advanced user could get that thing run without losing his patience at early stages of the process. Well, so I’ll try to make a summary of how I got it working.

Emacs part

I assume you already can use Org mode and emacsclient.

Plain text capture

Add org-protocol to org-modules variable.

Define entry for capturing Web content in org-capture-templates variable, e.g.:

(add-to-list 'org-capture-templates
             ("w" "Web site" entry (file "~/org/notes.org")
              "* %?\n%c\n%:initial"))

Of course, this is just an example. Look at org-protocol.el documentation for another example and for explanation what %:initial means.

If you’d like to use a letter different from w for the template, you can do so but you must replace it in Firefox bookmarklets and helpers below. See also org-protocol-default-template-key variable.

Capture with HTML conversion

First, configure plain text capture as described above. Then fetch org-protocol-capture-html.el from its home page and put it into your site-lisp directory. Add the following lines to your ~/.emacs or other Emacs initialization file:

(require 'org-protocol)
(require 'org-protocol-capture-html)

Note that org-protocol must be already loaded at the time org-protocol-capture-html is loaded, otherwise the corresponding subprotocol won’t be registered.

Firefox part

The easy way

Install Org-capture for Firefox. It allows capturing content without the need to register org-protocol: handler in Firefox. However, org-protocol-capture-html or other custom captures won’t work this way.

The advanced way

The following installs universal capturing mechanism via org-protocol: handler in Firefox. It works independently (with or without it) of Org-capture Firefox extension mentioned above.

Register org-protocol: handler as described in MozillaZine Knowledge Base (replace foo with org-protocol). One important thing they forgot to emphasize is that you must use real link to invoke the application dialog, typing org-protocol:something into the address bar doesn’t work. For your convenience, I provide an org-protocol link here. Select something like /usr/bin/emacsclient in the Firefox dialog as the application handling org-protocol.

Then define your capturing bookmarklets. If you don’t have Bookmarks Toolbar enabled, enable it by right clicking on a Firefox toolbar and selecting Bookmarks Toolbar. Then create new bookmark in Bookmarks Toolbar section and insert the following code as its URL:

javascript:location.href='org-protocol:/capture:/w/'+encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())

This is for plain text capture. If you want HTML capture, define another toolbar bookmark and use the code from org-protocol-capture-html home page (it’s also available in the introductory comments in org-protocol-capture-html.el) as its URL. Just make sure that:

  • The bookmark URL starts with javascript:.
  • Pandoc is installed.

Now you can (optionally) select part of an HTML page and press one of the newly created bookmark buttons in Bookmarks Toolbar. If everything is set up correctly, the selected part of the page (or just page URL and title if nothing is selected) should appear in your Emacs capture buffer.

Getting rid of Bookmarks Toolbar

If you don’t use Bookmarks Toolbar in Firefox, you probably don’t want to waste screen space on it just for Org capture bookmarks. The remedy is easy, invoke Firefox Customize and drag Bookmarks Toolbar to another place. Alternatively, you can use Custom Buttons Firefox extension.

Notes

Some Web pages can’t be captured, I don’t know why. I have more important things to do than playing with Org and Firefox further.

Another useful Org related Firefox extension is Copy as Org-mode. It doesn’t capture content via org-protocol but can copy some objects such as page or link URLs to kill ring, in the Org format. This is what I used to insert links into this article! It’s easier with this nice helper than performing all the copy&paste&edit by hand.

Privacy Badger

Privacy Badger 1.0 has been released some time ago. If I could install a single Firefox extension only, it would be this one. It’s very easy to use, effective (AFAICT) and doesn’t cause problems; much better than the other privacy extensions I used (although they can still be useful for special purposes). I can recommended using it, as well as reading the FAQ and supporting the Electronic Frontier Foundation (EFF). BTW, another very useful web browser extension by EFF is HTTPS Everywhere. Good work, EFF! Looking forward an Android version as there is currently very little one can do to protect his privacy in Firefox for Android.

How Internet Explorer supported free software

Internet Explorer, the nightmare of all web developers and many Internet users, the vendor lock-in application of the worst kind, has significantly contributed to the advancement of free software. How is it possible that such a product could help us?

When Internet Explorer appeared all the (at the time) modern and popular web browsers were proprietary products widely used by most people, including free software users. The leading web browser, Netscape, was another such product, distributed for free. That free beer was so popular that there was little demand for a free alternative and the presence and monopoly of Netscape effectively blocked development of a modern free web browser. That was a big problem: The Web, an emerging universal platform for information interchange, was here without any good free software to access it. It was ruled by a proprietary browser of unclear qualities, e.g. Netscape was suspected of leaking private information (BTW, the suspicion was probably false 20 years ago while the private information is routinely leaked these days through web sites and services; see IceCat for partial fixes). And then Internet Explorer started to grow and initiated the war of browsers.

It had taken some time before Netscape realized that their browser couldn’t compete against the universal desktop computer monopolist. At one time the numbers became more than clear and Netscape completely lost its market. It happens sometimes that companies finally, although quite late, recognize their mistakes and manage to help saving their works before they bankrupt (see Sun’s Java for another example). So did Netscape and the Mozilla project was founded. The project was successful, led to the development of Firefox and so we have a modern free and working web browser today. If Internet Explorer didn’t destroy Netscape market, the development of a competitive free web browser could be delayed by many more years.

So we can celebrate the end of Internet Explorer development twice: First for getting rid of the horror and second for helping us to get a good free web browser. It’s a good illustration how bad things can, contrary to their intentions, do something good. Turning bad things into making good is a very important general principle. This should be part of our strategy when making things better.

Debian GNU/Linux on Android

Android tablets are useful portable devices. Unfortunately Android makes them less useful than they could be. There are several problems with Android, one of them being lack of applications. While there are free Android applications for many common tasks, they are typically not suitable for serious work and many applications are completely missing, most notably (real) Emacs.

But it’s possible to partially overcome the problem by installing GNU/Linux in a chroot environment on Android, making an Android tablet a poor man’s substitute for a laptop on occasional traveling. Here’s what I’ve found about running Debian GNU/Linux on Android after some experiments and testing a couple of alternatives:

  • Get a Bluetooth or other hardware keyboard. The software keyboards take screen space, are not suitable for touch typing and are especially uncomfortable to use with X.
  • Install XSDL X server, available also on Google Play. The other Android X Server, available on F-Droid, doesn’t work very well, nor the free VNC servers I tried.
  • Install GNURoot, together with one of its root images, available from Google Play. GNURoot environment works very well for many tasks, as long as you don’t need real root access.
  • Start the X server, start GNURoot, install your favorite Debian packages, set DISPLAY to localhost:0, run your favorite window manager and the applications you need. The X environment is slow but useable.
  • If you need real root access, you can use Lil’ Debi, available on F-Droid. But there are some limitations: Your Android must be rooted (obviously), the file system size is limited to about 2 GB and I couldn’t connect to the X server under user other than root.

Installing an alternative ROM on Google Nexus 10

Enough is enough. I don’t like how the stock Android installation treats its users and I finally decided to replace it on my Google Nexus 10 with something else. The reasonable choices were CyanogenMod, AOKP and OmniROM. I decided to install AOKP.

Installation instructions looked like installing an alternative ROM on Nexus is a completely easy (and safe) process. It wasn’t that easy though, there is some missing and misleading information in those installation instructions. Due to it, I got a bit scared about three times during the process and had to search the Web for solutions. Thanks to all those kind people who post instructions, answers and solutions I was able to complete the installation successfully. So here is another short guide summarizing how to install an alternative ROM on current (4.4) stock Nexus 10, based on my own experience:

  • Accept that by following these or other similar instructions you can brick your device, lose warranty, etc.
  • Backup everything on your tablet you want to retain. All data may get deleted during the installation.
  • Install Android SDK on your PC. You need it to get working adb and fastboot.
  • On your PC, download TWRP recovery image for your device. You can use ClockworkMod as well, I chose TWRP so that I could contingently install OmniROM without replacing the recovery again.
  • Download the desired ROM and Google applications (if you want them) and put them to /sdcard/ directory on your tablet.
  • Enable developer’s setting on the tablet: Go to settings, device information and tap several times on the build number, until you see the message about being a developer.
  • Go back in settings, enter the developer’s settings and enable USB debugging.
  • Connect the tablet to your PC via a USB cable. The tablet should indicate that you’re in USB developer’s mode.
  • Check that sudo adb devices (use adb binary from Android SDK) shows your tablet on your PC. Note it’s important to run adb as root for the first time. It starts a server process on the first invocation and if that starts under an ordinary user, adb functions may not work even under root later.
  • If there is something strange in adb devices output, such as no entry at all, question marks or a message about permissions, then there is something wrong with your setup.
  • Run adb reboot bootloader. The tablet reboots and enters bootloader menu.
  • Run sudo fastboot oem unlock (use fastboot binary from Android SDK). The tablet should reboot, with unlocked lock displayed under “Google”.
  • Perhaps the tablet gets stuck on the boot. It looks scary, but it can (hopefully) be fixed following the next instructions. If the tablet boots normally, skip a few next instructions and continue with “re-enable USB debugging”.
  • Long press Power + Volume Up + Volume Down to restart the tablet and to enter the boot menu.
  • Select “recovery mode” using the volume buttons and press Power. An Android robot with a triangle appears after a short while.
  • Shortly tap Power + Volume Up (the volume key on the right). A menu appears.
  • Select “wipe data” and wait until it finishes.
  • Select “reboot” and the tablet should reboot fine now. Your data is lost (no problem as that will happen during the installation anyway) and the tablet must be set up as when it was started for the first time after you had bought it.
  • Re-enable USB debugging in developer’s settings.
  • Run adb reboot bootloader to enter the bootloader.
  • Run sudo fastboot flash recovery RECOVERY-IMAGE.zip (if you decided to use TWRP then RECOVERY-IMAGE should be something like openrecovery-twrp-*-manta.img).
  • Select “power off” on the tablet.
  • Long press Power + Volume Up + Volume Down to power the tablet on and to enter the boot menu. Don’t start the tablet normally otherwise the installed recovery may get replaced with the original one during the boot.
  • Select “recovery mode” and you should be in TWRP now.
  • Perform “Backup” in TWRP to backup the original system.
  • Perform “Wipe” in TWRP.
  • If your installation .zip files are not in /sdcard, you can upload them now using adb push YOUR-DOWNLOADED-ROM-FILE.zip /sdcard/ from PC.
  • Perform “Install” in TWRP for your ROM (and Google applications, if you want them) zip files.
  • Perform “Reboot” in TWRP.
  • Hopefully the new system starts now and you are freed from the Google restrictions.

Many thanks to all those who develop alternative Android installations with improved user freedom!