GithubHelp home page GithubHelp logo

jakewharton / adb-event-mirror Goto Github PK

View Code? Open in Web Editor NEW
880.0 880.0 43.0 3.51 MB

Mirror the touch/key/button events of one device onto one or more other devices in real-time

License: Apache License 2.0

Kotlin 100.00%

adb-event-mirror's People

Contributors

jakewharton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adb-event-mirror's Issues

Could not get driver error

After trying out the command :
adb -s 192.168.43.154:5555 shell getevent | adb-event-mirror.main.kts 58H3Y18831023558

Getting the following error
could not get driver version for /dev/input/mice, Not a typewriter The system cannot execute the specified program.

adb-event-error

After trying adb -s 192.168.43.154:5555 shell getevent -p command got following response :

  name:     "sdm845-tavil-snd-card Button Jack"
  events:
    KEY (0001): 0072  0073  00e2  0103  0104  0105
  input props:
    <none>
add device 2: /dev/input/event4
  name:     "sdm845-tavil-snd-card Headset Jack"
  events:
    SW  (0005): 0002  0004  0006  0007  0010  0011  0012  0013
  input props:
    <none>
add device 3: /dev/input/event1
  name:     "gf_input"
  events:
    KEY (0001): 003c  0066  0067  0069  006a  006c  0074  008b
                009e  0131
  input props:
    <none>
add device 4: /dev/input/event0
  name:     "qpnp_pon"
  events:
    KEY (0001): 0072  0074
  input props:
    <none>
add device 5: /dev/input/event3
  name:     "synaptics,s3320"
  events:
    KEY (0001): 003e  009e  0145  0244
    ABS (0003): 002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                0031  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                0032  : value 0, min 0, max 0, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 1079, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 2339, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
  input props:
    INPUT_PROP_DIRECT
add device 6: /dev/input/event2
  name:     "gpio-keys"
  events:
    KEY (0001): 0072  0073
    SW  (0005): 0000
  input props:
    <none>
could not get driver version for /dev/input/mice, Not a typewriter```

@JakeWharton ,
 Will the program works only on emulators not on physical devices?

Record events for replaying them later

Being able to record touch events for replaying them later would be great for situations when the same device needs to be used. Not sure if it's actually possible to do this in the current setup.

Query and match up devices

adb -s emulator-5554 shell getevent
add device 1: /dev/input/event0
  name:     "Power Button"
add device 2: /dev/input/event6
  name:     "virtio_input_multi_touch_6"
add device 3: /dev/input/event3
  name:     "virtio_input_multi_touch_3"
add device 4: /dev/input/event10
  name:     "virtio_input_multi_touch_10"
add device 5: /dev/input/event4
  name:     "virtio_input_multi_touch_4"
add device 6: /dev/input/event1
  name:     "virtio_input_multi_touch_1"
add device 7: /dev/input/event11
  name:     "virtio_input_multi_touch_11"
add device 8: /dev/input/event7
  name:     "virtio_input_multi_touch_7"
add device 9: /dev/input/event5
  name:     "virtio_input_multi_touch_5"
add device 10: /dev/input/event2
  name:     "virtio_input_multi_touch_2"
add device 11: /dev/input/event12
  name:     "qwerty2"
add device 12: /dev/input/event14
  name:     "goldfish_rotary"
add device 13: /dev/input/event9
  name:     "virtio_input_multi_touch_9"
add device 14: /dev/input/event8
  name:     "virtio_input_multi_touch_8"
add device 15: /dev/input/event13
  name:     "AT Translated Set 2 keyboard"
/dev/input/event12: 0001 0014 00000001
/dev/input/event12: 0000 0000 00000000
/dev/input/event12: 0001 0014 00000000
/dev/input/event12: 0000 0000 00000000
/dev/input/event1: 0003 0039 00000000
/dev/input/event1: 0003 0030 0000006f
/dev/input/event1: 0003 003a 00000081
/dev/input/event1: 0003 0035 00004d82
/dev/input/event1: 0003 0036 00000955
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0003 003a 00000000
/dev/input/event1: 0003 0039 ffffffff
/dev/input/event1: 0000 0000 00000000
/dev/input/event12: 0001 0074 00000001
/dev/input/event12: 0000 0000 00000000
/dev/input/event12: 0001 0074 00000000
/dev/input/event12: 0000 0000 00000000

Script doesnt work

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 ?

Open to kscript?

Curious if you are open to using kscript instead of a pure kotlin script. The wrapper would allow us to resolve and specify our own repositories to resolve the clikt dependency.

Event forwarding did not work for same emulators

Env Info

  • OS: MacOS 10.15.5
  • kotlinc version: 1.3.72
  • adb version: 30.0.3
  • Emulator 1: Pixel 3 API 30 - Google Play
  • Emulator 2: Pixel 3 API 30 - Google Play

Issue

Used command in the readme to run on emulators, however it did not forward the touch events.

Command Used

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

Debug Log

adb-event-mirror-log.txt

Screen capture

Kapture 2020-07-14 at 22 32 26

Flag to enable "show touches"

Applies to all secondary devices.

Open questions:

  • Enable on host device as well? Probably
  • Query state before and restore after?

How to resolve dependency com.github.ajalt:clikt:2.8.0?

Couldn't run the script by executing
adb -s emulator-5554 shell getevent | kotlinc -script -- adb-event-mirror.main.kts 0498ad080405

Result:

error: unresolved reference: clikkotlinct (adb-event-mirror.main.kts:8:25)
error: unresolved reference: multiple (adb-event-mirror.main.kts:27:4)
error: unresolved reference: it (adb-event-mirror.main.kts:28:19)
adb-event-mirror.main.kts:8:25: error: unresolved reference: clikkotlinct
import com.github.ajalt.clikkotlinct.parameters.arguments.multiple
^
adb-event-mirror.main.kts:27:4: error: unresolved reference: multiple
.multiple(true)
^
adb-event-mirror.main.kts:28:19: error: unresolved reference: it
.transformAll { it.toSet() }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.