Thinkpad X240 and Debian Linux

This post is being updates as we go… check back later for more

So, Lenovo have finally made another laptop that has specs I can live with: The new Thinkpad X240.
The Lenovo web-shop is a steaming pile of crap, and trying to customize/configure the laptop will take many attempts, with various differences between the different locales. However, in the end I ended up with the laptop configured the way I wanted it:


  • Full HD, non-touch, non-glare 12.5″ screen (1920×1080)
  • Intel Dual-Core i5-4300U
  • 500G Harddisk (swapped with a SAMSUNG 840 SSD, 250GB immediately after arrival)
  • 8GB DDR3 Ram
  • Intel 802.11ac dual-band wifi and Bluetooth
  • Intel Gigabit Ethernet
  • USB 3.0 (2 ports, 1 left, 1 right)
  • Smartcard reader
  • SD-Card reader
  • 3-Cell (internal, 23Whr) + 6-Cell-High-Capacity backside battery (72Whr, total ~95Whr)
  • Backlit US-international keyboard
  • Clickpad and clit-mouse
  • VGA and Mini-DisplayPort
  • Docking port (though I didn’t buy a dock)
  • WWAN antenna’s (WWAN modem optional)

I also bought a set of adapter cables to convert from the old-style 7.9MM round thinkpad adapter to the new flat/square connector on the X240 (and X1-Carbon). These can be found on aliexpress or ebay so I could re-use my 4+ existing Thinkpad Adapters.


By default, the Thinkpad X240 comes with Windows 8… which is not very user-friendly, and definitely not compatible with my usage. I removed the internal HDD drive, swapped it out with a Samsung 250GB SSD and installed Debian Jessie on this drive. (BTW: Windows 8 was very sluggish on the HDD drive, even with 8GB of ram)

I prefer running the Mate/Gnome-2 desktop, so I added the mate-desktop repositories and installed mate-desktop-environment.

Hardware Configuration

Lenovo has made it very easy to disable unneeded hardware in the EFI/BIOS. The following devices can be turned off (to add battery-life and privacy 😛 )

  • 720p Webcam
  • Microphones
  • WWAN
  • WLAN
  • LAN
  • USB

Config tweaking

  • Tweak440s:
  • Synaptics configuration: /usr/share/X11/xorg.conf.d/50-synaptics.conf
    • Option “SoftButtonAreas” “60% 0 0 5% 40% 60% 0 5%”
  • Disable the soundcard, so the internal speakers are the ‘fallback’ option, then logout/login to make the media buttons work on the new default device.


  • Very quick resume from suspend, open the lid and immediately see the ‘unlock screensaver’ popup
  • Full-HD display
  • Very low battery-drain when idle and almost none in suspend
  • Hot swappable battery
  • Lightweight


  • No fysical buttons with the trackpoint/touchpad
  • No leds for wifi/disk activity
  • No way to set ‘fn-lock’ automatically
  • Not as ‘non-glare’ as they used to be, but still acceptable
  • End/Insert button is shared, to use ‘end’ you need Fn-End, while I never use insert.
    • FIXED: Edit /usr/share/X11/xkb/keycodes/evdev, and swap the codes for END and INS, then run: setxkbmap
    • <INS> = 115;
    • <END> = 118;

attiny85 powered kWh-meter-meter and 1-wire host

At Revelation Space we wanted some insight into our powerusage. After a few prototypes on arduino’s I ended up building a small board powered by an attiny85.

In later revisions I added a Dallas/Maxim 1-Wire bus that will read out DS18B20 temperature sensors, so I could monitor the temperature of the server that was logging the data (it didn’t have any supported sensors).

The schema shows the attiny85, the programming header (non-standard pinout ISP header) and used parts.

The LED will blink for every received pulse, so you can verify this with the original meter. I made the connection to the LDR as a 2-pin jumper-block, so I could easily disconnect the LDR, which is connected to a long cable so it can reach the led on the kWh-meter.

JP1 on the schema is the 1-Wire bus. I ended up using just the 2-pin version. On my board I terminated this on a 8×2 pin female header.

