Blub / netevent

Input-Event device cloning utility. Use it together with ssh/netcat/... to share input devices among different machines.
GNU General Public License v2.0
148 stars 14 forks source link

`error: failed to upload device info: Invalid argument`. #30

Open twaik opened 1 year ago

twaik commented 1 year ago

Hi. I've configured netevent for Android with this build script

cmake_minimum_required(VERSION 3.24)
project(netevent)

set(CMAKE_CXX_STANDARD 20)

add_executable(netevent src/main.cpp src/reader.cpp src/writer.cpp src/socket.cpp src/bitfield.cpp src/daemon.cpp)
target_compile_options(netevent PRIVATE "-DNETEVENT_VERSION=\"2.2.1\"" "-static")
target_link_options(netevent PRIVATE "-static")

And compiled it with this script

#!/bin/sh
ABI=arm64-v8a
NDK=/home/twaik/Android/Sdk/ndk/25.1.8937393
mkdir -p $ABI
touch ./src/config.h
cmake -H$ABI -DCMAKE_SYSTEM_NAME=Android -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_SYSTEM_VERSION=26 -DANDROID_PLATFORM=android-26 -DANDROID_ABI=$ABI \
      -DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_NDK=$NDK -DCMAKE_ANDROID_NDK=$NDK -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
      -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$ABI -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$ABI -DCMAKE_BUILD_TYPE=Debug -B$ABI -GNinja -S.

I know, this code is pretty rude and straightforward but it works.

I used this command to instantiate device's touchscreen as a touchpad.

/data/local/tmp/netevent cat /dev/input/event4 | /data/local/tmp/netevent create

It works fine on Samsung SM_A042F, but fails to run on Samsung SM_G780F with the following error:

error: failed to upload device info: Invalid argument

I do not know if there is a debug mode so I extracted everything I could.

twaik@twaikpc:~$ adb -s RZ8R129GXAA shell /data/local/tmp/netevent show /dev/input/event2
KEY:143:1
SYN:0:0
KEY:143:0
SYN:0:0
ABS:57:30397
ABS:48:3
ABS:50:3
ABS:53:697
ABS:54:1291
KEY:330:1

twaik@twaikpc:~$ adb -s RZ8R129GXAA shell /data/local/tmp/netevent cat /dev/input/event2 | hexdump
0000000 0400 0200 454e 4832 6c65 6f6c 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0100 0000
0000020 5c04 5000 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0000 0000 6573 5f63 6f74 6375
0000040 7368 7263 6565 006e 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
0000080 0000 0000 0000 0000 1800 0000 0000 0000
0000090 1f00 000b 0002 0003 0000 0000 0000 0000
00000a0 0000 0000 0000 0000 8000 0000 0000 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0400 0000 0000 0000 0000 0000 0000 0000
00000d0 0080 0000 0000 0000 0000 0000 0000 0000
00000e0 0000 0000 0000 0000 0000 0000 0000 4000
00000f0 0000 0000 0000 0000 4000 0003 0000 8000
0000100 4267 4000 0100 0000 0000 0000 0000 0000
0000110 0000 0000 0000 3704 0000 0000 0000 0000
0000120 0000 0000 0000 0000 0000 0000 0000 5f09
0000130 0000 0000 0000 0000 0000 0000 0000 0000
0000140 0000 0000 0000 0900 0000 0000 0000 0000
0000150 0000 0000 0000 0000 0000 0000 0000 ff00
0000160 0000 0000 0000 0000 0000 0000 0000 0000
0000170 0000 0000 0000 ff00 0000 0000 0000 0000
0000180 0000 0000 0000 0000 0000 0000 0000 ff00
0000190 0000 0000 0000 0000 0000 0000 0000 0000
00001a0 0000 0000 0000 3704 0000 0000 0000 0000
00001b0 0000 0000 0000 0000 0000 0000 0000 5f09
00001c0 0000 0000 0000 0000 0000 0000 0000 0000
00001d0 0000 0000 0000 ffff 0000 0000 0000 0000
00001e0 0000 0000 0000 0000 0000 0000 ffff ffff
00001f0 0000 0000 0000 0000 0000 0000 0000 0000
twaik commented 1 year ago

In the case if I am building netevent with HAS_UI_DEV_SETUP flag I am getting the following error:

error: failed to setup device axis information: Invalid argument
twaik commented 1 year ago

Interesting thing. When I am trying to pass touchscreen of other devices to this device it actually works.

Blub commented 1 year ago

I don't really have the time or energy to dig into android related things, android tends to just suck the fun out of everything with its anti-consumer culture of malpractice app development with anti-consumer "safety nets" and what not...

The error might perhaps indicate that the touch screen you cannot clone may have some capability that's not fully supported either by uinput, or netevent lacks some more/newer bits/capabilities to make it work, the setup doesn't have 100% coverage with respect to device capabilities.

twaik commented 1 year ago

Are there some tests that I can perform? Touchscreen can be passed to my kubuntu 23.04 desktop, but fails to be passed to other Android devices.

twaik commented 1 year ago

Can you please make some debug output for this to check what parameter is failed to be passed to kernel?