Cartucho / android-touch-record-replay

How to record and replay touchscreen events on an Android device.
Apache License 2.0
223 stars 46 forks source link

./mysendevent: not executable: 64-bit ELF file on Pixel7 and Samsung S20 #35

Open allesschonweg opened 1 month ago

allesschonweg commented 1 month ago

user@linuxlaptop ~/android-touch-record-replay $ ./record_touch_events.sh Looking for touchscreen device... /dev/input/event4 /dev/input/event3 Touchscreen device found! -> /dev/input/event3 SDK version: 34

Recording will START as soon as you put your finger in the touchscreen. Press ctrl+c to STOP recording... ^C user@linuxlaptop ~/android-touch-record-replay $ ./replay_touch_events.sh Looking for touchscreen device... /dev/input/event4 /dev/input/event3 Touchscreen device found! -> /dev/input/event3 ---ls: /data/local/tmp/mysendevent: No such file or directory--- mysendevent: 1 file pushed. 0.4 MB/s (13608 bytes in 0.030s) recorded_touch_events.txt: 1 file pushed. 0.1 MB/s (15059 bytes in 0.101s) /system/bin/sh: /data/local/tmp/mysendevent: not executable: 64-bit ELF file user@linuxlaptop ~/android-touch-record-replay $ adb shell x1s:/ $ cd /data/local/temp
/system/bin/sh: cd: /data/local/temp: No such file or directory 2|x1s:/ $ cd /data/local/tmp
x1s:/data/local/tmp $ ls -l total 16 -rwxrwxrwx 1 shell shell 13608 2024-05-30 15:09 mysendevent x1s:/data/local/tmp $ ./mysendevent
/system/bin/sh: ./mysendevent: not executable: 64-bit ELF file

sodaws commented 1 month ago

Did you use mysendevent-arm64? If not, modify replay_touch_events.sh (line 12) to use that one.

allesschonweg commented 1 month ago

Ok, yes, then it works, but the script should then somehow query for the architecture and push the correct binary. But even this way, I just end up in a denied Permission in both, a stock Pixel 7a and a rooted Android 14 device: android-touch-record-replay $ ./replay_touch_events.sh Looking for touchscreen device... /dev/input/event6 /dev/input/event8 /dev/input/event0 /dev/input/event7 /dev/input/event3 Touchscreen device found! -> /dev/input/event3 ---/data/local/tmp/mysendevent--- recorded_touch_events.txt: 1 file pushed. could not open /dev/input/event3, Permission denied

sodaws commented 1 month ago

iirc root is required since Android 10. I've never used it with newer versions.

hmm...but I just remembered something. I think when the replay_touch_events.sh calls adb shell the command is executed with the shell user. This user probably doesn't execute stuff with root by default. Instead of using:

adb shell /data/local/tmp/mysendevent "${TOUCH_DEVICE#*-> }" /sdcard/recorded_touch_events.txt

maybe using:

adb shell su -c '/data/local/tmp/mysendevent "${TOUCH_DEVICE#*-> }" /sdcard/recorded_touch_events.txt'

will do the trick.

finnmglas commented 1 week ago

What worked for me was to edit the file replay_touch_events.sh, adding "-arm64" to every occurrence of the mysendevent thing, so the right binary was pushed