Popax21 / synaTudor

GNU Lesser General Public License v2.1
89 stars 10 forks source link

Support 06cb:0081 #22

Open msterna opened 11 months ago

msterna commented 11 months ago

Hi! I am impressed with your work! I wanted to ask if your package allows you to build drivers for other Synaptics devices? I have a Lenovo Yoga with Synaptics 06cb:0081. I tried to replace the source in the download_driver.sh file with mine: https://download.lenovo.com/consumer/mobiles/f7ye02af.exe Unfortunately, the files look completely different. I tried with your package and overwriting my files, but of course it doesn't work. I understand that your package is not universal and only supports 06cb:00BE? Can you help me somehow or is it too much work for you? I'm not a programmer. I only write tiny programs in Python, so it's too difficult for me. I hope I wrote understandably because I use Google Translator.

Popax21 commented 11 months ago

Hi! I am impressed with your work! I wanted to ask if your package allows you to build drivers for other Synaptics devices? I have a Lenovo Yoga with Synaptics 06cb:0081. I tried to replace the source in the download_driver.sh file with mine: https://download.lenovo.com/consumer/mobiles/f7ye02af.exe Unfortunately, the files look completely different. I tried with your package and overwriting my files, but of course it doesn't work. I understand that your package is not universal and only supports 06cb:00BE? Can you help me somehow or is it too much work for you? I'm not a programmer. I only write tiny programs in Python, so it's too difficult for me. I hope I wrote understandably because I use Google Translator.

At the moment, only 06cb:00be is supported. If you want to add support for 06cb:0081 yourself you are free to do so (I would merge it upstream if it works), however I am fairly busy at the moment + I can't really assist with the intricacies of hardware I do not have access to. You might want to take a look at #20 as a starting point.

msterna commented 11 months ago

I don't understand much, but I'll try. Maybe something will work out :) Thank you for your answer and of course I understand that you don't have the time or opportunity. It's different for me too. Best regards and thank you for your suggestion!

msterna commented 11 months ago

Hello! I was able to modify and build it. However, in the logs I have something like this:

`paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Activated sandbox paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Received init message - USB device 1-3 paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Initialized libcrypto paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Initialized libusb paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [WRN] PE file contains unsupported resource data directory! paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [WRN] PE file contains unsupported exception data directory! paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [WRN] Data directory 4 has invalid bounds! [end 0x36c60 > image end 0x36000] paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Loaded driver DLL 'synaAdvAdapter.dll' [224352 bytes] paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [WRN] PE file contains unsupported resource data directory! paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [WRN] PE file contains unsupported exception data directory! paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Loaded driver DLL 'synaWudfBioUsb.dll' [2337376 bytes] paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [INF] Initializing driver DLL 'synaAdvAdapter.dll'... paź 13 17:10:33 archlinux tudor_host_launcher[42337]: [ERR] Unresolved import called! paź 13 17:10:34 archlinux systemd[1]: Started Process Core Dump (PID 42342/UID 0). paź 13 17:10:34 archlinux systemd-coredump[42343]: [🡕] Process 42337 (tudor_host) of user 3333 dumped core.

                                                Stack trace of thread 42337:
                                                #0  0x00007fcde64ac83c n/a (libc.so.6 + 0x8e83c)
                                                #1  0x00007fcde645c668 raise (libc.so.6 + 0x3e668)
                                                #2  0x00007fcde64444b8 abort (libc.so.6 + 0x264b8)
                                                #3  0x00007fcde6c0e630 unresolved_stub (libtudor.so + 0xe630)
                                                #4  0x00007fcde6fef2ca n/a (n/a + 0x0)
                                                #5  0x00005574ede45493 main (tudor_host + 0x3493)
                                                #6  0x00007fcde6445cd0 n/a (libc.so.6 + 0x27cd0)
                                                #7  0x00007fcde6445d8a __libc_start_main (libc.so.6 + 0x27d8a)
                                                #8  0x00005574ede445b5 _start (tudor_host + 0x25b5)

                                                Stack trace of thread 42341:
                                                #0  0x00007fcde6520f6f __poll (libc.so.6 + 0x102f6f)
                                                #1  0x00007fcde6fd46e5 n/a (libusb-1.0.so.0 + 0x106e5)
                                                #2  0x00007fcde6fd6468 libusb_handle_events_timeout_completed (libusb-1.0.so.0 + 0x12468)
                                                #3  0x00007fcde6fd64bf libusb_handle_events (libusb-1.0.so.0 + 0x124bf)
                                                #4  0x00005574ede446a7 usb_thread_func (tudor_host + 0x26a7)
                                                #5  0x00007fcde64aa9eb n/a (libc.so.6 + 0x8c9eb)
                                                #6  0x00007fcde652e654 __clone (libc.so.6 + 0x110654)
                                                ELF object binary architecture: AMD x86-64

paź 13 17:10:34 archlinux fprintd[42330]: Tudor host process died! Exit Code 134 ` I understand this is a driver error. For some reason it doesn't load. Do I think right? Can you suggest something?

