Monday, December 31, 2012

Getting started with SDL on BB10 and the Playbook

BlackBerry provides SDL for the available for BlackBerry 10 and the PlayBook, with a nice touch screen helper library to make it easier to create touch screen controls with minimal or even no modification to original apps.

The instructions on how to use SDL after building everything is quite lacking on the web site so, I'll document my findings here for anyone else that is interested and also as a reminder for myself.

Anyway, start with cloning TouchControlOverlay and SDL from the RIM github repo. I won't go into the details here. And remember to source the bbndk evironment first.

Ok, now you should have the sources. Start with building and installing  TouchControlOverlay

cd TouchControlOverlay
make
make install

Next, building SDL. I prefer to use an out-of-source build directory, makes it easier to build for both BB10 and PlayBook from the same source.

$ mkdir sdlbb10
$ cd sdlbb10
$ ../SDL/configure  --prefix=/home/milang/bbndk/target_10_0_9_1673/qnx6/armle-v7 \
--host=arm-unknown-nto-qnx8.0.0eabi \
--without-x --enable-pthreads \
--enable-audio --enable-video-playbook \
LDFLAGS="-lscreen -lasound -lpps -lm -lpng14 -lbps -lxml2 -lEGL -lGLESv2" \
CPPFLAGS="-D__PLAYBOOK__ -D__QNXNTO__"
$ make

Install SDL
$ make install

Ok, now SDL is installed nicely. Next edit the bbndk-env.sh script and add

PKG_CONFIG_PATH=${QNX_TARGET}/armle-v7/lib/pkgconfig
export PKG_CONFIG_PATH

in the end of the file. Re-source it or set the PKG_CONFIG_PATH manually. What this does is enable pkg-config enabled sources to find SDL (and other software that uses pkg-config to get options). For example the SDL libraries that we will add next, SDL_net and SDL_image. But that will come in another post.

Friday, December 07, 2012

A look inside the BDP-150 Frimware, netflix_qt you say?

In my previous post, I showed the basic contents of the Pioneer BDP-150 firmware image.

Looking at the binwalk output listing we can easily find the boot loader, Linux kernel and a squashfs image.

461744     0x70BB0    uImage header, header size: 64 bytes, header CRC: 0x775F4C1C, created: Wed Oct 24 10:43:23 2012, image size: 1573204 bytes, Data Address: 0xDA00000, Entry Point: 0xDA00000, data CRC: 0x782925E7, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: 
479272     0x75028    gzip compressed data, from Unix, last modified: Wed Oct 24 10:38:55 2012, max compression
2574912    0x274A40   Squashfs filesystem, little endian, version 3.1, size: 59779047 bytes, 471 inodes, blocksize: 131072 bytes, created: Wed Oct 24 10:51:11 2012

Extract the filesystem image with dd, like so:

$ dd if=BDP-150_V01.05.bin of=sqfs.img bs=2574912 skip=1
23+1 records in
23+1 records out
60048084 bytes (60 MB) copied, 1.03521 s, 58.0 MB/s

Now you have a Squashfs image. You can mount it or extract the contents using unsquashfs, like so:

$ unsquashfs sqfs.img 
Parallel unsquashfs: Using 4 processors
726 inodes (1492 blocks) to write

[===================================================================================================================================================================================/] 1492/1492 100%
created 330 files
created 63 directories
created 78 symlinks
created 0 devices
created 0 fifos

Now you have the firmware extracted and you can start looking around. There are some interesting looking bits in there. For example the UI is built on DirectFB and there is a Netflix binary (/usr/local/bin/netflix_qt/netflix ) linked against Qt. Pretty silly of Netflix not to support desktop linux users...

Who knows, with some luck this might run on some other ARM based thingy ? Oh, right.. that is the next thing I'll try :)

Wednesday, December 05, 2012

Pioneer BDP-150 Blu-ray player, Linux Inside

I finally gave in and got myself a Blu-ray player. After much googling and comparing I decided on a Pioneer BDP-150 Player. Luckily I was tired and didn't go to the store directly and so got it even cheaper as they had it on sale, 99€ only.

One of the biggest plus in my book was that the device ARMv6 (mediatek) based, running Linux  2.6.27 kernel with a DirectFB and Qt. Firmware to play with here and available sources here.

binwalk:ing the firmware data file gives:

DECIMAL    HEX        DESCRIPTION
-------------------------------------------------------------------------------------------------------
67512      0x107B8    Mediatek bootloader
67897      0x10939    LZMA compressed data, properties: 0x80, dictionary size: 1073741824 bytes, uncompressed size: 196608 bytes
114580     0x1BF94    Mediatek bootloader
300220     0x494BC    JFFS2 filesystem data little endian, JFFS node length: 8195
417804     0x6600C    LZMA compressed data, properties: 0x90, dictionary size: 738197504 bytes, uncompressed size: 754973620 bytes
430796     0x692CC    JFFS2 filesystem (old) data little endian, JFFS node length: 344
441485     0x6BC8D    LZMA compressed data, properties: 0x5D, dictionary size: 1036255232 bytes, uncompressed size: 327678 bytes
447129     0x6D299    LZMA compressed data, properties: 0x02, dictionary size: 8388608 bytes, uncompressed size: 1073741824 bytes
447153     0x6D2B1    LZMA compressed data, properties: 0x02, dictionary size: 8388608 bytes, uncompressed size: 1073741824 bytes
447177     0x6D2C9    LZMA compressed data, properties: 0x02, dictionary size: 8388608 bytes, uncompressed size: 1073741824 bytes
450404     0x6DF64    LZMA compressed data, properties: 0x80, dictionary size: 1660944384 bytes, uncompressed size: 521134 bytes
461744     0x70BB0    uImage header, header size: 64 bytes, header CRC: 0x775F4C1C, created: Wed Oct 24 10:43:23 2012, image size: 1573204 bytes, Data Address: 0xDA00000, Entry Point: 0xDA00000, data CRC: 0x782925E7, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: 
479272     0x75028    gzip compressed data, from Unix, last modified: Wed Oct 24 10:38:55 2012, max compression
2574912    0x274A40   Squashfs filesystem, little endian, version 3.1, size: 59779047 bytes, 471 inodes, blocksize: 131072 bytes, created: Wed Oct 24 10:51:11 2012
33020448   0x1F7DA20  JFFS2 filesystem data big endian, JFFS node length: 503796
35336806   0x21B3266  PNG image, 91 x 88, 8-bit/color RGBA, non-interlaced
35439823   0x21CC4CF  PNG image, 97 x 88, 8-bit/color RGBA, non-interlaced
35516856   0x21DF1B8  PNG image, 168 x 161, 8-bit/color RGBA, non-interlaced
52281361   0x31DC011  gzip compressed data, has CRC, was "\031\202\273\253M\021\334\335\276\207\340\356\1771\014@\356\376\013{\023r\367}t\027\271;\005k\026\271\273\027R\034r\367\351\011\202\273\237`\211\221\273\267`\035#w7B\227\220\273\327\025\027\334}\003", last modified: Thu Sep  6 02:46:23 2029
62487104   0x3B97A40  PNG image, 1920 x 1080, 8-bit/color RGB, non-interlaced

Tuesday, November 27, 2012

Drawing lines in QML

QML is very nice way to build stuff, but it does lack some features that has bugged at least myself quite a lot. There is no Line element for drawing arbitrary lines from point x1,y1 to x2,y2.

Fortunately there is the Rectangle element. And what is a rectangle with a height of 1 ? More or less a line. Rectangles can be set to be at x1,y1 and you can specify the rotation. And that gives us a line from x1,y1 with a rotation. And digging deep in your brain for some basic math gives us a line drawing algorithm.

Just calculate the length from x1,y1 to x2,y2 and that gives us the width of the rectangle. Then calculate the slope and we have the rotation we need.


And here you have a Line element ready to go for your QtQuick project, free to use so enjoy!
(Note: This is a workaround for having no canvas like element in Qt 4.7/8, if you are using Qt 5 then you can use the Canvas)

import QtQuick 1.1

