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

Attempt to forward events to STF agent when libevdev is unable to manage the input device. #50

Merged
merged 1 commit into from Jan 31, 2020

Conversation

pcrepieux
Copy link
Contributor

With Android 10, libevdev cannot access /dev/input devices.
As a workaround, minitouch can connect to a server process
embedded in STFService.apk that will use the Android
InputManager to inject events.

manage the input device.

With Android 10, libevdev cannot access /dev/input devices.
As a workaround, minitouch can connect to a server process
embedded in STFService.apk that will use the Android
InputManager to inject events.
@pcrepieux
Copy link
Contributor Author

See also related PR for STFService.apk: openstf/STFService.apk#38
I've done it that way to keep the existing components, at least as a first step.

@stoefln
Copy link
Contributor

stoefln commented Jan 5, 2020

@pcrepieux Could you explain what steps are needed to make this work? I assume I would have to install and run STFService.apk before connecting to the device right? I am running minitouch without openstf...

@pcrepieux
Copy link
Contributor Author

@stoefln
Absolutely. You'll have to start the agent before running minitouch (see : https://github.com/openstf/STFService.apk#running-the-agent).

@stoefln
Copy link
Contributor

stoefln commented Jan 6, 2020

thanks @pcrepieux . Shouldn't then STFService.apk be part of this PR? I mean up to this point, minitouch "just worked", but now it seems there are dependencies introduced. At least I think I would maybe copy over some of the documentation you referenced above...

@koral-- koral-- merged commit c39d853 into openstf:master Jan 31, 2020
@1tiktak
Copy link

1tiktak commented Feb 24, 2020

Can someone walk me through on how to add this to add support for Android 10?

@stoefln
Copy link
Contributor

stoefln commented Feb 25, 2020

@1tiktak I tried already and it works. I followed exactly the steps outlined here:
https://github.com/openstf/STFService.apk#running-the-service
and here:
https://github.com/openstf/STFService.apk#running-the-agent

BTW. I am not even sure if you need the service or just the agent...

@risinek
Copy link

risinek commented Feb 28, 2020

@1tiktak as it's now merged into master, you can just pull the repo and run stf and Android 10 support should work oob

@man4567890
Copy link

Hi @pcrepieux , would this fix my problem on LG devices?
I think this is a 32 bit device and not 64 bits
2020-03-24T09:38:06.777Z WRN/device:plugins:data 23443 [LMK300QKJ7ZDJRRSMF] Unable to find device data { serial: 'LMxxxxxx', platform: 'Android', manufacturer: 'LGE', operator: '', model: 'LM-K300', version: '10', abi: 'armeabi-v7a', sdk: '29', product: 'mdh5lm', cpuPlatform: 'mt6765', openGLESVersion: '3.2', display: { id: 0, width: 720, height: 1520, xdpi: 294.9670104980469, ydpi: 311.35400390625, fps: 61.2400016784668, density: 2, rotation: 0, secure: true, size: 5.458133099625045, url: 'ws://' }, phone: { network: 'UNKNOWN' } } 2020-03-24T09:38:06.781Z INF/device:plugins:touch 23443 [LMKDJRRSMF] Touch origin is top left 2020-03-24T09:38:06.781Z INF/device:plugins:touch 23443 [LMKDJRRSMF] Requesting touch consumer to start 2020-03-24T09:38:06.782Z INF/device:plugins:touch 23443 [LMKDJRRSMF] Launching touch service 2020-03-24T09:38:06.805Z INF/device:plugins:touch 23443 [LMKDJRRSMF] Connecting to minitouch service 2020-03-24T09:38:06.911Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "open: Permission denied" 2020-03-24T09:38:06.911Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "Unable to open device /dev/input/event2 for inspectionopen: Permission denied" 2020-03-24T09:38:06.912Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "Unable to open device /dev/input/event3 for inspectionopen: Permission denied" 2020-03-24T09:38:06.912Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "Unable to open device /dev/input/mice for inspectionopen: Permission denied" 2020-03-24T09:38:06.912Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "Unable to open device /dev/input/event0 for inspectionopen: Permission denied" 2020-03-24T09:38:06.912Z INF/device:plugins:touch 23443 [LMKDJRRSMF] minitouch says: "Unable to open device /dev/input/event1 for inspectionUnable to find a suitable touch device" 2020-03-24T09:38:07.403Z WRN/device:plugins:touch 23443 [LMKDJRRSMF] Will not apply desired state due to too many failures 2020-03-24T09:38:07.404Z INF/device:plugins:touch 23443 [LMKDJRRSMF] Stopping minitouch service 2020-03-24T09:38:07.405Z FTL/device 23443 [LMKDJRRSMF] Setup had an error Error: Failed more than 3 times in 10000ms at TouchConsumer._failLimitExceeded (/usr/lib/node_modules/stf/lib/units/device/plugins/touch/index.js:230:26) at FailCounter.emit (/usr/lib/node_modules/stf/node_modules/eventemitter3/index.js:117:35) at FailCounter.inc (/usr/lib/node_modules/stf/lib/util/failcounter.js:29:10) at TouchConsumer._outputEnded (/usr/lib/node_modules/stf/lib/units/device/plugins/touch/index.js:223:24) at RiskyStream.emit (/usr/lib/node_modules/stf/node_modules/eventemitter3/index.js:115:35) at RiskyStream.<anonymous> (/usr/lib/node_modules/stf/lib/util/riskystream.js:14:12) at emitNone (events.js:111:20) at Socket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:139:11) From previous event: at startConsumer (/usr/lib/node_modules/stf/lib/units/device/plugins/touch/index.js:511:14) at /usr/lib/node_modules/stf/lib/units/device/plugins/touch/index.js:526:12 at SerialSyrup.ParallelSyrup.invoke (/usr/lib/node_modules/stf/node_modules/stf-syrup/lib/parallel.js:54:24) at /usr/lib/node_modules/stf/node_modules/stf-syrup/lib/serial.js:43:33 at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickCallback (internal/process/next_tick.js:181:9) 2020-03-24T09:38:07.405Z FTL/util:lifecycle 23443 [LMKDJRRSMF] Shutting down due to fatal error 2020-03-24T09:38:07.413Z INF/provider 14333 [*] Cleaning up device worker "LMKDJRRSMF" 20

