Note: The Listed platform will permanently shut down December 31, 2026. Your data published on Listed will still be available in your personal Standard Notes account. Learn more

Ubuntu 20.04 (Zorin OS Lite 16)でmouse fp01を使う

去年買ったmicro pcはとてもコンパクトで、Linuxを入れて楽しく使ってる。

モバイル機として使うため、電池持ちが良くなるようCPUのクロック調整など色々設定している。スクリーンロック摩での時間を1分程度にしてるのもその1つ。

ただ、毎回スクリーンロックを解除するためにパスワードをその都度入力するのはスマホに浸った現代人には結構面倒だと思う。

かと言ってパスワード入力なしにするのは、電車に置き忘れたりしたら怖い(前科あり)

だから、スマホみたいに指紋認証で開けられないかなあと思ってた。

調べてたら、mouseのusb指紋リーダーfp01が使えるかもという情報を見つけた。

mouseのfp01は昔買ってあったので引っ張り出してきて指してみた。

aptでfprintdを入れてみるが、fprintd-enrollコマンドがエラーになる。どうやら認識してないようだった。

fp01のなかのモジュールは、LighTuning TechnologyのEGISというものらしく、調べると、libfprint v1.92.1でドライバが追加されているようだった。

が、使用してるOSはUbuntu 20.04ベースであり、20.04のaptから入るのはv1.90.2だった。

原因はこれかと思い、その後、色々やって1.94.xを入れたのだけれど認識はするようになったが指紋を撮ろうとするとエラーになった。


libusbでfp01を詳しく見てみると、先のGitHubのドライバのコードとエンドポイントが違うことに気づいた。

$ lsusb -d 1c7a: -v
Bus 001 Device 011: ID 1c7a:0570 LighTuning Technology Inc. EgisTec Touch Fingerprint Sensor
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1c7a LighTuning Technology Inc.
  idProduct          0x0570 
  bcdDevice           10.10
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               3

Outエンドポイントがドライバでは0x04だけどfp01は0x02、
Inエンドポイントがドライバでは0x83だけどfp01では0x81だった。

これでは撮れるはずもないので、ソースコードからビルドし直した。

リポジトリはgitlabにある。

これは変更したpatch

diff --git a/libfprint/drivers/egis0570.h b/libfprint/drivers/egis0570.h
index 2c8f045..f75ce91 100644
--- a/libfprint/drivers/egis0570.h
+++ b/libfprint/drivers/egis0570.h
@@ -33,8 +33,8 @@
  * Device endpoints
  */

-#define EGIS0570_EPOUT 0x04 /* ( 4 | FPI_USB_ENDPOINT_OUT ) */
-#define EGIS0570_EPIN 0x83  /* ( 3 | FPI_USB_ENDPOINT_IN ) */
+#define EGIS0570_EPOUT 0x02 /* ( 4 | FPI_USB_ENDPOINT_OUT ) */
+#define EGIS0570_EPIN 0x81  /* ( 3 | FPI_USB_ENDPOINT_IN ) */

 /*
  * Initialization packets (7 bytes each)

fprintdはlibfprintを静的リンクしてるのでこっちもビルドする必要がある。

fprintdをビルドするときに先にビルドしたlibfprintの成果物を参照できるように環境変数にPathを入れておく。

export LIBRARY_PATH=/home/iwate/works/fprint/libfprint/build/libfprint:$LIBRARY_PATH

ビルドしたfprintdをインストールしたらfprintd-enroll できるようになった。

めでたしめでたし。

しかもfp01の撮影精度が良くないのでパスワードを毎回入力するほうが早いというオチつき!


余談

mesonとninjaっていうビルドツールを初めて知った。

C/C++のビルドツールはCMake一強って思ってたけど色々出てきてるんだなあ。


You'll only receive email when they publish something new.

More from iwate
All posts