Rectangle {
    id: l
    property alias x1: l.x
    property alias y1: l.y

    property real x2: l.x
    property real y2: l.y

    color: "black"
    height: 2
    smooth: true;

    transformOrigin: Item.TopLeft;

    width: getWidth(x1,y1,x2,y2);
    rotation: getSlope(x1,y1,x2,y2);

    function getWidth(sx1,sy1,sx2,sy2)
    {
        var w=Math.sqrt(Math.pow((sx2-sx1),2)+Math.pow((sy2-sy1),2));
        console.debug("W: "+w);
        return w;
    }

    function getSlope(sx1,sy1,sx2,sy2)
    {
        var a,m,d;
        var b=sx2-sx1;
        if (b===0)
            return 0;
        a=sy2-sy1;
        m=a/b;
        d=Math.atan(m)*180/Math.PI;

        console.debug(a)
        console.debug(b)

        if (a<0 a="" b="" d="" else="" if="" return="">=0 && b>=0)
            return d;
        else if (a<0 b="">=0)
            return d;
        else if (a>=0 && b<0 0="" d="" else="" pre="" return="">

Tuesday, November 20, 2012

Retro pinball, game prototype and qml box2d demo

Something I'm working on, not that special, but kinda fun still. Uses my improved Box2D QML plugin, otherwise it is pure QML only (for now).


Tuesday, November 13, 2012

RIM is definitely doing something right

Just look at these html5test scores, from left to right, Playbook, BB10 Dev Alpha, N9 and a Lumia 800.

Thursday, October 25, 2012

QML Box2D and more features

I'm working on a couple of different games, using the QML Box2D bindings. As I'm targeting the N9, I need to use the Qt 4.x based version that has been pretty much forgotten by the authors, old version of Box2D and many features are missing. So lets scratch that itch then. The Moto Trial Racer sources where consulted for some features and ideas.

So here, my a bit more updated version of the QML Box2D bindings:
  • Box2D upgraded to 2.2.1
  • Joint release/grab
  • WeldJoint added
  • WheelJoint added
  • FrictionJoint added
  • Basic Edge shape support added
  • Missing properties and methods added (gravityScale, getMass(), getInertia(), angularVelocity, etc)
I'm also going to add RopeJoint, PulleJoint and GearJoint  support as time permits (and need arises).

Enjoy !

Wednesday, September 26, 2012

Transfering contacts from N900 to Lumia

I don't know if it has been implemented in some resent update, but at the time of doing this video, sending vCard contacts to the Lumias over bluetooth was not supported. But fortunately the Lumias have an integrated QR Code reader, and I had made a QR Code contact exported plugin for the N900. So here it is, a how to on how to transfer contacts from your N900 to your Nokia Lumia device. I knew it would be useful for something :)

Friday, September 21, 2012

Unfortunate distractions lately

Sorry for not writing for a while. Cases of Alzheimer’s getting worse and possible Trigeminal neuralgia in my family has kept my mind un-focused and development blog writing hasn't been on the top of my mind lately.
Things seem to be getting a bit better at time of writing so hopefully I won't be that distracted in the coming weeks. I hope.

Friday, August 17, 2012

OpenStreetMap tiles on N9 Foursquare app

A cute little hack, use proper OpenStreetMap maps with map tile caching instead of always re-downloading the Nokia Map tiles.

Notice something different ? :)
Details later...

Friday, August 10, 2012

Wednesday, August 08, 2012

Radio X3M app or how to use Qt, Gstreamer and the N9

As a bit of a training in using Qt and Gstreamer together I made a Radio X3M app for the N9, first mainly for personal use but maybe there is one or two Radio X3M listeners with a N9, who knows.



Submitted it to QA today, it is also available as a direct download here. Sources are are in git here. The most interesting part is probably the QML Gstreamer RTSP player element, here. It uses a bunch of elements that are connected to various UI elements for Volume, Equalizer and Surround.

OpenStreetMap Maps with QML Map object

QtQuick/QML comes with a nice ready made Map element that can show map tiles and dots and polygons and stuff. Really nice and all, unfortunately the default and only map available is Nokia maps. And well, I prefer free maps. So, how to get OpenStreetMap working ?

One option is to make your own QML based map element, I started on that but never had enough patience to finish it.

But after some googling around I found qtm-geoservices-extras ! Today I started to look into it a bit more and trying to figure out how to get in working when targeting the N9 as we have the silly problem that anything submitted to the Nokia Store can not depend on any outside packages. Extremely annoying that.

The extra geoservices contain Qt plugins for providing map (and route, search, etc) features from OSM and Google. I didn't care of the goolge plugin at all.

So how to get the plugin working when you make your own app ?

Adding OpenStreetMap Qt map provider to your app


QML Map with OpenStreetMap tiles, running on the simulator


First, checkout qtm-geoservices-extras
git clone git://gitorious.org/qtm-geoservices-extras/qtm-geoservices-extras.git

Then copy the openstreetmap directory into your own project

cp -a qtm-geoservices-extras/openstreetmap your-map-app/

The edit your projects .pro file to include:
include(openstreetmap/openstreetmap.pro)

And in your main.cpp (or whatever), add:

#include <qtplugin>
Q_IMPORT_PLUGIN(qtgeoservices_osm)
Then edit the openstreetmap.pro file in the openstreetmap directory, like this:
  1. Add static to CONFIG
  2. Remove or comment out the include(../common.pri)
  3. Remove or comment out TARGET=
  4. Remove or comment out TEMPLATE=
  5. Add 
    INCLUDEPATH += $$PWD
    DEPENDPATH += $$PWD
End result should look something like this:

#TEMPLATE = lib
CONFIG += plugin
#TARGET = $$qtLibraryTarget(qtgeoservices_osm)
PLUGIN_TYPE=geoservices
# include(../common.pri)
QT += network
CONFIG += mobility static
MOBILITY = location
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD

Then add the map element to your QML code

import QtMobility.location 1.2

    Map {
        id: nmap
        width: 480;
        height: 300;
        anchors.top: osm.bottom;
        zoomLevel: 10
        center: mypos;
        connectivityMode: Map.OfflineMode;
        plugin : Plugin {
                name : "openstreetmap"
                PluginParameter{ name:  "mapping.cache.directory" ; value: "/tmp/qtmap" }
                PluginParameter{ name:  "mapping.cache.size" ; value: "200000" }
            }
    }

    Coordinate {
        id: mypos
        latitude: 60.45;
        longitude: 22.25;
    }

And that should do it. Build your app and try it out!

Friday, July 27, 2012

Almost posted a "Cross compiling userland" article

Yep, I had it just about ready, a nice post on how to build a proper cross-toolchain from armhf for the Raspberry Pi, but no, blogspot just had to autosave a botched copy&paste&undo that cleared the whole post.

Sigh...

Monday, July 23, 2012

RaspberryPi

I finally got my RaspberryPi !



I was on vacation when it arrived and I've been away from home most of the time, but I finally had time to play around with it. Did the the normal geek way of doing things, plugged it in and.. nothing, except red LED. A bit strange that, I was expecting something on the screen.. anyway, you must have a SD card with some boot files for it to work.

Tuesday, June 19, 2012

Skydiving video, recorded with Lumia 900

A slightly edited video of the jump, taken with the Lumia 900.


Sorry for the rotated view. The ad-hoc holder worked quite well.

Devaamo Summit 2012, day 2

Day 2, Thursday

The next was the proper summit day. On the walk to the New Factory I noticed this strange thingy that counts the amount of cyclist that have gone past it.

Tampere bike counter

OpenSource and TI

Qt5 on RaspberryPi (I can order mine tomorrow!)

The Qt5 on RaspeberryPi was a really awesome demonstration on QML and had the most awesome terminal I've ever seen :)

NFC Tag in lunch restaurant, the first I've ever seen live in Finland

OpenStreetMap and free Open Geodata are great opportunities / Pekka Sarkola
Then party, with Free (really) beer. Met some of the people I stalk/follow on twitter, that was nice.
Organizers are sexy :)
Thank you to the organizers, hope to see you next year (or at some other place)

Lyssna på x3m med gstreamer under Linux

A quick hint for sv_FI (or anyone else that knows Swedish) geeks that listen to Radio X3M:

gst-launch rtspsrc \
location=rtsp://stream.yle.mobi/yle/live/x3m.sdp latency=500 ! \
decodebin ! queue min-threshold-buffers=10 ! autoaudiosink


Enjoy :)