The final board:

The kWh-meter I am monitoring blinks a led a number of times per kW used. In this case it blinks 1000 times per kW, but I have seen other meters that blink 400, 480, 600 and 1000 times. This is usually documented somewhere on the meter itself.

It looks somewhat like this one:

The trick is to attach an LDR in front of the LED on the meter, and then read out the data using an analog port on the attiny. Make sure to blank out any outside light that can hit the LDR using black tape.

The code for the attiny can be found on my Github

The last components are rrdtool to make graphs and a perl script to log data from the (serial) attiny and pipe the data to rrdtool. Rrdtool and perl code can also be found on github.

After a few days of logging you should have a good insight into your power usage:

If your kWh-Meter uses a rotating disc, Juerd has a nice design that works with those meters. It’s based on an arduino and uses 7-segment displays to give a live insight into the used wattage.

USB-ASP Avr programmer from e-Bay, issues with attiny85

I recently bought a USBASP programmer from e-Bay, the one pictured here

It seemed to work just fine when I was programming attiny4313’s or atmega’s, but would fail on verification when programming attiny85’s (and probably other small/slow attiny’s).

Setting the fuses would work, but writing flash would fail consistently.

The trick to resolve this was to update the firmware to the 2011 version of USBASP, which can be found at

To program the USBASP itself, you need a second programmer (I used a usbtiny) and you need to jumper J2 (which are the 2 solderpoints next to the leds).

After upgrading the firmware, use avrdude with the ‘-B 10‘ option to write to slow devices. This option is not needed with faster (1.5Mhz and up) devices.

Fake PS3Break

This week I received a PS3Break device, but it seems it’s a fake version. It works just fine with the 3.41 firmware on the PS3, but doesn’t have an upgrade button to upgrade the payload on the device.

This is not (yet) a big problem, but it would be nice if I could get it to upgrade to a newer payload. It’s label claims it’s version 1.1. Here are some pictures of the device itself, and the PCB inside.

outside casing of fake ps3break
outside casing of fake ps3break

Front side of the PCB
Front side of the PCB

Back of the PCB

I have already tried shorting several sets of pins on the PCB where I guess the programming button might be wired, but so far I have not yet succeeded.

Might be a nice little project to look into on the next hackerspace meeting.

…becomes a mame-cabinet

The scrapmame cabinet is getting to a functional level. Today I was able to play a game of asteroids, pacman and galaga on it.
All the buttons have been wired up to the controller using screw terminals (kroonsteentje) for easy (dis)assembly.

Galaga running on scrapmame

Before getting there I had to do some creative wiring, as it seems I cut some corners with wiring up the controller. A few separate ground-points were connected, however this was causing interesting signals on the analog joystick axes. A lot of trial-and-error later it seems I have clean inputs from all buttons and the digital joystick.

I still need to hook up the second stick (which will hopefully arrive from DX this week), some buttons (insert coin, start game) and a usb keypad (for misc buttons). A set of speakers should also arrive this week, allowing the scrapmame to make a decent amount of noise.

Next week I’ll probably fit in the PC (I’ve been using my laptop for testing so far) and then I’ll start on the launcher/menu interface.

I’ll try to add some more pictures of the inside of the cabinet later.

Some woodworking…

At Revelation Space I have been doing some woodworking for a project I’m working on. I’m normaly the guy with two left hands when it comes to working with heavy machinery and old-skool hardware, but I must say I’m not doing too bad.
It helps that revspace has more then enough of the necessary tools (at home I only have a hammer and a screwdriver :P)

The project is a self-built Arcade cabinet, which at this time has been called ‘ScrapMAME’, as it’s been built completely out of scrap-materials.
Step 1... getting lots of wood

I PSX Controller (pre disassembly)have built the frame and outsides of the cabinet from wood boards that were originally bolted onto the windows in the workshop, together with some wood beams that were still lying around the space.
The buttons and joystick have been ordered from DealExtreme, and the first batch has arrived. Hopefully my second shipment with the remaining parts will arrive soon.
I’m using this arcade stick, and these buttons from DX. The buttons will be wired to the pcb of an old PSX controller, which will be connected to a PSX->USB adapter.

