Closed Zakkumaru closed 5 years ago
Thank you for your report.
I added some logs that should help investigating the issue. Could you checkout branch issue386
and try again, please?
Compile the whole project (do not use the prebuilt server) in debug mode:
meson d
ninja -Cd
./run d
Then copy/paste the output in the console.
Thank you for your help.
$ ./run d -s 192.168.1.150:5555 -m 800 -b 2M
d/server/scrcpy-server.jar: 1 file pushed. 1.6 MB/s (27919 bytes in 0.017s)
error: more than one device/emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
DEBUG: tunnel_forward=1
DEBUG: Remaining connection attempts: 100
DEBUG: Remaining connection attempts: 99
DEBUG: Remaining connection attempts: 98
DEBUG: Remaining connection attempts: 97
DEBUG: Remaining connection attempts: 96
DEBUG: Remaining connection attempts: 95
DEBUG: Remaining connection attempts: 94
DEBUG: Remaining connection attempts: 93
DEBUG: Remaining connection attempts: 92
DEBUG: Remaining connection attempts: 91
DEBUG: Remaining connection attempts: 90
DEBUG: Remaining connection attempts: 89
DEBUG: Remaining connection attempts: 88
DEBUG: Remaining connection attempts: 87
DEBUG: Remaining connection attempts: 86
DEBUG: Remaining connection attempts: 85
DEBUG: args: [800, 2000000, true, , false]DEBUG: Remaining connection attempts: 84
DEBUG: tunnelForward = true
DEBUG: Starting decoder thread
DEBUG: Starting controller thread
INFO: OpenGL shaders: ENABLED
INFO: Created renderer: opengl
INFO: Initial texture: 448x800
NOW it works? Are you sure debugging is the only thing you changed? (Rhetorical, since I can read the commit)
Thanks for all the help. Strange it's not working for me on the main build, considering it's also v1.5.
Can we just make the debugging an argument? I think we need the option to be included in the main build, considering how useful it would be. It would help me figure out why it's not working in the main build, and why it keeps crashing when I use USB mode.
NOW it works
Could you try at v1.5-fixversion
(a17f111)?
And at master
(0e019f8)?
Which ones work?
Can we just make the debugging an argument?
It's a build argument (just do not pass --buildtype release
as a meson argument).
But I guess you mean a runtime parameter, like a "verbose" mode?
Could you try at
v1.5-fixversion
(a17f111)? And atmaster
(0e019f8)?Which ones work?
Give me a few minutes to build and test each one.
It's a build argument (just do not pass
--buildtype release
as a meson argument).But I guess you mean a runtime parameter, like a "verbose" mode?
Yeah, I thought you would assume I meant a runtime argument. I think there need to be varying levels of details for the runtime debugging flags, just so people don't have to sift through all the logs, if verbose is too much.
Okay, both builds you asked about work for me. However, I don't think this is a valid test, since I received the same debugger messages as your debugger build. I ran from the builds themselves (./run d
), in the actual directories of the downloaded commits, and not general commands, like scrcpy
, so I'm not entirely sure how to completely reset everything to conduct a more valid test.
I'm not entirely sure how to completely reset everything to conduct a more valid test.
Use a separate build directory in release mode:
meson somedir --buildtype release --strip -Db_lto=true
ninja -Csomedir
./run somedir
Alright, that looks more like it. They're all working. Idk wtf was wrong, before. I swear, things will break right up until the point I get the dev's attention, then it works just to make me look bad. Haha
Now working for me. Only output
22:11 $ scrcpy -s 192.168.1.23:5555
/usr/local/Cellar/scrcpy/1.3/share/scrcpy/scrcpy... 1 file pushed. 1.0 MB/s (18570 bytes in 0.017s)
error: more than one device/emulator
2019-01-12 22:11:29.626 scrcpy[25630:3011746] ERROR: "adb reverse" returned with value 1
2019-01-12 22:11:29.627 scrcpy[25630:3011746] WARN: 'adb reverse' failed, fallback to 'adb forward'
error: device offline
2019-01-12 22:11:29.659 scrcpy[25630:3011746] ERROR: "adb forward" returned with value 1
No window opened
the adb logcat
quit when using this command
What does adb logcat
say?
It should not. What is the result of adb devices
?
Maybe my fault. I try to write a adb-usb to tcp proxy. some code may not working.
I debug for a long time, but still do not know why.
Here is my tool which can share usb device over WIFI. https://github.com/codeskyblue/fa
# assume this pc ip is 10.0.0.1
$ fa share --port 5555
In another pc
$ adb connect 10.0.0.1
$ scrcpy -s 10.0.0.1:5555
/usr/local/Cellar/scrcpy/1....B/s (18570 bytes in 0.011s)
error: reverse service not supported
2019-01-13 13:14:17.471 scrcpy[55728:3248464] ERROR: "adb reverse" returned with value 1
2019-01-13 13:14:17.471 scrcpy[55728:3248464] WARN: 'adbreverse' failed, fallback to 'adb forward'
2019-01-13 13:14:17.662 scrcpy[55728:3248464] ERROR: Could not retrieve device information
I don't know why it prints Could not retrieve device information
, It seems fa did not accept requests about information request.
Hope to hear from you soon. @rom1v
I don't know why it prints
Could not retrieve device information
On start, scrcpy client opens a socket (on port 27183) to communicate with the server (executed on the device). "Device information" is the first piece of data which is read: https://github.com/Genymobile/scrcpy/blob/v1.5/app/src/device.c#L8
If this fails, the reason is probably that the socket is not connected between the client and the server.
In "forward" mode, the client connects to localhost:27183
(which is tunneled via adb forward
). If you use your own additional tunnel, you need to make sure this port is correctly forwarded. https://github.com/Genymobile/scrcpy/issues/144#issuecomment-414646089
Typically, if you use your own tunnel, https://github.com/Genymobile/scrcpy/issues/144#issuecomment-414646089
I'm pretty sure adb forward works fine. Another similar tool https://www.vysor.io/ works fine. But scrcpy donot.
I traced command executed in tunnel. Aborted
in jar.
When call app_process, trace dumped. Aborted
$ adb push /usr/local/share/scrcpy/scrcpy-server.jar /data/local/tmp
$ adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 0 8000000 true
Aborted
Are there any relevant logs in adb logcat
when you execute this? Which version of scrcpy? (the arguments passed to the server depend on the version)
Does it work over usb?
Is Android >= 5.0?
I installed scrcpy through brew install scrcpy
There is no relevent log in adb logcat
20:45 $ scrcpy -v
scrcpy v1.3
dependencies:
- SDL 2.0.8
- libavcodec 58.18.100
- libavformat 58.12.100
- libavutil 56.14.100
$ adb -s 192.168.1.23:6174 shell getprop | grep sdk
[ro.build.version.preview_sdk]: [0]
[ro.build.version.sdk]: [23]
[ro.qc.sdk.audio.fluencetype]: [none]
[ro.qc.sdk.audio.ssr]: [false]
Yes it works over usb. And If you use adb tcpip 5555
to turn device into wifi mode, it works too.
Finally find out the problem.
When run this command
adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 0 8000000 true
Another command calls in another thread.
adb shell rm /data/local/tmp/scrcpy-server.jar
So app_process can not found scrcpy-server.jar, Aborted
shows in output.
One solution to solve this problem is to delay 1 second, and then call rm /data/local/tmp/scrcpy-server.jar
. What do you think @rom1v
Looks like relevent with https://github.com/Genymobile/scrcpy/issues/390
@codeskyblue The client removes the file as soon as it is connected with the server: https://github.com/Genymobile/scrcpy/blob/master/app/src/server.c#L233
The problem with an additional tunnel is that from the client point of view, the connection will succeed as soon as it is connected to the tunnel, even if the server is not started yet, so it will remove the server before even starting it. I had a similar issue in gnirehtet (see commit message https://github.com/Genymobile/gnirehtet/commit/47fae70ec0e85adf9753ee617a261a026c272aa3).
Here, even if we don't remove the server, this is still racy: any read()
occurring too soon on the tunneled socket will fail.
Currently, I have no race-free solution. I started a background thread in my mind to think about it. :wink:
Maybe you can retry connect when fails?
And I found if you start the jar server already, scrcpy can works fine all the time.
@codeskyblue I have no idea why I cleaned up the device from the client.
On dev
, I clean from the server: https://github.com/Genymobile/scrcpy/commit/39c5e7160567af769d1b333c4b52d2da783d5c90.
It should fix your problem.
Sorry @rom1v even you don't delete jar file it is still say Aborted. I think maybe when app_process called, maybe the first connect may fail because of server is still starting
And I don't think it is a good idea to unlink in jar. It will make it hard to debug issues.
I think maybe when app_process called, maybe the first connect may fail because of server is still starting
In "forward" mode, it retries if it fails.
Oh, what I said here is incorrect: the problem of connect-without-read when a tunnel is present is already managed: 1038bad3850f18717a048a4d5c0f8110e54ee172.
You should try to increase the number of connection attempts.
EDIT: In fact, it can't be the cause of an Abort.
And I don't think it is a good idea to unlink in jar. It will make it hard to debug issues.
The purpose is to leave nothing on the device once disconnected. It's trivial to comment unlinkSelf()
for debugging purpose.
Sorry @rom1v even you don't delete jar file it is still say Aborted
Oh. So it's not related. Is the file correctly copied?
yes the file is correctly copied
Idk if your issue has anything to do with mine, but I just recently closed my issue with steps on how to fix.
https://github.com/Genymobile/scrcpy/issues/390#issuecomment-457859811
For the record, it has never actually worked for me, wirelessly. I can get it to work with wired adb, but not wirelessly.
Full issue described here.
Basically, I always get the "connection rejected" error, no matter what I try.
So, I was requested to open an issue here. I have seen many posts like this, already, however, and they each seem to end up getting closed despite no resolution.