Devaamo summit 2012, day 1

It's a rare treat to have a FOSS/Opendata/etc related summit/conference in Finland so I was very happy that one was held in Tampere and that I could attend it. Devaamo Summit 2012.

Day one, Friday

I arrived on Friday, met a friend from the local hackerspace and followed the lightning talks. The most interesting of the was qmlweb, QML ported to the browser.
"ITS Factory – Open traffic interfaces for intelligent apps"

A hacked AK-47 (Wii) and a Duck Hunt remake, done by the 5w Tampere Hackerspace
Tieto, one of the sponsors, had a Tizen developers device on show. I played with it a bit. The device itself was very light, probalby explained by the lack of a GSM modem.

The UI/UX bit was fast and fluid, but lacked any kind of oooh-shiny-cool effect. But here's hoping...

Tizen developer device

Yep, it really is a Tizen device

I was a bit tired after the train and lightning talks so I walked to my hotel and relaxed for a while.

Then walked back to the New Factory area and did a "Dinner and a movie" by myself :) Watched Snow White & The Huntsman, it was ok but there was just that something missing from it.

Then to sleep!

Thursday, June 14, 2012

OpenStreetMap, Google, Nokia and Bing maps

Vepsä, a tiny island in the Turku archipelago on different map services. There is an enormous difference on the amount of detail available. And on two services the island itself is missing, looks kinda silly checking in on Foursquare on Nokia devices.

