JakeWharton / adb-event-mirror

Mirror the touch/key/button events of one device onto one or more other devices in real-time
Apache License 2.0
885 stars 43 forks source link

Script doesnt work #21

Open ahetawal-p opened 4 years ago

ahetawal-p commented 4 years ago

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 ?

Ghedeon commented 3 years ago

Same here, can confirm

saket commented 3 years ago

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

karanDhillon commented 3 years ago

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

SaqibJDev commented 2 years ago

Same for me with API 31

JakeWharton commented 2 years ago

Pull requests are welcomed.

SaqibJDev commented 2 years ago

@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?

JakeWharton commented 2 years ago

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.

SaqibJDev commented 2 years ago

@JakeWharton Please have a look https://github.com/JakeWharton/adb-event-mirror/pull/23