Using your EID on opensuse 12.1

In Belgium you can use your EID to login onto the federal portal for using electronic services, for example, for filing tax return. Installation instructions are provided for Windows, Mac and (Ubuntu) Linux. This is what I had to do to get it working on opensuse 12.1 on a Dell Precision M4600.

Installation

smartcard reader

Since the M4600 is a fairly new model, I had to upgrade my pcsc/ccid package to the latest version. It seems the M4600 comes with a Broadcom Corp 5880 smartcard reader which is connected through USB (internally).

Add the chipcard repo:

sudo zypper ar -r http://download.opensuse.org/repositories/security:/chipcard/openSUSE_12.1/security:chipcard.repo

and “switch system packages” in Yast. You should have installed at least the following packages: pcsc-lite, libpcsclite1 and libpth20.

Depending on your smartcard reader, you need a different pcsc plugin package. The Broadcom 5880 smartcard reader is supported through the ccid driver. This means we have to install the pcsc-ccid package from the chipcard repo.

eid middleware

Add the following repo by Pascal Bleser:

sudo zypper ar -r http://download.opensuse.org/repositories/home:/pbleser:/belgium-eid/openSUSE_12.1/home:pbleser:belgium-eid.repo

and install the eid-mw package. I also noticed the eid-mw-firefox package in this repo, but it did not seem to work in my case, possibly because I’m using 64-bit firefox.

configuring firefox

  • Install the belgium eid firefox add-on.
  • Trust Belgium Certificate Authority: Edit menu -> Preferences -> Advanced -> Encryption -> View Certificates -> Authorities -> Belgium root CA2 -> Edit trust -> check all checkboxes
I’m not sure whether the firefox add-on is really needed. Afterwards I uninstalled it and it kept working.

Troubleshooting

smartcard reader

  • check in /var/log/messages which device you have
  • most devices are connected through usb protocol. Check your usb device list:
    lsusb -v
  • google the device or check the device compatibility lists of the pcsc-<driver> packages. You can find the ccid device list here.
  • if you have a pccard interface for your reader, check whether the device is installed with:
    pccardctl ls
  • install the pcsc-tools and perl-pcsc package to have access to some smartcard reader analysis tools. Running the pcsc_scan tool should yield similar output like this:
  • If you get a segfault when loading the pcsc-ccid driver, for example:
    pcscd[3228]: segfault at 0 ip 00007f98bec38121 sp 00007fff2e806208 error 4 in libc-2.14.1.so[7f98bebb8000+187000]
    check whether you updated your portable thread library with the one in the chipcard repo (package name is libpth20)
  • be sure to be using all the packages from the chipcard repo by using the “switch system packages”.
  • firmware upgrade as suggested here, was not necessary. Read the whole thread to find out why a ccid upgrade was actually necessary.

eid middleware

The government created an application eid-viewer which you can use to read some public data from your EID. It’s a java-based app so you need a java JRE to run it:

java -jar eid-viewer-4.0.4-146_tcm227-178503.jar

You can obtain it from this page under the catory “other”.

firefox

Although I installed this add-on, I don’t believe it is needed. I did have trouble the first time I signed in: it succeeded, but redirected me to a page where I would again need to choose whether I wanted to sign on with EID or password. I closed firefox, and tried again, this time it just worked. You can surf to this test page to test whether everything is configured correctly.

Query recently installed rpm’s

Last night I was fooling around with lwjgl (nice lib btw), when suddenly I started getting the following exception:

org.lwjgl.LWJGLException: Could not choose GLX13 config
	at org.lwjgl.opengl.LinuxDisplayPeerInfo.initDefaultPeerInfo(Native Method)
	at org.lwjgl.opengl.LinuxDisplayPeerInfo.(LinuxDisplayPeerInfo.java:61)
	at org.lwjgl.opengl.LinuxDisplay.createPeerInfo(LinuxDisplay.java:782)
	at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)
	at org.lwjgl.opengl.Display.create(Display.java:871)
	at org.lwjgl.opengl.Display.create(Display.java:782)
	at org.lwjgl.opengl.Display.create(Display.java:764)

I googled and some Minecraft stuff turned up (seems it uses lwjgl as well), but only with mysterious “solutions”. I thought it was because I tried to run it from console (it ran fine before in IntelliJ), but it stopped working there too. Then I suspected mixing openjdk compiled code run by sun jre was the problem (seems lwjgl requires sun jre). Than I fumbled around with the java.library.path variable because it looked like a 64bit vs 32bit issue. NONE OF THAT!
I screwed up and it was late, so I decided to admit my defeat and go to bed.

Today I started my suse box, suddenly I realized my KDE desktop effects were disabled. Nvidia driver borked? Reinstalled my nvidia, even rebooted, all in vein!
I checked hardware acceleration with Urban Terror, smooth gaming!

Then I started to retrace my steps of last night.. I tried to install glc which in the past had proven to be quite a decent opengl capture program for linux.

I checked my repos and noticed I accidentally installed the 12.1 version! Uninstalling that does not fix it of course, probably some dependency messed up things good (although still quite subtle to keep everything else working ;)).

I finally come to the point of this post 😉 I wanted to know what I installed last night in the late hours that seriously borked my system.

Turns out rpm has a neat option just for that: –last !
So it goes like this:

# rpm -qa --last | less

yields amongst others:

libcurl4-7.21.2-10.11.1                       Mon 30 Jan 2012 11:06:02 PM CET
libcurl4-32bit-7.21.2-10.11.1                 Mon 30 Jan 2012 11:06:02 PM CET
glibc-locale-2.14.1-14.18.1                   Mon 30 Jan 2012 01:46:16 AM CET
glibc-devel-2.14.1-14.18.1                    Mon 30 Jan 2012 01:46:11 AM CET
parallel-printer-support-1.00-5.1             Mon 30 Jan 2012 01:46:10 AM CET
glibc-2.14.1-14.18.1                          Mon 30 Jan 2012 01:46:08 AM CET
gpg-pubkey-b185393d-47965930                  Mon 30 Jan 2012 01:45:55 AM CET
phpMyAdmin-3.4.9-30.1                         Thu 19 Jan 2012 09:22:30 PM CET

I managed to fubar my glibc 🙂 culprit found! Reverting this to the previous version fixed it!

Extra keywords: query rpm history

Add new harddisk on the fly

So you have this linux box and you want to add an extra harddrive without having to reboot it. The key command we’re looking for, is a way to rescan the scsi bus. This can be achived by rewriting some values in the /sys synthetic filesystem:

echo "- - -" > /sys/class/scsi_host/host#/scan

Replace the digit for the scsi host as appropiate.

If everything went well, you should get output on the console indicating it detected a new hard drive.

Android USB debugging on openSUSE 11.4

Debugging your android app using a hardware device has several advantages, ie faster and more testing possibilities. On windows you have to install a custom USB driver, on linux it’s a matter of configuring your udev rules:

  • add a rules files in /etc/udev/rules.d , ie 44-android.rules
  • enter a line like this:
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="users"

    and adapt the vendor id using this table.

  • Reload udev rules: udevadm control --reload-rules

When you run adb devices, it should now list your device:

List of devices attached 
emulator-5554   device
SH14FPL06953    device

Before, you would rather have something like this:

List of devices attached 
emulator-5554   device
????????????    no permissions

On succesful connection, the system log shows something like:

kernel: [11172.551464] usb 2-1: USB disconnect, address 4
kernel: [11178.813044] usb 2-1: new high speed USB device using ehci_hcd and address 5
kernel: [11178.942137] usb 2-1: New USB device found, idVendor=0bb4, idProduct=0c87
kernel: [11178.942150] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: [11178.942157] usb 2-1: Product: Android Phone
kernel: [11178.942162] usb 2-1: Manufacturer: HTC
kernel: [11178.942166] usb 2-1: SerialNumber: SH14FPL06953
kernel: [11178.943867] scsi8 : usb-storage 2-1:1.0
mtp-probe: checking bus 2, device 5: "/sys/devices/pci0000:00/0000:00:04.1/usb2/2-1"
mtp-probe: bus: 2, device: 5 was not an MTP device
kernel: [11179.953172] scsi 8:0:0:0: Direct-Access     HTC      Android Phone    0100 PQ: 0 ANSI: 2
kernel: [11179.953375] sd 8:0:0:0: Attached scsi generic sg4 type 0
kernel: [11179.961631] sd 8:0:0:0: [sdd] Attached SCSI removable disk

Note that it seems normal that a usb storage device is detected, although I did not have it enabled on the phone.

Mouse locating kwin effects

Ever felt lost on your desktop? Or more precisely: unable to find your mouse pointer within a (few) second(s)? I know I have, and nowadays on 2 monitors or more (or a huge 48″ tv), this isn’t an exception.

In KDE, we always had the track mouse effect which draws circling yellow stars around your pointer. Unfortunately, this is not adequate anymore. That’s why I thought it would be fun to write my own effect which would do a better job. The key to success seems to me that it should be a full screen effect drawing the attention to the right spot no matter where at the screen you’re looking.

For now, I’ve devised 3 effects:

  1. Looney tunes zoom: fancy term for describing an effect which darkens the background and zooms in on the cursor with a spotlight. I somehow associated that with intro or outro from looney tunes, not sure if that makes sense. :p
  2. Sunray: animates some kind of rays around the mouse position.
    kwin sunray mouse locate effect
  3. Radial texture animation: least fancy name, as it is so generic. 🙂 It just animates a texture from outer to inner. The concrete application is to show arrows pointing to the mouse.
    kwin arrow mouse locate effect

For the last 2 effects, I don’t have screencasts yet, don’t ask, I’ve been through hell to create the first one. Also, for the last one, I have to fix the texture uv map generation, or use a better mesh (or maybe a different technique 🙂 ).

Convert PDF to image files

Another entry in my PDF series. 🙂

At work I had to convert a few PDFs into jpeg files. The PDF files actually contain just images, so extracting the images would’ve been as good, but converting PDF pages to images is easier. 🙂 At least on windows. On linux you could use pdfimages, which should be available for your distro through some poppler util package.

A general approach is to use the versatile ImageMagick software. Using the convert command, it’s simply a matter of:

convert -density 200x200 -quality 85% inputfile.pdf outputfile%03d.jpg

to convert inputfile.pdf to a set of jpeg files. Of course you can choose any supported output format you like: png/bmp/gif/etc.. The density option is important as it specifies the output dpi which is only 72 by default. Imagemagick uses Ghostscript to do the pdf reading, so on windows you have to make sure that environment is set up correctly. In my case I had to add its bin directory to the path and set the working dir to the lib path as it didn’t find gs_init.ps otherwise (adding to the path didn’t help). If you know a better way, please let me know in the comments. I also specified the quality option to have a jpeg quality factor of 85, which is 75 by default.

Since I had to process a batch of them, I thought it would be nice to have a cool batch script to do them automatically. Here is what I came up with:

C:
set path=%path%;C:\programs\gs\gs8.54\bin
cd C:\programs\gs\gs8.54\lib
for %%C in (%*) do call :startconvert %%C
goto :eof

:startconvert
convert -density 200x200 -quality 85%% %1 %~dp1%~n1%%03d.jpg
goto :eof

Replace the paths as appropiate. To use the bat file, simply drag and drop one or more pdf file on the bat file. It will put jpeg files in the same directory as the pdf file and number them using 3 digits (%03d printf format). %~dp1 stands for the full path of the 1st argument file, %~n1 for the name only (without extension). Also note you have to escape all other %’s.

Getting mic to work with NVidia VT1708S

Ever since I installed opensuse 11.3, I hadn’t used my mic/headset. Today I decided to fool a bit around in Ardour, but somehow my mic didn’t work. And alas, I made a classic beginner’s mistake: “the solution has to be difficult because it does not work out of the box”.

I tried the standard stuff like trying out all input sources, adding hidden channels, etc. but when that didn’t help I was quickly diving into custom .asoundrc configuration, arecord/aplay sysinfo scripts, probing kernel modules, looking into alsa upgrade scripts and the like.. 🙂

Until I had an epiphany while reading random forum post words. I had been adding the “hidden” channels to my mixer which indeed included “mic” and “front mic” with accompanying boost controls. I noticed a few others which I threw in as well for good measure. I neglected them though, as I didn’t feel interested in enabling “smart” 5.1 or IEC958 2, whatever that was. But then I suddenly remembered: motherboards come with configurable audio backpanels, so this wasn’t really about enabling a fancy audioprocessing feature but rather switching between the 5.1 and standard audio panel, duh!

Apparently, the 5.1 was enabled by default, so “muting” it solved my problem!

Btw, in case you wonder: the HDA NVidia VT1708S chipset is actually a HDA Intel chipset with VIA codec, hence the VTxxxx name. To keep things intesting. 😉