Wednesday, June 12, 2013

Killing zombies on a BlackBerry 10 device from CLI

I'm porting a SDL based game to BlackBerry 10. The app does not yet handle the swipe-up + exit gesture properly and gets stuck in the background.

I don't know exactly what happens but the app is still running and I can't restart it and the app window  is also hidden from the task list view. Restarting fixes it obviously, but there must be a more sane way to kill it.

So what to do? The obvious way, ssh into it and running something like, say:

ps | grep appname
kill -9 

But nooo.. the paranoid people at BlackBerry has removed the QNX ps command from the BB10 Core OS.

$ ps
sh: ps: cannot execute - No such file or directory
$ which ps
which: no ps in /usr/bin:/bin:/usr/sbin:/sbin

So now what? I did ask on the forums for some help, got a link to a application for slaying zombies, but that did seem a bit overkill for a simple thing like this, so a quick dive into the code slayer showed that QNX has a /proc filesystem listing all the processes. Obviously to make it a PITA the permissions are all dr-x--x--x

But here, a poor mans ps command:

for i in /proc/*/cmdline ; do echo $i; cat $i; done

Find the line that prints out the cmdline for your app and get the pid from the line above, kill -9 it and there you have it!

Friday, May 31, 2013

NFC Enabling a non-nfc phone

NFC is a fun technology, the most classic example seems to be the tap-and-share
functionality. Unfortunately, NFC is still pretty rare among phones and none of the more cheaper ones support NFC in any way. (Which is strange, Nokia had two S40 Series phones with NFC already in 2008)

But for the simple tap-and-share from NFC phone to non-NFC there is a very simple solution. Check out this video demonstrating NFC tap-and-share from a Nokia N9 to a Nokia 500.



Next post will explain how to do it.

Thursday, May 30, 2013

Making sense of the ST HRM2 protocol

Luckily it speaks standard BT SPP protocol so getting data out of it is easy. Making any sense of it then another thing. For starters, here is a dump of what the HRM sends out.

What I've found out for now, is this:
  1. Start of data block: 0xFA
  2. Next is a sequence number going up from 0x44 to 0x47
  3. Another sequence number going down from 0xBB to 0xB8
  4. 0x81
  5. 0x36
  6. ?
  7. ?
  8. ?
  9. ?
  10. Padding of 6,7,9 zeroes
  11. Two bytes, most likely somekind of checksum
Below a dump of data if anyone is interested in trying to figure this thing out.


3714#    FA hex = -06 dec = 372 oct = _250__
3715#    44 hex = 068 dec = 104 oct = _68__
3716#    BB hex = -69 dec = 273 oct = _187__
3717#    81 hex = -127 dec = 201 oct = _129__
3718#    36 hex = 054 dec = 066 oct = _54__
3719#    45 hex = 069 dec = 105 oct = _69__
3720#    32 hex = 050 dec = 062 oct = _50__
3721#    84 hex = -124 dec = 204 oct = _132__
3722#    50 hex = 080 dec = 120 oct = _80__
3723#    00 hex = 000 dec = 000 oct = _0__
3724#    00 hex = 000 dec = 000 oct = _0__
3725#    00 hex = 000 dec = 000 oct = _0__
3726#    00 hex = 000 dec = 000 oct = _0__
3727#    00 hex = 000 dec = 000 oct = _0__
3728#    00 hex = 000 dec = 000 oct = _0__
3729#    BB hex = -69 dec = 273 oct = _187__
3730#    82 hex = -126 dec = 202 oct = _130__

3731#    FA hex = -06 dec = 372 oct = _250__
3732#    45 hex = 069 dec = 105 oct = _69__
3733#    BA hex = -70 dec = 272 oct = _186__
3734#    81 hex = -127 dec = 201 oct = _129__
3735#    36 hex = 054 dec = 066 oct = _54__
3736#    45 hex = 069 dec = 105 oct = _69__
3737#    00 hex = 000 dec = 000 oct = _0__
3738#    00 hex = 000 dec = 000 oct = _0__
3739#    00 hex = 000 dec = 000 oct = _0__
3740#    00 hex = 000 dec = 000 oct = _0__
3741#    00 hex = 000 dec = 000 oct = _0__
3742#    00 hex = 000 dec = 000 oct = _0__
3743#    00 hex = 000 dec = 000 oct = _0__
3744#    00 hex = 000 dec = 000 oct = _0__
3745#    00 hex = 000 dec = 000 oct = _0__
3746#    0C hex = 012 dec = 014 oct = _12__
3747#    94 hex = -108 dec = 224 oct = _148__

3748#    FA hex = -06 dec = 372 oct = _250__
3749#    46 hex = 070 dec = 106 oct = _70__
3750#    B9 hex = -71 dec = 271 oct = _185__
3751#    81 hex = -127 dec = 201 oct = _129__
3752#    36 hex = 054 dec = 066 oct = _54__
3753#    45 hex = 069 dec = 105 oct = _69__
3754#    48 hex = 072 dec = 110 oct = _72__
3755#    E1 hex = -31 dec = 341 oct = _225__
3756#    33 hex = 051 dec = 063 oct = _51__
3757#    00 hex = 000 dec = 000 oct = _0__
3758#    00 hex = 000 dec = 000 oct = _0__
3759#    00 hex = 000 dec = 000 oct = _0__
3760#    00 hex = 000 dec = 000 oct = _0__
3761#    00 hex = 000 dec = 000 oct = _0__
3762#    00 hex = 000 dec = 000 oct = _0__
3763#    48 hex = 072 dec = 110 oct = _72__
3764#    08 hex = 008 dec = 010 oct = _8__

3765#    FA hex = -06 dec = 372 oct = _250__
3766#    47 hex = 071 dec = 107 oct = _71__
3767#    B8 hex = -72 dec = 270 oct = _184__
3768#    81 hex = -127 dec = 201 oct = _129__
3769#    36 hex = 054 dec = 066 oct = _54__
3770#    45 hex = 069 dec = 105 oct = _69__
3771#    00 hex = 000 dec = 000 oct = _0__
3772#    00 hex = 000 dec = 000 oct = _0__
3773#    00 hex = 000 dec = 000 oct = _0__
3774#    00 hex = 000 dec = 000 oct = _0__
3775#    00 hex = 000 dec = 000 oct = _0__
3776#    00 hex = 000 dec = 000 oct = _0__
3777#    00 hex = 000 dec = 000 oct = _0__
3778#    00 hex = 000 dec = 000 oct = _0__
3779#    00 hex = 000 dec = 000 oct = _0__
3780#    8C hex = -116 dec = 214 oct = _140__
3781#    90 hex = -112 dec = 220 oct = _144__

3782#    FA hex = -06 dec = 372 oct = _250__
3783#    44 hex = 068 dec = 104 oct = _68__
3784#    BB hex = -69 dec = 273 oct = _187__
3785#    81 hex = -127 dec = 201 oct = _129__
3786#    36 hex = 054 dec = 066 oct = _54__
3787#    45 hex = 069 dec = 105 oct = _69__
3788#    7F hex = 127 dec = 177 oct = _127__
3789#    71 hex = 113 dec = 161 oct = _113__
3790#    68 hex = 104 dec = 150 oct = _104__
3791#    00 hex = 000 dec = 000 oct = _0__
3792#    00 hex = 000 dec = 000 oct = _0__
3793#    00 hex = 000 dec = 000 oct = _0__
3794#    00 hex = 000 dec = 000 oct = _0__
3795#    00 hex = 000 dec = 000 oct = _0__
3796#    00 hex = 000 dec = 000 oct = _0__
3797#    50 hex = 080 dec = 120 oct = _80__
3798#    9D hex = -99 dec = 235 oct = _157__

3799#    FA hex = -06 dec = 372 oct = _250__
3800#    45 hex = 069 dec = 105 oct = _69__
3801#    BA hex = -70 dec = 272 oct = _186__
3802#    81 hex = -127 dec = 201 oct = _129__
3803#    36 hex = 054 dec = 066 oct = _54__
3804#    45 hex = 069 dec = 105 oct = _69__
3805#    15 hex = 021 dec = 025 oct = _21__
3806#    50 hex = 080 dec = 120 oct = _80__
3807#    00 hex = 000 dec = 000 oct = _0__
3808#    00 hex = 000 dec = 000 oct = _0__
3809#    00 hex = 000 dec = 000 oct = _0__
3810#    00 hex = 000 dec = 000 oct = _0__
3811#    00 hex = 000 dec = 000 oct = _0__
3812#    00 hex = 000 dec = 000 oct = _0__
3813#    00 hex = 000 dec = 000 oct = _0__
3814#    A0 hex = -96 dec = 240 oct = _160__
3815#    63 hex = 099 dec = 143 oct = _99__

3816#    FA hex = -06 dec = 372 oct = _250__
3817#    46 hex = 070 dec = 106 oct = _70__
3818#    B9 hex = -71 dec = 271 oct = _185__
3819#    81 hex = -127 dec = 201 oct = _129__
3820#    36 hex = 054 dec = 066 oct = _54__
3821#    45 hex = 069 dec = 105 oct = _69__
3822#    7A hex = 122 dec = 172 oct = _122__
3823#    60 hex = 096 dec = 140 oct = _96__
3824#    00 hex = 000 dec = 000 oct = _0__
3825#    00 hex = 000 dec = 000 oct = _0__
3826#    00 hex = 000 dec = 000 oct = _0__
3827#    00 hex = 000 dec = 000 oct = _0__
3828#    00 hex = 000 dec = 000 oct = _0__
3829#    00 hex = 000 dec = 000 oct = _0__
3830#    00 hex = 000 dec = 000 oct = _0__
3831#    86 hex = -122 dec = 206 oct = _134__
3832#    8F hex = -113 dec = 217 oct = _143__

3833#    FA hex = -06 dec = 372 oct = _250__
3834#    47 hex = 071 dec = 107 oct = _71__
3835#    B8 hex = -72 dec = 270 oct = _184__
3836#    81 hex = -127 dec = 201 oct = _129__
3837#    36 hex = 054 dec = 066 oct = _54__
3838#    42 hex = 066 dec = 102 oct = _66__
3839#    2A hex = 042 dec = 052 oct = _42__
3840#    92 hex = -110 dec = 222 oct = _146__
3841#    94 hex = -108 dec = 224 oct = _148__
3842#    00 hex = 000 dec = 000 oct = _0__
3843#    00 hex = 000 dec = 000 oct = _0__
3844#    00 hex = 000 dec = 000 oct = _0__
3845#    00 hex = 000 dec = 000 oct = _0__
3846#    00 hex = 000 dec = 000 oct = _0__
3847#    00 hex = 000 dec = 000 oct = _0__
3848#    4B hex = 075 dec = 113 oct = _75__
3849#    9B hex = -101 dec = 233 oct = _155__

3850#    FA hex = -06 dec = 372 oct = _250__
3851#    44 hex = 068 dec = 104 oct = _68__
3852#    BB hex = -69 dec = 273 oct = _187__
3853#    81 hex = -127 dec = 201 oct = _129__
3854#    36 hex = 054 dec = 066 oct = _54__
3855#    42 hex = 066 dec = 102 oct = _66__
3856#    19 hex = 025 dec = 031 oct = _25__
3857#    13 hex = 019 dec = 023 oct = _19__
3858#    6E hex = 110 dec = 156 oct = _110__
3859#    00 hex = 000 dec = 000 oct = _0__
3860#    00 hex = 000 dec = 000 oct = _0__
3861#    00 hex = 000 dec = 000 oct = _0__
3862#    00 hex = 000 dec = 000 oct = _0__
3863#    00 hex = 000 dec = 000 oct = _0__
3864#    00 hex = 000 dec = 000 oct = _0__
3865#    D9 hex = -39 dec = 331 oct = _217__
3866#    4E hex = 078 dec = 116 oct = _78__

3867#    FA hex = -06 dec = 372 oct = _250__
3868#    45 hex = 069 dec = 105 oct = _69__
3869#    BA hex = -70 dec = 272 oct = _186__
3870#    81 hex = -127 dec = 201 oct = _129__
3871#    36 hex = 054 dec = 066 oct = _54__
3872#    41 hex = 065 dec = 101 oct = _65__
3873#    2C hex = 044 dec = 054 oct = _44__
3874#    D2 hex = -46 dec = 322 oct = _210__
3875#    E2 hex = -30 dec = 342 oct = _226__
3876#    00 hex = 000 dec = 000 oct = _0__
3877#    00 hex = 000 dec = 000 oct = _0__
3878#    00 hex = 000 dec = 000 oct = _0__
3879#    00 hex = 000 dec = 000 oct = _0__
3880#    00 hex = 000 dec = 000 oct = _0__
3881#    00 hex = 000 dec = 000 oct = _0__
3882#    93 hex = -109 dec = 223 oct = _147__
3883#    57 hex = 087 dec = 127 oct = _87__

Monday, May 20, 2013

Jolla is out

This is Monday to look forward to!

Jolla unveiled their phone just a couple of minutes ago and it looks good, really good. The specs seem to be a bit preliminary still, no real details, but dual-core, 4.5" display, 8MP auto-focus camera, 16MB of storage + microSD slot.


And The Other Half, a back cover that the user can change to customize, not only the device, but the whole interface will adjust itself to the backcover color.

Join the Tribe


The device will be available in the end of 2013 and Jolla is taking pre-orders Right Now, you can select between 100€ (Limited edition, priority pre-order, T-shirt, 100€ voucher and exclusive Other Half), 40€ (Limited edition, priority pre-order, T-shirt) or 0€ (pre-order only). Obviously you know which one to select,  I give you a hint, it starts with one and then two zeros.


Oh, and start developing now, Sailfish SDK is available.

Friday, March 22, 2013

ICTExpo 2013, Helsinki

I was to the ICTExpo yesterday, the most interesting thing must have been these old computers that Tietotekniikan liitto had on display :)

TeleType KSR 33 (1963-1981)

Osborne 1, C64, Telmac TMC-600 and a Nokia MikroMikko

Also, I like to dabble with NFC and got myself a demo/testing pack with a NFC card and a USB reader (ACR122U).
ACR122U reader
This was also nice to play with, on display at Cubio:s booth, a BlackBerry Z10. (Should be available in Finland next month, price quote was a "very clear" 600-700€. I'd recommend getting it from Amazon or some other out-of-Finland shop for now.
Z10

Thursday, March 14, 2013

GPS, Mapping and picture taking

This news reminded me of how absurd it can sometimes be when doing mapping work. I was a couple of years back in Limnos, Greece on a two week holiday.

Mmm, good food


As I've been an OpenStreetMapper since about 2006 I of course wanted to check out the if it had been mapped or not. Only some very rough main roads had been drawn there. This was just a bit after OSM got the nice Yahoo/Bing aerial photos and luckily for me there where quite good aerial photos of Limnos. So mapping I went, from my home and couple of thousand kilometers away. And got it mostly mapped in time for my travels.

Limnos map, looks good or what ? :)


Yeah, whatever I hear you thinking, what does this have anything to do with China ?

Limnos has a heavy army presence, there are many military bases and bunkers all around and a large radar installation. And for example the airport/airfield is a military area (you can even make out the planes/helicopers in the aerial images). And of course you aren't allowed to take any photos anywhere near these places.

No, not a military base (but there is one not far from here). Myrina.


What makes this absurd is that everything is available on the Internet anyway. And if some neighbouring enemy country would like to bomb the hell out of some base, all they need to do is fire up Bing maps or Google maps to find them.3

So why the hell can't a tourist take photos of these places ? Just wondering...

More QML Box2D progress and github

To start with, I pushed my enhanced version of the qml-box2d bindings to github.

It is based on Box2D 2.2.1 and adds more features:
Joint release/grab, WeldJoint, WheelJoint, FrictionJoint, Edge shape support, more properties and methods (gravityScale, getMass(), getInertia(), angularVelocity, etc) and Body fixture iteration.

Here are some videos showing usage of PulleyJoint and RopeJoin:

PulleyJoint


RopeJoint


Have fun! (oh, Qt 4.7 or 4.8 only!)