libfprint-CS9711 icon indicating copy to clipboard operation
libfprint-CS9711 copied to clipboard

Add support for Chipsailing 2541:2549

Open ifeign opened this issue 9 months ago • 13 comments

Would it be possible to add support for the Chipsailing sensor with hwid 2541:2549? I've tried simply adding it to the driver in my own fork, and while it did show up when i ran fprintd-enroll, it wasn't actually functional.

Is there any information I can gather from my fingerprint reader that can help get it working?

I did find this Ubuntu driver for the fingerprint reader, but I am on Arch. Currently seeing if the .so files contained are of any use: https://en.ab2cd.com/Download.aspx?ClassID=27

I've uploaded the .so files for your convenience. They were pulled from the v22.04.deb file 2549-so-files.zip

ifeign avatar Feb 11 '26 22:02 ifeign

I found a slightly newer version of the driver (1.0.3) on the Chinese version of the website (ironically still in English): http://www.ab2cd.com/download.html

Uploaded the .so files from this one too, this time from the Ubuntu 24.04 deb

1.0.3-so-files.zip

ifeign avatar Feb 12 '26 17:02 ifeign

Looking briefly at disassembly it seems to use a different image resolution (112x88, probably still would work best with sigfm algorithm, but driver code needs to be adapted). The protocol is not clear to me, I think it would be easiest to debug the CS9711 driver on it and see where errors/deviations start to happen.

I did find this Ubuntu driver for the fingerprint reader, but I am on Arch. Currently seeing if the .so files contained are of any use

I know that would be far from ideal, but you can also create an AUR package that installs those files.

archeYR avatar Feb 17 '26 00:02 archeYR

I have attempted to create my own pkgbuild for this driver, but because I'm far from an expert I couldn't get it to work. I'll take another stab at it.

As for debugging the CS9711 driver, what information can I provide to you that could help?

I forgot to share the error from my fork of your repo where I simply added the HWID:

journalctl -f -u fprintd
Feb 11 15:47:17 GamingPCLinux fprintd[4800]: Device reported an error during identify for enroll: Init: expected 8 bytes but got 72 
Feb 11 15:47:20 GamingPCLinux fprintd[4800]: Got different state response than expected, continuing anyway
Feb 11 15:47:34 GamingPCLinux fprintd[4800]: libusb: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
Feb 11 15:47:34 GamingPCLinux fprintd[4800]: libusb: error [do_close] A cancellation hasn't even been scheduled on the transfer for which the device is closing
Feb 11 15:48:17 GamingPCLinux systemd[1]: fprintd.service: Deactivated successfully.
Feb 11 15:48:20 GamingPCLinux systemd[1]: Starting Fingerprint Authentication Daemon...
Feb 11 15:48:20 GamingPCLinux systemd[1]: Started Fingerprint Authentication Daemon.
Feb 11 15:48:20 GamingPCLinux fprintd[5063]: Got different state response than expected, continuing anyway
Feb 11 15:48:34 GamingPCLinux fprintd[5063]: libusb: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
Feb 11 15:48:34 GamingPCLinux fprintd[5063]: libusb: error [do_close] A cancellation hasn't even been scheduled on the transfer for which the device is closing

ifeign avatar Feb 17 '26 00:02 ifeign

Feb 11 15:47:17 GamingPCLinux fprintd[4800]: Device reported an error during identify for enroll: Init: expected 8 bytes but got 72 
Feb 11 15:47:20 GamingPCLinux fprintd[4800]: Got different state response than expected, continuing anyway

That tells us that this device uses a different type/length of response packets too. I am afraid I don't have time to reverse it, and without owning the device it's a much more tedious process. I would welcome the contribution though if you're able to take on this.

archeYR avatar Feb 17 '26 09:02 archeYR

I'm unfortunately not a developer so I'm not sure how much help I could be. Just for your reference, this is the reader I'm using

It seems the best approach currently is to try to repack the .deb driver to work on Arch. (Or I just buy a new fingerprint reader that will work.)

I am willing to provide you with the hardware to make things easier to reverse engineer if you are interested, because I think your open source driver is far more beneficial for the Linux community than some hard to find proprietary driver on a manufacturer website

ifeign avatar Feb 17 '26 13:02 ifeign

I am willing to provide you with the hardware to make things easier to reverse engineer if you are interested, because I think your open source driver is far more beneficial for the Linux community than some hard to find proprietary driver on a manufacturer website

This isn't really my driver, it was originally written by ddlsmurf. I overtook the project because original author did not have the device anymore, however due to lack of time I am only committed to maintain the existing code and eventually prepare it for upstream. So while I appreciate your offer, I am afraid I cannot spare enough free time for another project. Sorry.

archeYR avatar Feb 17 '26 20:02 archeYR

I am willing to provide you with the hardware to make things easier to reverse engineer if you are interested, because I think your open source driver is far more beneficial for the Linux community than some hard to find proprietary driver on a manufacturer website

This isn't really my driver, it was originally written by ddlsmurf. I overtook the project because original author did not have the device anymore, however due to lack of time I am only committed to maintain the existing code and eventually prepare it for upstream. So while I appreciate your offer, I am afraid I cannot spare enough free time for another project. Sorry.

Understood. Thank you for taking a look at this in the first place.

I'll have to try the other drivers or move on to different hardware.

ifeign avatar Feb 17 '26 22:02 ifeign

@ifeign To write this driver I used wireshark USB interception and tested results using this html https://gist.github.com/ericlinagora/271ea7290507c0b0ad72b550e819357b . If you get that to work with your device it should be very easy to adapt the driver. Hope this helps sorry I can't do more. Disassembling the windows drivers was a complete waste of time when I wrote this, fyi, but I'm not good at that so maybe I was wrong.

edit: here are all the links that helped make it https://gitlab.freedesktop.org/libfprint/libfprint/-/issues/610 (including the udev shit to get the html working)

ddlsmurf avatar Mar 01 '26 08:03 ddlsmurf

@ifeign To write this driver I used wireshark USB interception and tested results using this html https://gist.github.com/ericlinagora/271ea7290507c0b0ad72b550e819357b . If you get that to work with your device it should be very easy to adapt the driver. Hope this helps sorry I can't do more. Disassembling the windows drivers was a complete waste of time when I wrote this, fyi, but I'm not good at that so maybe I was wrong.

edit: here are all the links that helped make it https://gitlab.freedesktop.org/libfprint/libfprint/-/issues/610 (including the udev shit to get the html working)

Thank you for all this info! I'll give it a try once I read through that gitlab issue. Hopefully this works

ifeign avatar Mar 01 '26 13:03 ifeign

Just commenting to keep this alive, I tried to implement the Ubuntu driver I mentioned, into my Arch install, I was able to get to the point where it would let me scan my fingerprint but then it wouldn't accept any reads of my finger afterwards. I should probably just spin up a Ubuntu instance to see if it actually works there.

It's now time to attempt the HTML method. I would really like to get this thing working

ifeign avatar May 26 '26 15:05 ifeign

Since this issue keeps coming back: 2541:2549 works now. It is implemented in #15, and I got it running end to end on Ubuntu 26.04 with two small fixes on top (interface claim + a memset size, both described in my comment over there). Writing up what the device actually is, because "add the VID/PID to the driver" is not enough — that is exactly the dead end described above.

What the device exposes

lsusb → 2541:2549 AB2CD.COM USB FingPintAcl16, three interfaces:

# interface purpose
0 HID, HID1CTR vendor control channel
1 vendor-specific ff/a0/b0, bulk OUT 0x01 / IN 0x81, FpmDevAcl16 fingerprint sensor
2 HID, HID2SKF second vendor channel

The fingerprint endpoints are on interface 1, while dev_open() in the CS9711 driver claims interface 0 — so the first thing that has to change is the claimed interface, otherwise you get the "it shows up in fprintd-enroll but nothing works" behaviour.

Frame format (and why the vendor-.so estimate was off)

Earlier in this issue the resolution guessed from disassembling the vendor .so was 112×88. The frame the device actually sends is a single 8192-byte bulk transfer: 112×73 grayscale (8176 bytes) + 16 bytes of padding, no de-interleave.

