mincrmatt12 / elan-spi-fingerprint

prototype linux driver for elantech spi-based fingerprint sensors
38 stars 4 forks source link

Asus Vivobook 14 #5

Closed kenohassler closed 3 years ago

kenohassler commented 3 years ago

Just tested your code on my Vivobook 14 F412FJ, it works! It uses PID 0x30c6 and proto detected sensor ID 0x6, so I added the following line to elanspi_id_table:

{.udev_types = ELANSPI_UDEV_TYPES, .spi_acpi_id = "ELAN7001", .hid_id = {.vid = ELANSPI_TP_VID, .pid = 0x30c6}, .driver_data = ELANSPI_180_ROTATE},

The img-capture example works fine, but enroll does not complete (although it produces an enrolled.pgm). Is this expected?

mincrmatt12 commented 3 years ago

What do you mean by it "doesn't complete"? You should be requested to swipe your finger multiple times, but it might be hard to see it with all the output spam.

kenohassler commented 3 years ago

Oh well, thanks a lot :facepalm: enroll actually works fine, verify does as well :partying_face:

One more thing, I'm not exactly 100% sure about ELANSPI_180_ROTATE. In comparison to ELANSPI_NO_ROTATE, the image is mirrored. Which is correct?

mincrmatt12 commented 3 years ago

Different sensors are installed in different orientations, and the only way to tell is based on the ID of the touchpad. Based on the driver config files, though, the default is a vertical flip and there didn't seem to be a special override for the setup in your laptop (0x30C6) so ELANSPI_180_ROTATE should be the correct setting.

kenohassler commented 3 years ago

Ok, good to know! Thanks for your work on this, I'll close the issue.

shubhamyeola commented 3 years ago

can you explain the detailed procedure on how you got it to work on vivobook x412fj. I have the same model and I am unable to make it work. Also, I am on the latest ubuntu 21.04

kenohassler commented 3 years ago

Thanks for your feedback, sure I can. First, clone this repo and modify TP_PID in proto/hkeyvalue.h. The correct value should be 0x30C6. Now, compile the prototype and try it with ./prototype udev (probably you need to do this as root). For me, it didn't find the device, so I needed to copy udev/99-elan-spi.rules to /etc/udev/rules.d/ and reload the rules (or reboot). After this, the prototype should work.

To get libfprint running, clone mincrmatt12/libfprint and make sure to git checkout mincrmatt12/elan-spi-new. Run:

meson build -D drivers=all
cd build
meson compile

Now, you should have an examples directory containing the binaries I talked about earlier. Test it with ./img-capture (again, you probably need to be root to open the sensor device).

shubhamyeola commented 3 years ago

Hey, thanks you for reply. 1.what you mean by compile the prototype? I just change the value and saved it.

  1. I was not able to find ./prototype udev( even as root) I did copy paste the rules to etc/udev/rules.d and reboot.
  2. what you mean by git checkout mincrmatt12/elan-spi-new, I tried running it in the termainal and got erro fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  3. meson build failed for me , I am attaching logs. meson-log.txt

    Again thanks for helping. I am quite new to linux and learning C nowdays.

kenohassler commented 3 years ago

no problem, I'll explain: You are missing cmake (it says so at the end of your logfile). Not a big deal, install it with sudo apt install cmake. Now, in the elan-spi-fingerprint directory, do:

mkdir build
cd build
cmake ..
make

After this, the build directory you just made contains the prototype. Run it using sudo ./prototype udev and see if it works.

Next, libfprint. Go back to your working directory and git clone https://github.com/mincrmatt12/libfprint. Now, cd libfprint and continue as I described above. If you have more questions, feel free to ask :)

shubhamyeola commented 3 years ago
kenohassler commented 3 years ago

Oh damn, the first one is my bad. You have to be in the prototype sub-directory to build the prototype. btw, don't do sudo mkdir. Root owns the folder after that, you might not be able to write files into it.

The second one basically says you upgraded meson after your first shot. The solution is to reconfigure, not to downgrade meson :wink: In the libfprint directory, do meson --reconfigure. After that, you can go back into the build directory and try meson compile again.

shubhamyeola commented 3 years ago
kenohassler commented 3 years ago
  1. good, it detects your sensor. now run it as root (sudo ./prototype udev) and it should work.
  2. I suspect you ran meson as root before. In the libfprint folder, do sudo rm -rf build and run the meson stuff from the beginning (without sudo!).
shubhamyeola commented 3 years ago

Everything works smoothly as expected. Thank you again. Now in examples I have img-capture.c But, even as root it's giving error image I didn't try sudo this time, should i try it ?

kenohassler commented 3 years ago

Nice! img-capture.c is the source code file, not the compiled program, thus you can't run it. The compiled files are in build/examples. These probably need to be run as root to open your sensor device.

