Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event forwarding did not work for same emulators #13

Closed
hossain-khan opened this issue Jul 15, 2020 · 8 comments · Fixed by #17
Closed

Event forwarding did not work for same emulators #13

hossain-khan opened this issue Jul 15, 2020 · 8 comments · Fixed by #17
Labels
bug Something isn't working

Comments

@hossain-khan
Copy link

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

@JakeWharton
Copy link
Owner

Can you run adb -s emulator-5556 shell getevent -p and paste that output? It contains the input device mapping on the second emulator. Right now touch is being mapped to input10 but that doesn't appear to be the right device.

@hossain-khan
Copy link
Author

hossain-khan commented Jul 15, 2020

EDIT: Sorry, I did close the emulators, and just reopened them to get this data. Do I need to run the ./adb-event-mirror.main.kts command again with --debug?

➜  adb-event-mirror git:(trunk) adb -s emulator-5556 shell getevent -p
add device 1: /dev/input/event10
  name:     "virtio_input_multi_touch_9"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 2: /dev/input/event0
  name:     "Power Button"
  events:
    KEY (0001): 0074 
  input props:
    <none>
add device 3: /dev/input/event8
  name:     "virtio_input_multi_touch_7"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 4: /dev/input/event11
  name:     "virtio_input_multi_touch_10"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 5: /dev/input/event5
  name:     "virtio_input_multi_touch_4"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 6: /dev/input/event2
  name:     "virtio_input_multi_touch_1"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 7: /dev/input/event12
  name:     "virtio_input_multi_touch_11"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 8: /dev/input/event13
  name:     "qwerty2"
  events:
    KEY (0001): 0001  0002  0003  0004  0005  0006  0007  0008 
                0009  000a  000b  000c  000d  000e  000f  0010 
                0011  0012  0013  0014  0015  0016  0017  0018 
                0019  001a  001b  001c  001d  001e  001f  0020 
                0021  0022  0023  0024  0025  0026  0027  0028 
                0029  002a  002b  002c  002d  002e  002f  0030 
                0031  0032  0033  0034  0035  0036  0037  0038 
                0039  003a  003b  003c  003d  003e  003f  0040 
                0041  0042  0043  0044  0045  0046  0047  0048 
                0049  004a  004b  004c  004d  004e  004f  0050 
                0051  0052  0053  0056  0057  0058  0059  005b 
                005c  0060  0061  0062  0063  0064  0065  0066 
                0067  0068  0069  006a  006b  006c  006d  006e 
                006f  0071  0072  0073  0074  0075  0077  0079 
                007c  007d  007e  007f  0080  0081  0082  0083 
                0084  0085  0086  0087  0088  0089  008a  008b 
                008c  008e  008f  009b  009c  009d  009e  009f 
                00a3  00a4  00a5  00a6  00ac  00ad  00d9  00e2 
                00e5  00e6  00e7  018f  0244  0245  0246  0247 
                0248 
    LED (0011): 0000  0001  0002 
  input props:
    <none>
add device 9: /dev/input/event6
  name:     "virtio_input_multi_touch_5"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 10: /dev/input/event3
  name:     "virtio_input_multi_touch_2"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 11: /dev/input/event1
  name:     "AT Translated Set 2 keyboard"
  events:
    KEY (0001): 0001  0002  0003  0004  0005  0006  0007  0008 
                0009  000a  000b  000c  000d  000e  000f  0010 
                0011  0012  0013  0014  0015  0016  0017  0018 
                0019  001a  001b  001c  001d  001e  001f  0020 
                0021  0022  0023  0024  0025  0026  0027  0028 
                0029  002a  002b  002c  002d  002e  002f  0030 
                0031  0032  0033  0034  0035  0036  0037  0038 
                0039  003a  003b  003c  003d  003e  003f  0040 
                0041  0042  0043  0044  0045  0046  0047  0048 
                0049  004a  004b  004c  004d  004e  004f  0050 
                0051  0052  0053  0055  0056  0057  0058  0059 
                005a  005b  005c  005d  005e  005f  0060  0061 
                0062  0063  0064  0066  0067  0068  0069  006a 
                006b  006c  006d  006e  006f  0070  0071  0072 
                0073  0074  0075  0076  0077  0079  007a  007b 
                007c  007d  007e  007f  0080  008c  008e  008f 
                009b  009c  009d  009e  009f  00a3  00a4  00a5 
                00a6  00ac  00ad  00b7  00b8  00b9  00d9  00e2 
    MSC (0004): 0004 
    LED (0011): 0000  0001  0002 
  input props:
    <none>
add device 12: /dev/input/event7
  name:     "virtio_input_multi_touch_6"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 13: /dev/input/event4
  name:     "virtio_input_multi_touch_3"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>
add device 14: /dev/input/event9
  name:     "virtio_input_multi_touch_8"
  events:
    ABS (0003): 0000  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0002  : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0
                002f  : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0
                0030  : value 0, min 0, max 2147483647, fuzz 0, flat 0, resolution 0
                0035  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0036  : value 0, min 0, max 32767, fuzz 0, flat 0, resolution 0
                0039  : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
                003a  : value 0, min 0, max 256, fuzz 0, flat 0, resolution 0
    SW  (0005): 0000 
  input props:
    <none>

@JakeWharton
Copy link
Owner

Ah okay it's a logic problem. Thanks. Will fix tomorrow.

@hossain-khan
Copy link
Author

Sounds great! Thanks 👍

@JakeWharton
Copy link
Owner

And in case I'm dumb and don't spot the problem again tomorrow:

The problem is we're comparing "event10" and "event8" lexicographically which means "event10" incorrectly sorts lower than "event8" but we want the lowest numeric value, not which sorts lowest in string form.

@JakeWharton JakeWharton added the bug Something isn't working label Jul 16, 2020
@JakeWharton
Copy link
Owner

Ok I have the fix, but I'm going to try to land testing first so I can script up a bunch of test cases to prevent regression.

@hossain-khan
Copy link
Author

I retried the script with latest update, however I still have same result as before. Sorry, if you are in the process of releasing new version with additional instruction that I may have missed.

Here is my AVD list

➜  adb-event-mirror git:(trunk) emulator -list-avds
Android_TV_1080p_API_28
Android_TV_1080p_API_Q
Nexus_4_API_25_Slow
Nexus_5X_API_25
Nexus_5_API_23
Nexus_5_API_25_Slow_Network
Nexus_5_API_29
Nexus_9_API_25
Pixel_2_API_29
Pixel_2_XL_API_29
Pixel_3_API_30 <<------------ emulator-5554
Pixel_3_API_30_Mirror <<----- emulator-5556
Pixel_3_XL_API_R
Pixel_API_25

Here are relevant logs taken with latest update

Let me know if there are some changes in command that should be used to execute. Thanks 🙏

@hossain-khan
Copy link
Author

hossain-khan commented Jul 17, 2020

Out of curiosity I created another set of emulators. I already had Nexus_5_API_23 so I created Nexus_5_API_23_Mirror and it worked.

I am not sure what is wrong with Pixel_3_API_30* emulators. Is it the position?

Here is my updated AVD list.

➜  adb-event-mirror git:(trunk) emulator -list-avds                                                                    
Android_TV_1080p_API_28
Android_TV_1080p_API_Q
Nexus_4_API_25_Slow
Nexus_5X_API_25
Nexus_5_API_23
Nexus_5_API_23_Mirror
Nexus_5_API_25_Slow_Network
Nexus_5_API_29
Nexus_9_API_25
Pixel_2_API_29
Pixel_2_XL_API_29
Pixel_3_API_30
Pixel_3_API_30_Mirror
Pixel_3_XL_API_R
Pixel_API_25

UPDATE: I have created another set of emulators Pixel_2_XL_API_30*, but this time without google play store. And it worked (even though bit slow on drags).

So, I am guessing, something is happening with "Google Play" emulators.

Screen Shot 2020-07-17 at 11 42 22 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants