Author Archives: Daniel Drake

Digital Persona UareU Fingerprint Sensor driver for Linux

I recently mentioned my new project, writing a Linux driver for the “Microsoft Optical Desktop with Fingerprint Reader” keyboard. The keyboard works fine already (its just HID), but the fingerprint reader sensor requires its own driver, which I’m aiming to create.

Thanks to Tony Vroon from Gentoo for donating this device to me, and to the people who sent emails/comments after the last mention of this. Through this information and some extra googling, I now know:

  • The fingerprint sensor is almost certainly designed/manufactured by Digital Persona, a biometrics company recently assimilated by Microsoft.
  • The fingerprint sensor is probably a Digital Persona UareU 4000
  • If this is true, the fingerprint image is encrypted…
  • …but a developer familiar with the UareU Windows API suggests that the encryption key is defined by the host computer at installation time.
  • …and this forum post suggests that the Microsoft keyboard lacks some features of the UareU 4000.
  • The encryption algorithm might be XTEA (source)
  • VALinux Japan have done some biometrics work, including fingerprint-based login using UareU devices. A presentation (html, pdf) suggests that they have produced/obtained a uareu kernel module which has a /dev/usb/uareu char interface. I wonder if they can help me out.
  • The device is firmware-based, or at least, the driver sends a 1904 byte blob of data found inside one of the windows DLL files on every plugin.
  • This guy also seems to have run into the uareu module. Can anyone help me find his email address?

I’m naming my driver dpfp and the initial work can be found here. So far I have created a script to extract the firmware from the windows driver distribution, and a skeleton driver which pulses the light around the sensor 3 times on plugin (looks very cool!). I’m a bit stuck on the next step, the sniffed data suggests the Windows driver is doing things which are impossible (sending data in the wrong direction). I’ve been experimenting trying to guess what it might be doing, but I haven’t been able to provoke the expected response yet (which is the device sending a section of the firmware back to the host computer — again strange…).

If any other Linux users are in possession of one of these keyboards or a standalone UareU reader, then please email me. I will send in an article to linuxbiometrics.com soon.

Update November 2007: I see I’m still getting a lot of hits from “digitalpersona linux” on Google (I’m still #1). I’ve recently launched a new project called fprint which supports DigitalPersona devices under Linux. Click to go to the project homepage.

Alauda driver is complete

The driver

I completed development of the Alauda driver in September and submitted the driver for inclusion to the Linux kernel.

The driver duplicates some code (checksum, media ID table) which is also present in other drivers, and it looks like we want to figure out a good way to share this code before including my work, which is a fair point – we don’t want to duplicate this yet again.

For now I’m publishing my driver as a standalone patch which people can use until we figure out the real integration details. These devices seem to be more common than I originally thought. Patch available here (against Linux 2.6.14).

Juice Box

In true open-source style, a group of hackers have taken my work and used it for something I didn’t design for: hacking the Juice Box – a portable media player based on ucLinux.

From what I gather, these devices boot from a small amount of NAND flash. To customise the device to a decent level, you need to replace this flash with your own.

Fortunately, xD media is basically NAND flash with a slightly different pin configuration, so they have done crazy things such as solder a pre-programmed XD card to the PCB:

However, you can’t just pre-program these XD cards on any old reader/writer. You need to use a device which gives you access to the physical block layout of the media, so that you can write to block 0 (amongst other things). Almost all XD reader/writer devices on the market handle physical block translation in hardware, and only provide a logical block interface to the host operating system, which does not satisfy the needs of these hackers.

The Alauda is probably the most common device that provides physical access, making writing a driver considerably harder, but allowing you to hack the media in ways such as this. I may even donate my spare Alauda device to their project.

Beagle data storage: Lucene 1.9 and SQLite 3

Beagle sure has come a long way in terms of maturity over the last few months.

I’ve been getting involved with Beagle’s interaction with dotLucene which is the C# port of Apache Lucene – a very powerful text search architecture. Beagle stores text content of indexed files within Lucene ‘databases’ and uses Lucene’s impressive search features to query on behalf of the user.

We previously used dotLucene 1.4.3 within Beagle, but I recently upgraded us to 1.9 RC1. Beagle is mostly unaffected by the changes, but there are some bug fixes and optimizations included. Perhaps the biggest win was the result of my extensive testing to make sure the upgrade didn’t break anything – I did identify and fix two bugs, and they were both also present in the 1.4 code.

The first bug was a file descriptor leak in a common code path (inside Beagle code), and the other, a fairly significant locking bug which was causing the locking often to not be having any effect at all. This explains some of the strange behaviour that has cropped up time to time in the past which we’ve never been able to pinpoint.

I also looked at some traces through the codepaths. I noticed that dotLucene was dealing with throwing and catching exceptions a hell of a lot – hundreds of exceptions being dealt with while indexing a small range of files. dotLucene was using exception catching where simple if/else combinations would work just fine. Exception handling is expensive as the runtime must jump through hoops keeping track of where to jump to if a certain type of exception occurs, so by greatly reducing the amount of exception handling that takes place, we have a nice small optimization in place.

After landing dotLucene 1.9, I’ve now turned some attention to another aspect of Beagle’s data storage mechanism. Beagle uses SQLite to store file attributes when extended attributes are not available, and for its file text cache.

Currently, Beagle only uses SQLite 2.x. Attempting to ‘port’ it to SQLite 3 revealed a problem in our SQLite interaction. You must always query a SQLite database from the same thread that the connection was originally established. Beagle is multi-threaded and we are using the same connection over multiple threads, which is (apparently) unsafe, and SQLite 3 explicitly checks this and returns error if you go beyond the original thread.

This creates a non-trivial problem to solve, and is a poor design decision from the SQLite developers. We’re going to stick with SQLite 2.x-only, as it seems to work just fine even despite sharing the connection over our thread pool. SQLite 3 wouldn’t bring any major benefits to us, and we are unable to use it due to its new explicit thread checking restriction. Sigh.

various stuffs

2.6.13 is almost ready to go stable in Gentoo, especially now that the evil AMD64 SMP bug has been solved (this also affected the last few kernel releases).

Beagle 0.1.0 is out, the result of much hacking from all directions over the summer. The release announcement pretty much says it all. On a sidenote this will be available in Gentoo’s package tree sometime soon.

Alauda driver is pretty much finished – reading, writing, hotswapping – to both XD and SmartMedia cards, even simultaneously, on 2 devices at the same time. The only problem right now is that a tester has reported reading of 8mb smartmedia does not work – this is difficult to track down as I do not own any cards this small, and the address space is different on this media (but the driver is written so that this should work…)

I’ve been donated a MS keyboard with fingerprint reader with the task of getting the fingerprint reader working on Linux. There is a major complication here though, the device appears to simply send an image of the fingerprint to the host computer, but the I think the image is encrypted. Can’t be an impossible problem to solve, right?

Regarding the spam-attacks on the Gentoo hosted weblogs, I can globally remove and blacklist spam (based on keyword or URL) very easily so please just report it to me. If anyone knows of good ways to automatically combat spam in b2evolution or feels like hacking something up then please let me know. I’m not too fond of the “type the letters from this image” schemes, but something like an additional confirmation screen (where the user just has to click a button) if the user included 3 or more URL’s in the same comment would probably confuse the spambots enough to quieten things down.

Update: Missed this earlier, but it looks like the new b2evo release has improved antispam capabilities. Will see how this turns out…

I’ll be offline for a while as of Monday, moving back up to Manchester into a new house to start my 2nd year of university.

Alauda driver now reads all XD

Quick update on the Alauda driver status:

Figured out the rest of the block addressing, so it can now support more card sizes. It also should detect the media size automatically and work “out of the box”, at least it does with the two XD cards I have here.

XD media reading is now pretty much complete, except for a few performance improvements which will be made at a later date. Next up I’ll be getting my hands on some SmartMedia and implementing read support for that.

Code is available from SourceForge CVS.

entagged-sharp in Beagle

I’ve recently been hacking on entagged-sharp, a C# library for extracting tags from audio files. This is used in Banshee, Muine, and probably some other projects too.

It provides a nice simplistic interface for extracting tags, e.g.:

AudioFileWrapper afw = new AudioFileWrapper("/path/to/audio.file");
Console.WriteLine("{0} - {1}", afw.Artist, afw.Title);

…and this will “just work” for all of the audio file formats that are supported.

I worked on extending the AudioFileWrapper interface, reducing internal abstraction, MIME support, unit tests, bug fixing, and adding Amiga module audio file support. ASF/WMA tag filtering is coming soon.

entagged-sharp has now been imported into Beagle CVS, replacing the filtering code we had previously. This pretty much closed all the audio-filtering bugs that we had, and added support for more formats (m4a, m4p, xm, sm, it, mod). Hopefully nothing broke at the same time :)

Linux 2.6.13

2.6.13 is here and will soon be in Portage (as testing) for Gentoo users. One thing that will almost certainly cause disruption is that devfs has finally been removed from the kernel, so you pretty much must use udev. If you don’t have udev installed, it will be installed as a dependency of the 2.6.13 kernels, so hopefully the problems should be minimized and udev will just work when you reboot.

Some more of the notable changes I’ve been following since 2.6.12:

  • inotify is now included, which is a mechanism where the kernel tells user-space when a file or directory changes. Very useful for those situations where applications need to watch for a file or directory change, which is common.
  • kexec – optional fast reboots which don’t need to fully reboot and go through all the BIOS initialization again, another kernel is booted directly from the old one.
  • skge is now included, a driver for SysKonnect Yukon network adapters which actually works (a driver for Yukon-II adapters, sky2, will hopefully be included in 2.6.14)
  • it8212 is finally included, a driver for a popular IDE RAID adapter found on many motherboards
  • HZ (frequency of timer interrupt) now defaults to 250 (ticks per second) and is configurable, which might increase battery life on laptops, but this change is still under debate
  • Lots of bug fixes, new hardware support, more drivers, and other stuff which I have missed

AFFS Annual Conference

Gentoo UK were invited to attend the AFFS Annual Conference at short notice. Myself, George (cokehabit), Rob (tigger), Stuart, and Tim (plasmaroo) attended, and Tim did a nice talk titled ‘Introduction to Gentoo’. There were also talks on software patents, Hula, and Debian.

There weren’t many people there – the event didn’t seem very well publicized, yet we met a few happy users and met with AFFS for the first time. Look out for more info in the next Gentoo newsletter.