PS: Prefixing sudo runs a program as root - so if you already are in a root shell, it does nothing.

shubhamyeola commented 3 years ago

image

kenohassler commented 3 years ago
shubhamyeola commented 3 years ago
  1. Yes i included _d drivers=all in meson build
  2. git branch result image

Thanks for your feedback, sure I can. First, clone this repo and modify TP_PID in proto/hkeyvalue.h. The correct value should be 0x30C6. Now, compile the prototype and try it with ./prototype udev (probably you need to do this as root). For me, it didn't find the device, so I needed to copy udev/99-elan-spi.rules to /etc/udev/rules.d/ and reload the rules (or reboot). After this, the prototype should work.

To get libfprint running, clone mincrmatt12/libfprint and make sure to git checkout mincrmatt12/elan-spi-new. Run:

meson build -D drivers=all
cd build
meson compile

Now, you should have an examples directory containing the binaries I talked about earlier. Test it with ./img-capture (again, you probably need to be root to open the sensor device).

kenohassler commented 3 years ago

Yes, indeed. The problem here is that the version you compiled doesn't include the driver. Fix it by running git checkout mincrmatt12/elan-spi-new and recompiling with meson compile (in the build directory, of course).

shubhamyeola commented 3 years ago

image

kenohassler commented 3 years ago

nice! :partying_face: I didn't actually try that though. Afaik Ubuntu already has everything needed, so you could try running sudo meson install in the build directory. If it works, this replaces the standard libfprint with the version you made. Check whether you can enroll your fingers in gnome-settings :smiley:

shubhamyeola commented 3 years ago

sadly not working this way

kenohassler commented 3 years ago

Hm, I need to check that out myself. Could take a while

shubhamyeola commented 3 years ago

No problem. Thanks for all the help, I learned a lot of new stuff.

shubhamyeola commented 3 years ago

update: image image

mincrmatt12 commented 3 years ago

Hmm I think there may have been some stuff I changed regarding swipe cancellation which may have caused it to break after a failed attempt, could you get fprintd logs and put them in a new bug over at mincrmatt12/libfprint?

You can turn on the debug logs by passing G_MESSAGES_DEBUG=all to fprintd in its service file.

shubhamyeola commented 3 years ago

Sure, I happy to help. just tell me,

  1. where is fprintd service file located.( I tried searching)
  2. where will logs saved so I can copy them.
mincrmatt12 commented 3 years ago

Sorry for the late reply, I've been a bit busy with other stuff recently.

  1. You should be able to add it by running systemctl edit fprintd.service, and in the editor opened add
    [Service]
    Environment="G_MESSAGES_DEBUG=all"
  2. The logs should be in the systemd journal, use journalctl -u fprintd.service to view them.
ayusc commented 5 months ago

Hi @kenohassler @mincrmatt12 @mincrmatt12 I hope that the post isnt dead. I recently bought this ASUS Vivobook 15 which has the same fingerprint sensor. And i have done all the steps. I have successfully done the part as you have mentioned and all the commands under build/examples are working fine after running sudo ./verify i got a verify.pgm which i could open with display verify.pgm so that means everything is working fine as expected but all now how to setup the fingerprint login ? For your reference i followed this

Also @kenohassler as you said i tried to install the newly built libfprint over the apt installed version but i get the following error (please see the snap) screen

kenohassler commented 3 weeks ago

Hi @ayusc I just read your post. Unfortunately, I don't have the laptop anymore, so I cannot assist with hardware issues.

However, your screenshot looks like a syntax error reported by the compiler. Did you forget inserting a comma? If this is still current, I suggest opening a new issue instead of replying to a closed three-year-old one :wink:

ayusc commented 3 weeks ago

Hi @ayusc I just read your post. Unfortunately, I don't have the laptop anymore, so I cannot assist with hardware issues.

However, your screenshot looks like a syntax error reported by the compiler. Did you forget inserting a comma? If this is still current, I suggest opening a new issue instead of replying to a closed three-year-old one 😉

I fixed and built it and everything works fine but fails at the verification stage, i can enroll the fingerprint but could never verify the enrolled image it always results in verify-no-match and it's still a open issue here. The problem is with these particular inbuilt sensors (on the touchpad) which are really small to capture the small difference between the captured fingerprint images.

I think the libfprint library still need years to properly work on these small fingerprint sensors. Anyways i am using Zorin OS which has inbuilt fingerprint login support which also relies on libfprint, i also introduced the issue in thier forum but they are also helpless, the issue is with libfrint itself. And all the patches you see here are already merged into the main branch of libfprint years ago, still the issue is there...

Big hats off to Windows they really outbeat Linux at this thing.