That matters: feeding those bytes through the CS9711 68×118 de-interleave produces a scrambled image that no matcher will ever accept — which is what "it lets me scan but never accepts the finger" looks like from the outside.

Two more protocol details worth knowing if anyone debugs further:

  • each frame can be preceded by an 8-byte command echo (ea <type> 00 00 00 00 <type> ea) that has to be skipped;
  • after a frame the device leaves extra bulk data queued, so the next INIT read has to drain the pipe first — without that, enrollment dies with Init: expected 8 bytes but got 72, the same error quoted above.

Build

Works from a plain checkout of this repo plus #15 and my two fixes:

git clone https://github.com/archeYR/libfprint-CS9711
cd libfprint-CS9711
git pull https://github.com/codingkoala/libfprint-CS9711 cs9711-acl16-guard

meson setup builddir -Ddrivers=cs9711 -Dlibdir=lib \
    -Dudev_rules=disabled -Dudev_hwdb=disabled \
    -Ddoc=false -Dinstalled-tests=false -Dgtk-examples=false \
    -Dintrospection=false
meson compile -C builddir
sudo meson install -C builddir
sudo ldconfig
sudo systemctl restart fprintd

Dependencies: the usual build deps plus libgusb-dev, libjson-glib-dev and libopencv-dev — the Acl16 path uses sigfm (SIFT + BFMatcher), so OpenCV is mandatory, not optional. On Debian/Ubuntu -Dlibdir=lib puts the library in /usr/local/lib, which is already in the linker path. On Arch that directory is not searched by default — the patched library installs fine but the distro libfprint keeps winning and fprintd still reports no devices. Fix is a one-line /etc/ld.so.conf.d/00-cs9711-local.conf containing /usr/local/lib plus ldconfig (same trap as the installer project hit).

Then:

fprintd-enroll    # 15 stages, press sensor: one touch per stage
fprintd-verify    # -> verify-match

Result

Enrollment completes and fprintd-verify matches on repeated presses. It is a small press sensor, so the finger has to cover the whole 112×73 area — per the PR author, 54 of 105 same-finger pairs scored at or above the default threshold, so expect the occasional retry rather than a 100 % hit rate.

@ifeign this should be testable on Arch as-is; the only distro-specific step is the linker path above. Worth a try before spending more time repacking the vendor .deb.

codingkoala avatar Oct 31 '26 23:10 codingkoala

Wow this is great news! I will test it ASAP

ifeign avatar Oct 31 '26 23:10 ifeign

@ifeign a few Arch-specific things so you do not lose time:

sudo pacman -S --needed base-devel git meson ninja libgusb json-glib gudev pixman openssl opencv

Then the build from my comment above, plus -Dintrospection=false (I just added it there too — Arch does not pull gobject-introspection by default and meson setup fails without it).

The step that actually decides whether this works on Arch is the linker path, because -Dlibdir=lib installs to /usr/local/lib and Arch does not search that directory:

echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/00-cs9711-local.conf
sudo ldconfig
strings "$(ldconfig -p | awk '/libfprint-2\.so\.2 /{print $NF; exit}')" | grep -c acl16

That last line must print a number greater than 0. If it prints 0, fprintd is still loading Arch's /usr/lib/libfprint-2.so.2 and nothing else you do will matter — that is the "installs fine, fprintd still sees no devices" trap.

Then check the device is actually enumerated by the daemon:

sudo systemctl restart fprintd
dbus-send --system --print-reply --dest=net.reactivated.Fprint \
  /net/reactivated/Fprint/Manager net.reactivated.Fprint.Manager.GetDevices

You should get an object path back (/net/reactivated/Fprint/Device/0). An empty array means it is not being picked up. After that, fprintd-enroll — 15 presses, one per stage, and the finger has to cover the whole sensor area — then fprintd-verify.

One thing to check before starting: if you still have the repacked vendor .so from ab2cd.com installed anywhere in the linker path, remove it first — otherwise you will be testing that instead of this.

If something fails, journalctl -u fprintd -n 50 right after the failing attempt is usually enough to tell which side of the pipe it died on.

codingkoala avatar Nov 01 '26 00:11 codingkoala