user14977056
user14977056

Reputation: 31

Why does sending captured input events to the device they were captuered from fail? adb shell getevent

I am trying to send a relatively complex series of swipe events to my android device. The phone is rooted and it works perfectly well with single tap events captured like so:


adb shell cat /dev/input/eventX > input.log

and sent back like so:


adb shell cat ./input.log > /dev/input/eventX

If i however capture more complex events and try to stream them back I get the error

cat: xwrite: invalid argument

A couple of inputs are executed before I receive the errormessage. I suspect it has something to do with the size of the captured file I try to send to the device.

If i capture the event via adb shell getevent /dev/input/eventX > input.logand stream them back after properly converting them to sendevent commands like

sendevent /dev/input/event1 3 57 57

via adb shell bash -i ./events.log it works as intended but of course way too slow.

If you have any ideads I'd be quite grateful and happy to test them out.
This is my first question on stackoverflow so be indulgent if my posting is not yet sufficiently elaborated enough. I will gladly refine it with more details if needed.

Upvotes: 0

Views: 743

Answers (1)

user14977056
user14977056

Reputation: 31

As it seems posting this question and thereby reviewing the problem led me to solution myself.

In fact the main suspect from my question above 'filesize' is responsible and the solution rather simple.

adb shell dd bs=filesize_in_bytes if=./file of=/dev/input/eventX

Usually dd works with chunks of 512 bytes which leads to the abrupt ending after a couple of input events. Sending the whole binary at once solved the issue.

Upvotes: 3

Related Questions