2010/06/26: The buttons and joystick arrived, so I could finally drill the holes.
Unpacked the newly arrived buttons and arcade stick
Holes for the fire-buttons and joysticks

There is still lots to be done… which will be added as soon as I get to it ;P

HTC Hero

So, I finally replaced by aging Nokia E70 with a brand new HTC Hero White Android phone. The touchscreen keyboard is still something I have to get used to, and the batterylife the last few days has been limiting (but I play a lot with it… but I must remember to recharge it when possible).HTC-Hero-Android-White
I’ve installed quite a few applications on it, and have now also gotten my voipbuster account working on it and have made some voip test-calls to and from my other voip numbers. I’ve also gotten voip to work over the telfort 3G connection I’m using, and will probably be using a lot of that in the future.
Other notable apps I will enjoy a lot are:

Google Skymaps. Uses the compass and position sensors so display a star-map of the area that you are pointing at
Google places. Should list all kinds of local restaurants, bars, banks and gas stations… but how well this works in the Netherlands is yet to be seen.
Twidroid. My current twitter-app of choice, Peep just didn’t pull it.

Some stuff I figured out, but that wasn’t too obvious initially:

  • Press ‘home’ for 2-3 seconds and release for a list of running applications and click them to switch to them
  • Telfort network is always considered to be ‘roaming’, because it doesn’t really exist anymore, and I am technically on the KPN network.

Replacing/updating my PGP key

I’ve decided that my PGP key could use some updating after 9 years. I have created a new (longer) and better-hashed PGP key. Now using 4096 bits of RSA, and using sha2 from now on 😉

And the new key is:

pub 4096R/C4F69BD2 2009-05-11 [expires: 2019-05-09]
Key fingerprint = 6AFC 0D83 5346 C729 6754 113F D867 4D8F C4F6 9BD2

I have placed the key on my server: and uploaded it to the pgp keyserver(s).

I have also created a transition document, which is signed by my old and new keys, located on If you have signed my old key (0x357D2178) please consider re-signing my new key after verifying the signatures on this document.

If you prefer to meet me face-to-face for a key verification, that shouldn’t be too hard to arrange. I’ll try to keep some keyslips on my at all times.

Update 2009/05/18: The file was signed first with my old key, and the result was signed with my new key. This gave some problems, and the file is now replaced by a new version which is signed by both keys simultaniously. This should verify correctly.

curl -s | gpg –verify
gpg: Signature made Mon 18 May 2009 11:00:17 AM CEST using RSA key ID C4F69BD2
gpg: Good signature from “Mark M. Janssen <>”
gpg: aka “[jpeg image of size 1522]”
gpg: Signature made Mon 18 May 2009 11:00:17 AM CEST using DSA key ID 357D2178
gpg: Good signature from “Mark Janssen (Maniac) <>”
gpg: aka “Mark Janssen <>”
gpg: aka “Mark Janssen <>”
gpg: aka “[jpeg image of size 1522]”

I have also updated the old key to expire on 2009/12/31

Solaris 10 as LDAP client (to OpenLDAP 2.4.x)

During the last couple of weeks I’ve been working on getting a central directory setup for my client, running on OpenLDAP 2.4. Not having worked with LDAP a lot before it proved quite a challenge, especially getting Solaris 10 to work with the LDAP server without any glitches.
In this document I’ll try and describe how this setup was made, because I have been unable to find a single consistent document describing all the intricate details.
At this time I have all my problems fixed (AFAIK), but during the setup phase I experienced various problems:

  • Solaris 10 not seeing any users from LDAP
  • Solaris seeing users, but not letting them log in
  • Log-in working from console, but not ssh
  • Passwordless login (pubkey) not working in SUN-SSH
  • Users being able to hack extra permissions for themselves
  • etc…. etc….etc…

The entire article has been moved to a more permanent location, as a page on this site. You can find it under the ‘Pages’ header on the right. Setting up ldap