Monday, August 7, 2017

Maps on the go

Just when going on vacation I finally decided to replace my aging old E-Machines netbook from 2010 that has been a faithful companion when wanting to travel light but still having a more "full-size" OS. This type of machines have kind of been out of fashion since tables (specifically the iPad) gained popularity. But nowadays there are also some interesting 2-in-1 devices being both a light laptop and tablet if you like. Also it seemed intriguing to finally play with a touch-oriented device in the GNOME / FreeDesktop / GNU/Linux environment.

So, finally I decided to try out this little thing:

So, this device is a Lamina T-1016B.NORD, it's a fairly cheap Cherrytrail-based Intel Atom device. The ironic thing is the image on the box features Windows Maps :-). Also the advertisement read something like “Discover the power of Windows Maps”. But of course I wanted to upgrade the OS. I went with the 4 GB version of Debian's latest stable release, because I didn't want to get stuck trying to get a mininal net installation ISO of latest testing going (with trying to figure out which additional firmware would be needed for WiFi, and I was pretty sure something like that would be nessesary). Installation was pretty pain-less except for one thing: Everything on the screen was rotated 90 degrees counter-clockwise (more on this later). After having read reviews of people installing Linux on similar devices and claiming external USB keyboards and powered USB hubs are essential, this was refreshingly simple, after all.

After installing the firmware for WiFi and sound, WiFi works and sound (but the headphone jack is not recognized correctly). But the most annoying issue for now is the lack of power management support. The battery is not recognized and the screen is stuck on full brighness. Despite this I can still get something like 5 hours of light usage, which is probably still quite OK given the circumstances. Also suspend is not supported (supposedly Cherrytrail doesn't have traditional suspend, but something called “connected standby”, so this limits the usefulness as an “instance on” device. But on the plus side, the flash drive is actually quite quick to boot from. After that, having support for the built-in GPS device would be really nice. Not really sure what kind of device that is, it doesn't seem to show up in either lsusb nor lspci.

For the rotated weirdness it turns out the display is actually natively portrait-oriented, which is evident when the Linux console shows (however the boot logo is rendering suited for landscape mode). The rotation sensor however is mounted in way that indicates “normal” when the device is in landcape mode. Thus out-of-the-box, the desktop is tilted sideways. And rotating the device activates the sensor, but of course still gives an indication that is “off” compared to what the display “expects”.

So, it was time to bring out a trusty old linear algebra book and brush off some matrix skills. Scribbling down the some transformations from what the sensor reports and what would correspond to what the display would expect for it to be right (thanks Bastien Nocera for giving me pointers) I could then translate this into a transformation matrix:

And eventually cooking up a patch for the udev hwdb (within systemd).

Related to the title of this post, though, this is problably what you wanted to see, though

Testing out how Maps works :-)
One slighly annoying thing that showed up is the fact that launching Maps without the keyboard attached will always bring up the on-screen keyboard. The reason for this is that we always explicitly focus the search entry widget to achive being able to just start typing to enter things to search for (which is handy with a keyboard). We should probably re-write this to be more like how some other GNOME apps are wired, where the keypresses are handled by the main window and the search machinery is activated when appropriate. There's some other known issues, such as the lack of pinch-to-zoom support and long-press to get the context menu. I started tagging these bugs with a “touch” keyword. So, hopefully I will get some time to tackle these in the not-to-far distant future. Some like the search issue could probably go in before 3.26 even though we're technically in UI freeze now. Yes, I just released 3.25.90 by the way. While other things like pinch-to-zoom would require support in libchamplain (possibly), and might depend on what we want to do going forward with how we render the map data.

All-in-all it's been a fun little device to play with so far :-)