JakeWharton/adb-event-mirror

Script doesnt work

ahetawal-p opened this issue · 8 comments

Following the instructions

adb devices
List of devices attached
emulator-5554	device
emulator-5556	device

adb -s emulator-5554 shell getevent | ./adb-event-mirror.main.kts emulator-5556
ready!

EVENT /dev/input/event1 3 57 0
EVENT /dev/input/event1 3 48 2755
EVENT /dev/input/event1 3 58 129
EVENT /dev/input/event1 3 53 22633

Using Pixel 3a emulators on Api 29, I dont see any events being sent ?
Emulator details:

Name: Copy_of_Pixel_3_API_29
CPU/ABI: Google Play Intel Atom (x86)
Path: /Users/iam/.android/avd/Copy_of_Pixel_3_API_29.avd
Target: google_apis_playstore [Google Play] (API level 29)
Skin: pixel_3
hw.device.name: pixel_3
hw.lcd.width: 1080
hw.initialOrientation: Portrait
image.androidVersion.api: 29
tag.id: google_apis_playstore
hw.mainKeys: no
hw.camera.front: emulated
avd.ini.displayname: Copy_of_Pixel 3 API 29
AvdId: Copy_of_Pixel_3_API_29

Anything I am missing here ?

Same here, can confirm

saket commented

I was able to make this work on API 25 so I'm assuming something broke for recent Android versions.

I can confirm it doesn't work on API 30.

Same for me with API 31

Pull requests are welcomed.

@JakeWharton I think I have found the issue. The event type could be different on different emulators. For example, in my case, the /dev/input/event3 (virtio_input_multi_touch_1) from host emulator was mapped to /dev/input/event10 (virtio_input_multi_touch_8) to mirror emulator using the event type alone.
My solution is to get the host and mirror emulator's serials in the script and build a mapping. So that each host event can be mapped to the correct mirror event. meaning virtio_input_multi_touch_1 to virtio_input_multi_touch_1.
adb -s emulator-5554 shell getevent | ./adb-event-mirror.main.kts emulator-5554 emulator-5556
I can open a PR if you share same opinion?

Hmm if you're forced to pass the serial ID of both devices to the command I'm wondering if we should just run the getevent command for you. Maybe if stdin is empty we run it automatically?

Anyway I can address that separately. The map sounds good.

@JakeWharton Please have a look #23