I have the latest build of your repo, it seems to work for 64 bit devices but not 32 bit
Any help would be appreciated please

@pcrepieux
Copy link
Contributor Author

@man4567890
You mean the one in the release section of the fork here: https://github.com/Orange-OpenSource/minitouch/releases/tag/v1.2.1 ?
The 32 bit binary is wrong in this temporary package... my bad. Sorry for that.
As everything has been merged, you'd better go with the upstream version which is fine.
Thanks for pointing this out.

@man4567890
Copy link

Hi @pcrepieux , do you mean I should git clone the https://github.com/Orange-OpenSource/stf.git repo again and build? Are the minitouch changes in the repo (https://github.com/Orange-OpenSource/stf.git)?
Thanks so much for the hard work!

@man4567890
Copy link

Hi @pcrepieux , I did the git clone from https://github.com/Orange-OpenSource/stf.git and npm install, but still getting this errror...

`2020-03-25T09:01:36.028Z INF/device:plugins:identity 30751 [LMXXX] Solving identity

2020-03-25T09:01:36.031Z INF/device:plugins:solo 30751 [LMXXX] Subscribing to permanent channel "LbG8mL2R19k0nvP/7sYg/tX3OnE="

2020-03-25T09:01:36.032Z INF/device:plugins:screen:stream 30751 [LMXXX] Starting WebSocket server on port 7476

2020-03-25T09:01:36.476Z INF/device:resources:minitouch 30751 [LMXXX] Installing "/usr/lib/node_modules/stf/node_modules/minitouch-prebuilt-beta/prebuilt/armeabi-v7a/bin/minitouch" as "/data/local/tmp/minitouch"

2020-03-25T09:01:36.667Z WRN/device:plugins:data 30751 [LMXXX] Unable to find device data { serial: 'LMXXX',
platform: 'Android',
manufacturer: 'LGE',
operator: '',
model: 'LM-K300',
version: '10',
abi: 'armeabi-v7a',
sdk: '29',
product: 'mdh5lm',
cpuPlatform: 'mt6765',
openGLESVersion: '3.2',
marketName: 'mdh5lm',
display:
{ id: 0,
width: 720,
height: 1520,
xdpi: 294.9670104980469,
ydpi: 311.35400390625,
fps: 61.2400016784668,
density: 2,
rotation: 0,
secure: true,
size: 5.458133099625045,
url: 'ws://10.119.102.86:7476' },
phone: { network: 'UNKNOWN' } }
2020-03-25T09:01:36.670Z INF/device:plugins:touch 30751 [LMXXX] Touch origin is top left
2020-03-25T09:01:36.670Z INF/device:plugins:touch 30751 [LMXXX] Requesting touch consumer to start
2020-03-25T09:01:36.671Z INF/device:plugins:touch 30751 [LMXXX] Launching touch service
2020-03-25T09:01:36.689Z INF/device:plugins:touch 30751 [LMXXX] Connecting to minitouch service
2020-03-25T09:01:36.745Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "open: Permission denied"
2020-03-25T09:01:36.745Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Unable to open device /dev/input/mice for inspectionopen: Permission denied"
2020-03-25T09:01:36.745Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Unable to open device /dev/input/event2 for inspectionopen: Permission denied"
2020-03-25T09:01:36.746Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Unable to open device /dev/input/event3 for inspectionopen: Permission denied"
2020-03-25T09:01:36.746Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Unable to open device /dev/input/event0 for inspectionopen: Permission denied"
2020-03-25T09:01:36.746Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Unable to open device /dev/input/event1 for inspectionUnable to find a suitable touch device"
2020-03-25T09:01:36.746Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "using Android InputManager"
2020-03-25T09:01:36.861Z INF/device:plugins:touch 30751 [LMXXX] Reading minitouch banner
2020-03-25T09:01:36.904Z INF/device:plugins:touch 30751 [LMXXX] minitouch says: "Connection established"
2020-03-25T09:01:36.911Z INF/device:plugins:vnc 30751 [LMXXX] Starting VNC server on port 7478
2020-03-25T09:01:36.913Z INF/device:plugins:browser 30751 [LMXXX] Loading browser list
2020-03-25T09:01:36.934Z INF/device:plugins:browser 30751 [LMXXX] Updating browser list
2020-03-25T09:01:36.936Z INF/device:plugins:mute 30751 [LMXXX] Will not mute master volume
2020-03-25T09:01:37.521Z INF/device:resources:minirev 30751 [LMXXX] Installing "/usr/lib/node_modules/stf/vendor/minirev/armeabi-v7a/minirev" as "/data/local/tmp/minirev"
2020-03-25T09:01:37.777Z INF/device:plugins:forward 30751 [LMXXX] Launching reverse port forwarding service
2020-03-25T09:01:37.805Z INF/device:plugins:forward 30751 [LMXXX] Connecting to reverse port forwarding service
2020-03-25T09:01:37.938Z INF/device 30751 [LMXXX] Fully operational
2020-03-25T09:02:17.948Z IMP/device:plugins:group 30751 [LMXXX] Now owned by "xxx"
2020-03-25T09:02:17.948Z INF/device:plugins:group 30751 [LMXXX] Subscribing to group channel "27wYow6vQ7KHx53MvmzFQw=="
2020-03-25T09:02:18.815Z INF/device:plugins:screen:stream 30751 [LMXXX] Setting frame producer projection to 313x583
2020-03-25T09:02:18.816Z INF/device:plugins:screen:stream 30751 [LMXXX] Requesting frame producer to start
2020-03-25T09:02:18.816Z INF/device:plugins:screen:stream 30751 [LMXXX] Launching screen service
2020-03-25T09:02:19.061Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "PID: 16104"
2020-03-25T09:02:19.062Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: Using projection 720x1520@276x583/0"
2020-03-25T09:02:19.062Z INF/device:plugins:screen:stream 30751 [LMXXX] Connecting to minicap service
2020-03-25T09:02:19.064Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:241) Creating SurfaceComposerClient"
2020-03-25T09:02:19.065Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:244) Performing SurfaceComposerClient init check"
2020-03-25T09:02:19.065Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:255) Creating virtual display"
2020-03-25T09:02:19.065Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:261) Creating buffer queue"
2020-03-25T09:02:19.108Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:264) Setting buffer options"
2020-03-25T09:02:19.108Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:268) Creating CPU consumer"
2020-03-25T09:02:19.108Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:272) Creating frame waiter"
2020-03-25T09:02:19.109Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "INFO: (external/MY_minicap/src/minicap_29.cpp:276) Publishing virtual display"
2020-03-25T09:02:19.109Z INF/device:plugins:screen:stream 30751 [LMXXX] minicap says: "Vector<> have different types (this=0xbec76160, rhs=0xbec76210)"
2020-03-25T09:02:19.395Z WRN/device:plugins:screen:stream 30751 [LMXXX] Shell keeping minicap running ended unexpectedly
2020-03-25T09:02:20.689Z INF/device:plugins:screen:stream 30751 [LMXXX] Disconnecting from minicap service
2020-03-25T09:02:20.690Z INF/device:plugins:screen:stream 30751 [LMXXX] Stopping minicap service
2020-03-25T09:02:20.691Z FTL/device:plugins:screen:stream 30751 [LMXXX] Frame producer had an error FailError: Failure: 'closed'
at /usr/lib/node_modules/stf/node_modules/adbkit/lib/adb/parser.js:183:29
at runCallback (timers.js:810:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
2020-03-25T09:02:20.691Z FTL/util:lifecycle 30751 [LMXXX] Shutting down due to fatal error
2020-03-25T09:02:20.697Z INF/provider 20200 [] Cleaning up device worker "LMK300QKAMLFVGFAB6"
2020-03-25T09:02:20.698Z ERR/provider 20200 [
] Device worker "LMXXX" died with code 1
2020-03-25T09:02:20.698Z INF/provider 20200 [*] Restarting device worker "LMXXX"
2020-03-25T09:02:21.484Z INF/device:support:push 31264 [LMXXX] Sending output to "tcp://127.0.0.1:7116"
2020-03-25T09:02:21.487Z INF/device 31264 [LMXXX] Preparing device
2020-03-25T09:02:21.858Z INF/device:support:sub 31264 [LMXXX] Receiving input from "tcp://127.0.0.1:7114"
2020-03-25T09:02:21.859Z INF/device:support:sub 31264 [LMXXX] Subscribing to permanent channel "*ALL"
2020-03-25T09:02:21.976Z INF/device:support:properties 31264 [LMXXX] Loading properties
2020-03-25T09:02:22.168Z INF/device:support:sdk 31264 [LMXXX] Supports SDK 29
2020-03-25T09:02:22.169Z INF/device:support:abi 31264 [LMXXX] Supports ABIs armeabi-v7a, armeabi
2020-03-25T09:02:22.920Z INF/device:resources:minicap 31264 [LMXXX] Installing "/usr/lib/node_modules/stf/node_modules/minicap-prebuilt-beta/prebuilt/armeabi-v7a/bin/minicap" as "/data/local/tmp/minicap"
2020-03-25T09:02:22.920Z INF/device:resources:minicap 31264 [LMXXX] Installing "/usr/lib/node_modules/stf/node_modules/minicap-prebuilt-beta/prebuilt/armeabi-v7a/lib/android-29/minicap.so" as "/data/local/tmp/minicap.so"
2020-03-25T09:02:23.287Z INF/device:resources:service 31264 [LMXXX] Checking whether we need to install STFService
2020-03-25T09:02:23.471Z INF/device:resources:service 31264 [LMXXX] Running version check
2020-03-25T09:02:24.250Z INF/device:resources:service 31264 [LMXXX] Installing STFService
2020-03-25T09:02:27.975Z INF/device:resources:service 31264 [LMXXX] STFService up to date
2020-03-25T09:02:27.977Z INF/device:plugins:service 31264 [LMXXX] Launching agent
2020-03-25T09:02:29.228Z INF/device:plugins:service 31264 [LMXXX] Agent says: "Starting minitouch agent"
2020-03-25T09:02:29.271Z INF/device:plugins:service 31264 [LMXXX] Agent says: "Listening on @stfagent"
2020-03-25T09:02:29.277Z INF/device:plugins:service 31264 [LMXXX] Launching service
2020-03-25T09:02:29.278Z INF/device:plugins:service 31264 [LMXXX] using 'start-foreground-service' command for API 29
2020-03-25T09:02:29.282Z INF/device:plugins:service 31264 [LMXXX] Agent says: "InputClient started"
`

Any other suggestions please?

@pcrepieux
Copy link
Contributor Author

@man4567890
Great, you made a step forward. Your initial issue with minitouch is now fixed. According to the log:
minitouch says: "using Android InputManager"
This is fine but now, you have minicap complaining :-/ This log points out the problem:
minicap says: "Vector<> have different types (this=0xbec76160, rhs=0xbec76210)"
You can refer to openstf/minicap#169 to have more info but I am not sure a fix for API 29 has been found or shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants