Android 2.1 (Eclair) on the HTC Hero…

Posted in Android, Gadgets, HTC Hero, Software-related on June 8th, 2010 by Jan

I’ve bought an HTC Hero a while back. Rooted it too, so I could edit the sms database. Loving the phone.

Then HTC promised us (owners) an upgrade from Cupcake (Android 1.5) to Eclair (Android 2.1), scheduled for March 2010. Since Eclair has a ton of additional features and bugfixes, this was a biggy.

Then HTC postponed it to beginning of April. End of April. May. June.
On the 4th HTC started rolling out the update for Asia, and we still had to wait in Europe. That’s when I got fedup with waiting.

Thanks to the wonderful guys over at XDA-Developers and this Complete Newbie Guide to Install a Custom Rom, I now have VillainRom10 installed, which is basically a repackaged official 2.1 rom from HTC.

I had to use the GoldCard method to downgrade my Hero (specified in the Guide – worked perfectly with a Sandisk 2gb SD card), and install the drivers from this thread for the RUU (Rom Update Utility) to find the Hero in bootloader mode. Other than that, it’s a smooth sailing.

After using the phone now for two days, it feels mightily fast, snappy… it’s a total new phone.

Gigantic Android, Donut, Cupcake and Eclair at the GooglePlex

Goodie!

Multiseat on Debian

Posted in Hardware-related, Linux / unix, Software-related on April 4th, 2010 by Jan

Since I have a rather well-scaled desktop PC (nothing really fancy by today’s specs, but it’s underused as it is), and my gf sometimes wants to use it, and sometimes we both want to use it at the same time, I decided to turn it into a multiseat configuration.

What’s a multiseat? Basically you connect a second set of input peripherals (keyboard, mouse) and a second screen (and if necessary a second video card) and reconfigure it to act as a separate pc.
And with Linux, you just can, without a lot of trouble.

There are some different multiseat setups: those that run separate X servers (one per display), and those that run one X server for all displays and then run a nested server on top of that to split out the actual displays. The ‘problem’ wit the latter is that you usually don’t have any 3D acceleration left, though if you use Xephyr these days that seems to work aswell.

I opted for the first option.

My hardware (that matters for this setup):

  • Mice: 2 simple Logitech usb mice
  • Keyboards: 2 usb keyboards (one Cherry Cymotion Linux Master & one labtec Ultraflat)
  • Graphics: an onboard ATI Radeon HD 3200 (this is part of the AMD 780 chipset) video chip on my Asrock motherboard (was originally disabled and enabled for this multiseat setup) and an addon ATI Radeon HD 4850 card (with an RV700 chip).
  • Screens: two screens – in this case, one 20.1″ Viewsonic VX2025wm and one 22″ (newly purchased) LG w2253TW

Notes:

  1. It is advised to use chips that can be driven with the same driver for a multiseat setup!
  2. If you use an onboard chipset (like I do), you’ll need to change the boot order so that this chip is actually used as the primary device, otherwise it won’t be initialised correctly.

Originally I had the ATI binary driver fglrx installed, but this does _not_ play well with a multiseat setup. The initialisation of the second card causes the system to hardlock.
Since this driver doesn’t work, I went for the xf86-video-ati driver, which is completely opensource, and in combination with a recent kernel allows for kernel mode setting. You do need the firmware for the card, usually found in the firmware-linux packages of your favourite distribution.

So, the works:

Requirements

  1. Get a spankingly fresh kernel. 2.6.33 at least, preferably newer. Compile it with KMS support enabled. Note that when you enable KMS support, you’ll lose your console unless you compile in fbcon, but I advise against this, as this doesn’t seem to play well with a multiseat setup.
  2. Install the linux-firmware package or get the necessary firmwares for your cards (to get 3D acceleration)
  3. Get a decently fresh Mesa (7.7 branch)
  4. Lastly, get a mjummy fresh xf86-video-ati driver.

Originally, I compiled all these and installed them over the existing binaries in /usr, but fortunately my favourite distribution Debian has the necessary components in Sid and Experimental. these days.

Xorg.conf changes

After everything is installed, you need to modify your xorg.conf file.

ServerFlags