Update (02.10.2012): Added screenshot from iOS 6 maps. It has at least the island in place, but not much more.

Vepsä on OpenStreetMap. Roads and trails.

Vepsä on Google. No details. But plenty of tiny islands.

But these two suck, and suck really bad. The complete island is missing.

Vepsä on Nokia maps, nowhere to be seen

Vepsä on Bing maps.. where is it ?
Apple maps in iOS 6 from iPad



Tuesday, June 12, 2012

Skydiving

On Sunday at about 10:40 we started driving to the Turku airport, where Skydive Turku (Skydive Turku - Turun Laskuvarjourheilijat ry) has the HQ. The tandem jump was done by their co-op partner, Skyxperience.
Leaving, not nervous at all.. no no

When we arrived we first went trough the competition details, this was a new thing for  them too.


On the way to the airport


On the way



If I hurt myself or die I get 20.000€ ! Awesome ;)
Then we both filled and signed  Vastuuvapatus forms (basically if drop-splat-and-die we are worth 20.000€ and can keep the pieces, yay ;)
Leila filling out her paper

Then we had a quick training on what to do, not that much as we more or less just hang from TheRealJumpper.
  1. Bend feet backwards under the plane
  2. Hand to the harness straps
  3. When instruction gives a sign, spread hands
Easy enough :)

Up there, I'm I nuts or what ? :)

Then we changed clothes and put on the tandem-jump harness.

I have my harness on, ready to go!

One of the video guys took the Lumia 900 and made a ad-hoc harness for it. It worked, luckily the phone didn't drop off it. The video is great, unfortunately none of us noticed that it was placed in "height-screen" mode, so the video is recorded upside down in portrait mode :) I'll post it here as soon as I get it rotated.
The Lumia 900 strapped on ready to make a video. Real professional work there :)

After that I emptied my pockets and left all my stuff at their office. We walked over to the airfield to wait for the plane to land and pick us up.

Me and my jump partner

The climb took about 5-6 minutes I think, then we where up at about 4100m I think.

One of the camera men, Leila and her jumping parner


First out was a real jumper woman. Then it was our turn. At about this point, having my feet dangling outside the plane and I started to get really nervous and slightly scared. Not that I had much time to think about it, as the next second we where out!

Stepping out. About 4000 meters down. Turku airport ^

And here we go!



And safely on the ground.
Had to sit down for a while, my legs didn't like to support me :)