CLI: `

WARNING Even though the CLI employs sandboxing, its security is in no way comparable to the one found in the libfprint integration. A malicious driver could take over your local user account! This CLI is only intended to be used for debugging and/or small scale tests. Press 'y' to continue, any key to exit: y [INF] Initializing libcrypto... [INF] Initializing libusb... [INF] Found sensor USB device [bus 1 addr 3 vid 0x06cb pid 0x0081] [INF] Opening sensor USB device... [INF] Dropping root privileges... [new uid=1000 new gid=984] [INF] Initializing tudor driver... [WRN] PE file contains unsupported resource data directory! [WRN] PE file contains unsupported exception data directory! [WRN] Data directory 4 has invalid bounds! [end 0x36c60 > image end 0x36000] [DBG] DLL synaAdvAdapter.dll: PE+ image [DBG] -> machine: 8664 [DBG] -> image size: 00036000 [DBG] -> entry point: 0000b338 [DBG] -> num data dirs: 16 [DBG] -> num sections: 6 [DBG] -> num relocations: 835 [DBG] Copied image memory to mapping at 0x7f9106772000 - 0x7f91067a8000 [DBG] Applied 835 relocations [DBG] Applying memory protections to image [DBG] -> section .text | 0x7f9106773000 - 0x7f91067941fb | r-x [DBG] -> section .rdata | 0x7f9106795000 - 0x7f910679f6a8 | r-- [DBG] -> section .data | 0x7f91067a0000 - 0x7f91067a3e98 | rw- [DBG] -> section .pdata | 0x7f91067a4000 - 0x7f91067a5e0c | r-- [DBG] -> section .rsrc | 0x7f91067a6000 - 0x7f91067a66c0 | r-- [DBG] -> section .reloc | 0x7f91067a7000 - 0x7f91067a76e0 | r-- [INF] Loaded driver DLL 'synaAdvAdapter.dll' [224352 bytes] [WRN] PE file contains unsupported resource data directory! [WRN] PE file contains unsupported exception data directory! [DBG] DLL synaWudfBioUsb.dll: PE+ image [DBG] -> machine: 8664 [DBG] -> image size: 0023b000 [DBG] -> entry point: 000fadd8 [DBG] -> num data dirs: 16 [DBG] -> num sections: 6 [DBG] -> num relocations: 1945 [DBG] Copied image memory to mapping at 0x7f91049e1000 - 0x7f9104c1c000 [DBG] Applied 1945 relocations [DBG] Applying memory protections to image [DBG] -> section .text | 0x7f91049e2000 - 0x7f9104af531c | r-x [DBG] -> section .rdata | 0x7f9104af6000 - 0x7f9104b9bd80 | r-- [DBG] -> section .data | 0x7f9104b9c000 - 0x7f9104c10cc8 | rw- [DBG] -> section .pdata | 0x7f9104c11000 - 0x7f9104c1832c | r-- [DBG] -> section .rsrc | 0x7f9104c19000 - 0x7f9104c199e8 | r-- [DBG] -> section .reloc | 0x7f9104c1a000 - 0x7f9104c1b0ac | r-- [INF] Loaded driver DLL 'synaWudfBioUsb.dll' [2337376 bytes] [INF] Initializing driver DLL 'synaAdvAdapter.dll'... [ERR] Unresolved import called! Przerwane `

Popax21 commented 10 months ago

The driver tried to invoke a function which currently hasn't been implemented yet. You'll want to use the DBGIMPORT meson option to figure out which one it is, then you would probably have to implement it yourself.

MagneFire commented 2 months ago

I've done some testing with the mentioned driver and https://download.lenovo.com/consumer/mobiles/im7f04af07wp.exe (which seems slightly different).

The reason for the unresolved call is because the driver needs EncodePointer.

Other places where segfaults were observed was in GetProcAddress as it needs a handle to print some information.

I've solved some of these issues and implemented more stub functions. But it does not appear to be enough to get the driver the load.

Here's my work for reference: https://github.com/MagneFire/synaTudor/tree/f/0081. I've decided to base it on the work by @vixalien as it implements some more functions that the driver may require.

At the moment I'm not sure how to debug this any further as the gdb backtrace doesn't reveal much:

(gdb) bt
#0  0x00007ffff7f9ebf8 in ?? ()
#1  0x00007ffff7f9ebbc in ?? ()
#2  0x000055555555bd98 in ?? ()
#3  0x000055555558b2e0 in ?? ()
#4  0x0000555555581e50 in ?? ()
#5  0x00007ffff7f999d5 in ?? ()
#6  0x00007ffff7c43ce8 in _DYNAMIC () from /home/darrel/Downloads/fprint/synaTudor/build/cli/../libtudor/libtudor.so
#7  0x00007ffff7f98e8a in ?? ()
#8  0x0000000000000000 in ?? ()

tudo_cli output: tudor_cli.log

The backtrace appears to look the same regardless of the newly implemented (stub) functions.