Section "ServerFlags"
        Option      "DefaultServerLayout" "seat0"
        Option      "AllowMouseOpenFail"  "true"
        Option      "AutoAddDevices" "false"
EndSection

The AutoAddDevices line is important, otherwise we can’t map the devices to the right seat.

The actual graphic chips/cards:

Section "Device"
        Identifier  "ATI RadeonHD 4850"
        Driver      "ati"
        BusID       "PCI:2:0:0"
        Option      "Int10" "off"
EndSection

Section "Device"
        Identifier   "ATI RadeonHD 3200"
        driver       "ati"
        BusID        "PCI:1:5:0"
        Option       "Int10" "off"
EndSection

Int10 off is important here, otherwise the second card will fail to initialise.
Do not forget to change the PCI identifiers! They probably won’t match my setup. You can find them by using lspci, for instance on my setup:

lspci | grep  "Radeon HD"
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon HD 3200 Graphics
02:00.0 VGA compatible controller: ATI Technologies Inc RV770 [Radeon HD 4850]

So you can see that the HD3200 is on address 1:5 and the HD4580 is on address 2:0.

The monitors (nothing fancy)

Section "Monitor"
        Identifier   "Viewsonic Vx2025wm"
        Option      "DPMS"
EndSection

Section "Monitor"
        Identifier    "LG W2253TW"
        Option       "DPMS"
EndSection

Screen section (mapping monitors and cards)

Section "Screen"
        Identifier        "Screen0"
        Device           "ATI RadeonHD 4850"
        DefaultDepth   24
EndSection

Section "Screen"
        Identifier        "Screen1"
        Device           "ATI RadeonHD 3200"
        DefaultDepth   24
EndSection

Next, the ServerLayout sections, one per seat:

Section "ServerLayout"
        Identifier     "seat0"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerLayout"
        Identifier     "seat1"
        Screen      1  "Screen1" 0 0
        InputDevice    "Mouse1" "CorePointer"
        InputDevice    "Keyboard1" "CoreKeyboard"
EndSection

Next, the input devices:

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.1-usb-0:3:1.0-event-kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us"
    Option         "XkbRules"   "xorg"
EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "evdev"
    Option         "Protocol" "ExplorerPS/2"
    Option         "Device" "/dev/input/by-path/pci-0000:00:13.0-usb-0:3:1.0-event-mouse"
EndSection

Section "InputDevice"
    Identifier     "Keyboard1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.2-usb-0:3.1:1.0-event-kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us"
    Option         "XkbRules"   "xorg"
EndSection

Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "evdev"
    Option         "Protocol" "ExplorerPS/2"
    Option         "Device" "/dev/input/by-path/pci-0000:00:12.2-usb-0:3.2:1.0-event-mouse"
EndSection

You need to change the device paths to match the devices you want, either by checking /dev/input/by-path/ or by /dev/input/by-id/. The benefit of using by-id is that if you replug your devices, they’ll still be mapped correctly. Since I have devices with the same ID, this didn’t work for me.

All these changes sofar should allow you to manually start up the X servers with the respective keyboard/mouse/screen settings. You should be able to test it with these commands:

/usr/bin/X -br -nolisten tcp -layout seat0 -sharevts \
      -novtswitch -isolateDevice PCI:2:0:0

or

/usr/bin/X -br -nolisten tcp -layout seat1 -sharevts \
      -novtswitch -isolateDevice PCI:1:5:0

KDM changes

Now, since I want both the X servers to be available at boot time, and I’m using KDE anyway, I went with KDM.

In the [General] section, look for a line reading:

StaticServers=:0

change it to:

StaticServers=:0,:1

Also, change:

ReserveServers=:1,:2,:3

to:

ReserveServers=:2,:3

Next, look for the [X-:0-Core] section, and copy the entire block, creating a second block with the section name [X-:1-Core].

In the [X-:0-Core] section, look for the line

ServerArgsLocal=-br -nolisten tcp

and change it to

ServerArgsLocal=-br -nolisten tcp -layout seat0 -sharevts -novtswitch -isolateDevice PCI:2:0:0

In the [X-:1-Core] section, look for the line

ServerArgsLocal=-br -nolisten tcp

and change it to

ServerArgsLocal=-br -nolisten tcp -layout seat1 -sharevts -novtswitch -isolateDevice PCI:1:5:0

One KDM restart later (/etc/init.d/kdm restart) you should have two X servers running, both on their respective screens!

Last but not least, kudos to WKPG wiki for the helpful article ;)

VMWare Player 3 vs Linux 2.6.32

Posted in Linux / unix, Software-related, Virtualisation on December 31st, 2009 by Jan

I wanted to test some crap in VMWare, didn’t feel like messing with the entire server thing so went for the player. Unfortunately, this thing doesn’t work against the 2.6.32 kernel.

After installation, you can fix it with as follows (as root):


cd /tmp
tar xf /usr/lib/vmware/modules/source/vmnet.tar
tar xf /usr/lib/vmware/modules/source/vmci.tar

cd vmnet-only
sed -i "/vnetInt.h/ a\#include \"compat_sched.h\"" vnetUserListener.c

cd ../vmci-only/include
sed -i "/compat_page.h/ a\#include \"compat_sched.h\"" pgtbl.h

cd /tmp
tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
tar cf /usr/lib/vmware/modules/source/vmci.tar vmci-only

and rerun vmplayer.

Rooting the HTC Hero

Posted in Android, Gadgets, HTC Hero, Software-related on December 13th, 2009 by Jan

Note: This is at your own risk. If you fry your phone, your problem, not mine.

I recently got an HTC Hero. Great phone, I’m loving the Android platform. Pity that you don’t have full access to it, and I actually wanted to merge my old phone (Nokia E65)’s SMS database into this one, so I needed full access.

(Un)fortunately, these days the HTC Hero comes with the latest firmware, 2.73.1100.5, which on the one hand makes rooting harder (fixes several bugs and fastboot no longer works) but on the other hand makes the phone respond a lot better.

After some twiddling and reading on the XDA Developers Forum, I came up with this recipe:

Downloads needed:

Howto:

  • Download the Android SDK, and install/extract it somewhere. I’m using Linux and put it under /home/<user>/android/
  • Download asroot2.zip, superuser.zip, and extract them in a directory of your choice. For instance, /tmp.
  • Change to the Android SDK directory and in that one /tools (here: /home/<user>/android-sdk-linux_86/tools/
  • Start adb (Android Debug Bridge): ./abd wait-for-device
  • Put your phone in HTC Sync mode: drag the notification bar down and activate HTC Sync

After a while adb should return to the prompt. Should mean your phone has been found.

  • Copy asroot2 and su on the phone in /data/local:
    ./adb push /tmp/asroot2 /data/local/
    ./adb push /tmp/su /data/local/
  • Open a shell to the device: ./adb shell
  • Make asroot2 executable, and launch it:
    chmod 0755 /data/local/asroot2
    /data/local/asroot2 /system/bin/sh

Your phone should greet you with:

[+] Using newer pipe_inode_info layout
Opening: /proc/564/fd/3
SUCCESS: Enjoy the shell.
#

At this point, remount your /system filesystem read-write.
Before remounting, executing the mount command should return a line containing:

/dev/block/mtdblock3 /system yaffs2 ro 0 0

Now, remount the fs:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
(this returns no output)

And now executing mount should return a line like:

/dev/block/mtdblock3 /system yaffs2 rw 0 0

and copy the su binary into /system/bin:
dd if=/data/local/su of=/system/bin/su
and make it executable with root permissions:
chmod 4755 /system/bin/su

Next, copy the Supseruser.apk to the SD card and install it.
Then, reboot your phone (power off and on).

Restart your abd shell, and execute su in your adb shell: su, and on the phone it should come ask if you want to allow root permissions:

SU request

Tap “Allow”, et voila, you now have a rooted phone.

Nokia 3109c and Snow Leopard (iSync 3.1)…

Posted in Gadgets, Mac OS, Software-related on November 11th, 2009 by Jan

As I detailed in my previous post on how to get this phone working with Leopard, upgrading to Mac OS X 10.6 aka Snow Leopard broke things again.

Easy fix though: follow the steps in my previous post, and attached to this post you can find the ‘fixed’ MetaClasses.plist file.

All I actually did was copy this block in the existing MetaClasses.plist:


<key>com.nokia.3109</key>
<dict>
<key>Identification</key>
<dict>
<key>com.apple.cgmi+cgmm</key>
<string>Nokia+Nokia 3109</string>
<key>com.apple.gmi+gmm</key>
<string>Nokia+Nokia 3109</string>
<key>com.apple.usb.vendorid-modelid</key>
<string>0x0421/0x045A</string>
</dict>
<key>InheritsFrom</key>
<array>
<string>family.com.nokia.series40.3rdEd.bus.usb-bt</string>
</array>
<key>Services</key>
<array>
<dict>
<key>ServiceName</key>
<string>com.apple.model</string>
<key>ServiceProperties</key>
<dict>
<key>ModelIcon</key>
<string>NOK3109.tiff</string>
<key>ModelName</key>
<string>3109</string>
</dict>
</dict>
<dict>
<key>ServiceName</key>
<string>com.apple.synchro</string>
<key>ServiceProperties</key>
<dict>
<key>MaxCityLength</key>
<integer>50</integer>
<key>MaxEMailLength</key>
<integer>60</integer>
<key>MaxEventLocationLength</key>
<integer>150</integer>
<key>MaxPhoneNumberLength</key>
<integer>48</integer>
<key>MaxPostalCodeLength</key>
<integer>50</integer>
<key>MaxStateLength</key>
<integer>50</integer>
<key>MaxStreetLength</key>
<integer>50</integer>
<key>MaxURLLength</key>
<integer>60</integer>
</dict>
</dict>
</array>
</dict>

Since WP keeps on braking my indentation, just download it here: MetaClasses.plist

phptelemeter 1.35 released!

Posted in Software-related, phptelemeter on October 27th, 2009 by Jan

I’ve just released phptelemeter 1.35. This version only has a few changes, but I wanted to get it out there:

  • Added support for Mobile Vikings
  • Added unlimited support for Dommel accounts bug report: 2886030)

As per usual, you can download it from SourceForge.

Using an Alcatel X200 under Linux

Posted in Internet, Linux / unix, Software-related on October 12th, 2009 by Jan

I recently purchased an Alcatel Onetouch X200 3G USB modem, to be able to use internet on various locations where there is no wired or wifi available. Works fine under Windows/Mac OS X, bit more of a hassle under Linux.

Here are some hints on how to get it to work:

  • You need to install usb-modeswitch to switch the card from it’s builtin usb-storage mode to the USBModem mode. Configuration is done in /etc/usb_modeswitch.conf
  • Use /dev/ttyUSB2. The other two ports that your modem will give don’t really work well.
  • Also, use atleast kernel 2.6.31. Earlier ones might not work.
  • Disable PIN authentication on your SIMcard! This one thing was what kept it from working decently – I tried tons of things, and when I disabled the PIN, it worked nearly instantaneously.
    The command to do PIN auth is AT+CPIN=1111 (changing 1111 by your actual PIN), but when issuing this command the modem accepts it, but very often freaks out afterwards. Weird.
    You can find a nice list of GSM modem AT codes on gsm-modem.de.

Thats about it!

phptelemeter 1.34 released

Posted in Software-related, phptelemeter on August 2nd, 2009 by Jan

I’ve just released phptelemeter 1.34. This version includes the following changes:

  • Fixed telemeter4tools parser.
  • Added a check for the new scarlet unlimited accounts
  • Spellingfix: changed ‘seperate’ to ‘separate’
  • Added support for single-quota separate-info providers, needed since the daily output for the scarlet_web parser was broken.
  • Removed “text-transform: lowercase;” from the html publisher (bug report: 2197767)
  • Fixed a bug in the scarlet_web code
  • Added mysql publisher (feature request: 1671210)
  • Limited warn-percentage to 2 digits after the comma (feature request: 1936213)
  • Added reset date to over-limit notification mails (feature request: 1837559)

As per usual, you can download it from SourceForge.

Autoswitching network interfaces

Posted in Linux / unix, Software-related on March 8th, 2009 by Jan

Since I’m a lazy git, I want my laptop to automatically switch back & forth between my wired and wireless interfaces. Seems that stuff like Network Manager can do that for you, but it’s not really my thing. I don’t like stuff where you need a GUI to configure it, a duplicaton of network configuration, and it also tends to hang my machine. No idea why, though.

After an afternoon of fiddling around with several things, I came up with the recipe:
1 portion ifplugd, a good mix of ifupdown configuration with guessnet mappings, and some home-grown scripts. Mix well, and let simmer over a hot stove for half an hour. ;)

The details (tailored to Debian Sid):

  1. Install ifplugd and guessnet: apt-get install ifplugd guessnet
  2. Configure the interface you want ifplugd to monitor. For me, this is eth0 (wired ethernet). You can do this by editing /etc/default/ifplugd and adding eth0 in the INTERFACES field.
    Restart ifplugd (/etc/init.d/ifplugd restart)
  3. Edit your /etc/network/interfaces file the way you like it. I’m using multiple wireless entries with guessnet:
    mapping ath0
            script guessnet-ifupdown
            map verbose: false
            map debug: false
            map autofilter: true
    
    iface ath0-work inet dhcp
            test wireless essid WORK
            wpa-ssid WORK
            wpa-key-mgmt WPA-PSK
            wpa-proto WPA
            wpa-psk "***"
            wpa-driver wext
    
    iface ath0-home inet dhcp
            test wireless essid HOME
            wpa-ssid HOME
            wpa-key-mgmt WPA-PSK
            wpa-proto WPA
            wpa-psk "***"
            wpa-driver wext
    

    For syntax info, see man guessnet

  4. Replace the script in /etc/ifplugd/action.d with something more usable. The installed script only calls ifup or ifdown depending on what’s happening. What we want is to ifdown the interface, and ifup the other.

    Something like this:

    #!/bin/sh
    set -e
    
    WIRED_INTERFACE="eth0"
    WIFI_INTERFACE="ath0"
    WIFI_MODULE="ath_pci"
    IFUPDOWN_STATE="/etc/network/run/ifstate"
    
    if [ $# -ne 2 ]; then
            echo "Incorrect usage!"
            echo "$0:  "
            exit 1
    fi
    
    case "$2" in
    up)
            if [ "$1" = $WIRED_INTERFACE ]; then
                    # Wired interface is going up, bring wireless down
                    # if it is active.
                    WIFI_MODULE_LOADED=$(lsmod | grep ^$WIFI_MODULE | wc -l)
                    if [ $WIFI_MODULE_LOADED -eq 1 ]; then
                            /sbin/ifdown $WIFI_INTERFACE
                            /sbin/rmmod $WIFI_MODULE
                    fi
                    /sbin/ifup $WIRED_INTERFACE
            else
                    /sbin/ifup $1
            fi
            ;;
    down)
            if [ "$1" = $WIRED_INTERFACE ]; then
                    # Wired interface is going down, bring up the
                    # wireless one.
                    /sbin/ifdown $WIRED_INTERFACE
    
                    /sbin/modprobe $WIFI_MODULE
                    /sbin/ifconfig $WIFI_INTERFACE up
                    sleep 5
                    /sbin/ifup $WIFI_INTERFACE
    
                    WIFI_CONFIGURED=$(grep ^$WIFI_INTERFACE $IFUPDOWN_STATE | wc -l)
                    if [ $WIFI_CONFIGURED -eq 0 ]; then
                            # Interface was not configured, bring it back down
                            # to save power
                            /sbin/rmmod $WIFI_MODULE
                    fi
            else
                    /sbin/ifdown $1
            fi
            ;;
    esac
    

Now, every time ifplugd configures up eth0, ath0 is automatically deconfigured, and vice versa.
The actual configuration of the interfaces is still in /etc/network/interfaces, so you can still handle it by hand if you want to.

As always, it works fine for me, but YMMV, and TIMTOWTDI!

World of Goo!

Posted in Games, Software-related on March 7th, 2009 by Jan

A good friend of mine introduced me to a new game: World Of Goo!

I’ve finished the demo, and it’s damned addictive ;)

There are user levels available too, so the gameplay isn’t limited to the game itself ;)

And, as a nice bonus: It’s available for Windows, Mac, and Linux!