Leila just having jumped from the plane
An enormous Thank You to Nokia and Nokia Connects (especially Sarah for organizing everything) and to Skyxperience from me and Leila! Thank you very very much for this. I will definitely never forget this experience.

If you are the Turku or Helsinki region and looking for something to do (and have cash to burn) check out Skyxperice and Skydivie Turku (on Facebook).

Sunday, June 10, 2012

Trying something new, Skydiving !

It was awesome! And horrible! But great! And scary! :D This was definitely something new.

Here we go!
More pictures and videos coming soon.

Trying Something New

When you read this I'm (and my girlfriend) most likely getting trained at Skyxperience to free-fall from 4000 meters for a minute or so and then gently touch down after dangling from a parachute for 5-10 minutes :)

In other words, my choice of trying something new is tandem parachute jumping, like this:


There will be someone recording the event so there will definately be a lot of pictures and video clips. I will also use the Lumia 900 to document the whole thing.

Saturday, June 09, 2012

More Lumia 900 testing, phone.. but first, a microSIM

The Lumia 900 requires a microSIM and the only microSIM I have is in my main phone, the N9. Not that I get why it couldn't use a good-old miniSIM, the phone is Huge :)

When I had the Nokia 603 for testing it never occoured to me that I could have gotten a pre-paid service so I could have tested the phone features properly. You might wonder why, but I've never used pre-paid service, I've been using the same service provider since 1996 (my first mobile was a Nokia 2110) and usage of pre-paid is not that common here in Finland, afaik.

So, today I got a pre-paid service from Saunalahti, only 6,60€, a good choice if you ever need pre-paid service here in Finland and it even includes data service with a special price of only 0.66€/day on microSIM phones.

Friday, June 08, 2012

Try Something New thingy moved to Sunday

The weather for Saturday is so bad the it had to be moved to Sunday. Can't stand the waiting :)
Just thinking about it makes my feet go wobbly. Can you guess what I'm going to try?

Thursday, June 07, 2012

The Lumia 900 arrived

DHL came with a Nokia Lumia 900 for me test and play with for the next two weeks, thanks to Nokia Connects. I will also use it to document the thingy on Saturday.


Bubblewrapped

A blue box

That contains another blue box

This box with some nice pictures and the Lumia 900 label

Inside the box we find the Nokia Lumia 900, USB cables and headphones, plus some quick guide papers. Oh, and a tool for opening the SIM cover. Must say that is a strange, design. I would definitely loose it quite fast with all the other junk I have at home.

Inside we find a good looking white Lumia 900

Protected inside plastic


Under the phone there is a SIM cover tool

The contents of the box

USB cable

A funny looking charger (I know it's the UK power plug style, still it looks funny to me :)

Basic in-ear headphones

A Quick guide and some more papers, who reads these anyway :)
Setting aside the fact that it's a WP phone, I have to admit that it does looks gorgeous! The N9 polycarbonate shell design is just perfect. You most likely know all the specs and stuff already but I'll repeat the basics just in case anyway.
  • 1.4 Ghz single-core Snapdragon ARM CPU
  • 512 MB RAM
  • 16 GB internal flash
  • 4.3" AMOLED ClearBlack display
  • Carl Zeiss optics, 8 megapixel main camera, 1 megapixel front camera
  • Single block polycarbonate body
  • Windows Phone 7.5
  • All the connection you could possibly need, 3G, 4G, Bluetooth, WiFI, USB
  • 720p 30 fps video recording
  • Read the full specs here




White Nokia Lumia 900
Nokia Lumia 900
Side by side comparison with the N9 and N950. The Lumia 900 is much larger than the N9. Even a bit too big for my taste, but I haven't really tried handling it that much yet. I usually have N950 and N9 in my pant pocket and they are just small enough to not feel uncomfortable. But lets see how it goes.

N9 and Lumia 900
N9 looks tiny beside the Lumia 900

Lumia 900 much larger
It is also a tiny bit larger than the N950
N950 and Lumia 900 togeather
Lumia 900 and Nokia N950.

N950 and Lumia 900
Lumia 900 is a tiny bit wider than the N950, about the same height.
I'm at work right now, but I'll post some more when I get home and can play with the phone properly.