Commit graph

1333 commits

Author SHA1 Message Date
Romain Vimont
d580ee30f1 Separate process wait and close
On Linux, waitpid() both waits for the process to terminate and reaps it
(closes its handle). On Windows, these actions are separated into
WaitForSingleObject() and CloseHandle().

Expose these actions separately, so that it is possible to send a signal
to a process while waiting for its termination without race condition.

This allows to wait for server termination normally, but kill the
process without race condition if it is not terminated after some delay.
2021-01-08 16:44:21 +01:00
Romain Vimont
821c175730 Rename process_simple_wait to process_wait
Adding "simple" in the function name brings no benefit.
2021-01-08 16:44:21 +01:00
Romain Vimont
cc6f5020d8 Move conditional src files in meson.build
Declare all the source files (including the platform-specific ones) at
the beginning.
2021-01-08 16:44:21 +01:00
Romain Vimont
4bd9da4c93 Split command into process and adb
The process API provides the system-specific implementation, the adb API
uses it to expose adb commands.
2021-01-08 16:44:21 +01:00
Romain Vimont
aa8b571389 Increase display id range
Some devices use big display id values.

Refs #2009 <https://github.com/Genymobile/scrcpy/issues/2009>
2021-01-04 08:16:32 +01:00
Romain Vimont
ed130e05d5 Fix possibly uninitialized value
Due to gotos, "ret" may be returned uninitialized.
2021-01-03 22:41:51 +01:00
clesiemo3
192fbd8450 Use --cask for latest versions of brew
PR #2004 <https://github.com/Genymobile/scrcpy/pull/2004>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-01-02 18:27:38 +01:00
Romain Vimont
c5c5fc18ae Update links to v1.17 in README and BUILD 2021-01-02 01:26:23 +01:00
Romain Vimont
f682b87ba5 Bump version to 1.17 2021-01-02 00:53:32 +01:00
Romain Vimont
10b749e27d Kill the server only after a small delay
Let the server terminate properly once all the sockets are closed.

If it does not terminate (this can happen if the device is asleep), then
kill it.

Note: since the server process termination is detected by a flag set
after waitpid() returns, there is a small chance that the process
terminates (and the PID assigned to a new process) before the flag is
set but before the kill() call. This race condition already existed
before this commit.

Fixes #1992 <https://github.com/Genymobile/scrcpy/issues/1992>
2021-01-01 23:57:01 +01:00
Romain Vimont
05e8c1a3c5 Call CloseHandle() after wait on Windows
TerminateProcess() is "equivalent" to kill(), while
WaitForSingleObject() is "equivalent" to waitpid(), so the handle must
be closed after WaitForSingleObject().
2021-01-01 23:57:01 +01:00
Romain Vimont
83910d3b9c Initialize server struct dynamically
This will allow to add mutex/cond fields.
2021-01-01 17:40:52 +01:00
Romain Vimont
90f8356630 Interrupt device threads on stop
The (non-daemon) threads were not interrupted on video stream stopped,
leaving the server process alive.

Interrupt them to wake up their blocking call so that they terminate
properly.

Refs #1992 <https://github.com/Genymobile/scrcpy/issues/1992>
2021-01-01 17:32:34 +01:00
Romain Vimont
3ba51211d6 Mention how to add default arguments on Windows
Mention that it is possible to add default arguments by editing the
wrapper scripts.
2021-01-01 17:31:07 +01:00
Romain Vimont
ea3582d2c3 Merge branch 'master' into dev 2021-01-01 17:18:13 +01:00
Romain Vimont
112adbba87 Happy new year 2021! 2021-01-01 17:16:44 +01:00
Romain Vimont
d039a7a39a Upgrade SDL (2.0.14) for Windows
Include the latest version of SDL in Windows releases.
2021-01-01 16:08:58 +01:00
Romain Vimont
6ab80e4ce8 Rename release.make to release.mk
It's more standard, and benefits from syntax coloration in vi.
2021-01-01 15:51:10 +01:00
Romain Vimont
230afd8966 Unify release makefile
Before this change, release.sh built some native stuff, and
Makefile.CrossWindows built the Windows releases.

Instead, use a single release.make to build the whole release. It also
avoids to build the server one more time.
2020-12-22 18:52:05 +01:00
Romain Vimont
a46733906a Replace noconsole binary by a wrapper script
This simplifies the build system.

Refs <https://github.com/Genymobile/scrcpy/issues/1975#issuecomment-745314161>
2020-12-22 18:51:59 +01:00
Romain Vimont
431c9ee33b Improve rotation documentation 2020-12-22 01:48:01 +01:00
Romain Vimont
43d3dcbd97 Document Windows command line usage
PR #1973 <https://github.com/Genymobile/scrcpy/pull/1973>

Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
2020-12-22 01:44:55 +01:00
Romain Vimont
a5f4f58295 Remove duplicate include 2020-12-22 01:14:30 +01:00
Romain Vimont
ea12783bbc Upgrade JUnit to 4.13 2020-12-17 10:53:35 +01:00
Romain Vimont
904d470579 Pause on error from a wrapper script
On Windows, scrcpy paused on error before exiting to give the user a
chance to see the user message.

This was a hack and causes issues when using scrcpy from batch scripts.

Disable this pause from the scrcpy binary, and provide a batch wrapper
(scrcpy-console.bat) to pause on error.

Fixes #1875 <https://github.com/Genymobile/scrcpy/issues/1875>
2020-12-14 09:44:17 +01:00
Romain Vimont
6d151eaef9 Reference encoder section from FAQ 2020-12-14 09:04:14 +01:00
Romain Vimont
5dc3285dbf Reference FFmpeg Windows builds from GitHub
Refs #1753 <https://github.com/Genymobile/scrcpy/issues/1753>
2020-12-12 16:26:08 +01:00
Romain Vimont
c9a4bdb890 Upgrade platform-tools (30.0.5) for Windows
Include the latest version of adb in Windows releases.
2020-12-12 15:56:32 +01:00
Romain Vimont
d60ac65b32 Merge branch 'master' into dev 2020-12-12 15:55:29 +01:00
jianzhang4
d6078cf202 Fix build errors for macOS
PR #1960 <https://github.com/Genymobile/scrcpy/pull/1960>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-12-12 15:50:33 +01:00
SamBe.ng
47c8971267 Document shell command to get the device IP
PR #1944 <https://github.com/Genymobile/scrcpy/pull/1944>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-12-10 21:37:23 +01:00
Romain Vimont
30434afc0a Upgrade gradle build tools to 4.0.1 2020-11-24 09:45:18 +01:00
Romain Vimont
868e762d71 Fix size_t format specifier for Windows
Use "%Iu" on Windows. This fixes the following warning:

    ../app/src/sys/win/command.c:17:14: warning: unknown conversion type character ‘l’ in format [-Wformat=]
       17 |         LOGE("Command too long (%" PRIsizet " chars)", len - 1);
2020-11-14 22:10:11 +01:00
Romain Vimont
576814bcec Document --encoder option
Add documentation for the new option --encoder in the manpage and in
README.md.
2020-11-08 21:11:12 +01:00
Romain Vimont
42ab8fd611 List available encoders on invalid name specified
If an invalid encoder name is given via the --encoder option, list all
the H.264 encoders available on the device.
2020-11-08 21:07:20 +01:00
Romain Vimont
363eeea19e Log encoder name
When the encoder is selected automatically, log the name of the selected
encoder.
2020-11-08 21:07:20 +01:00
Tzah Mazuz
76c2c6e69d Adding new option --encoder
Some devices have more than one encoder, and some encoders may cause
issues or crash. With this option we can specify which encoder we want
the device to use.

PR #1827 <https://github.com/Genymobile/scrcpy/pull/1827>
Fixes #1810 <https://github.com/Genymobile/scrcpy/issues/1810>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-11-08 21:07:17 +01:00
Romain Vimont
d5f059c7cb Add option to force legacy method for pasting
Some devices do not behave as expected when setting the device clipboard
programmatically.

Add an option --legacy-paste to change the behavior of Ctrl+v and MOD+v
so that they inject the computer clipboard text as a sequence of key
events (the same way as MOD+Shift+v).

Fixes #1750 <https://github.com/Genymobile/scrcpy/issues/1750>
Fixes #1771 <https://github.com/Genymobile/scrcpy/issues/1771>
2020-11-07 15:16:51 +01:00
Romain Vimont
adc547fa6e Add an option to forward all clicks
Add --forward-all-clicks to disable mouse shortcuts and forward middle
and right clicks to the device instead.

Fixes #1302 <https://github.com/Genymobile/scrcpy/issues/1302>
Fixes #1613 <https://github.com/Genymobile/scrcpy/issues/1613>
2020-11-03 17:12:26 +01:00
Romain Vimont
5dcfc0ebab Add local.properties to gitignore 2020-11-03 17:09:03 +01:00
Romain Vimont
ad5f567f07 Remove spurious space 2020-11-03 17:08:21 +01:00
Romain Vimont
25aff00935 Mention version of Indonesian translation 2020-10-05 21:24:59 +02:00
yanuarakhid
aade92fd10 Add Indonesian translation for README.md
PR #1802 <https://github.com/Genymobile/scrcpy/pull/1802>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-10-05 21:17:43 +02:00
Romain Vimont
83082406d3 Enable Java deprecation warnings details
Without the option, gradle reports a lint issue, but without any
details.
2020-10-05 21:11:50 +02:00
Romain Vimont
2edf192e3a Remove deprecation warning
As a workaround for some devices, we need to prepare the main looper.
The method is now deprecated, but we still want to call it.
2020-10-05 21:09:47 +02:00
Romain Vimont
d50ecf40b6 Fix options order 2020-10-01 15:08:18 +02:00
redev
15b81367c9 Fix FAQ.ko.md
PR #1767 <https://github.com/Genymobile/scrcpy/pull/1767>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-10-01 14:57:09 +02:00
Brinan Sjostrom
56d237f152 Fix "press Enter key" message
The message said "Press any key to continue...", whereas only
Enter/Return is accepted.

PR #1783 <https://github.com/Genymobile/scrcpy/pull/1783>
Fixes #1757 <https://github.com/Genymobile/scrcpy/issues/1757>

Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-10-01 14:52:24 +02:00
Romain Vimont
acc65f8c9d Remove unused field
Fixes #1775 <https://github.com/Genymobile/scrcpy/issues/1775>

Reported-by: lordnn
2020-09-20 01:11:22 +02:00
Romain Vimont
a65ebceac1 Add missing mutex unlock on error
Fixes #1770 <https://github.com/Genymobile/scrcpy/issues/1770>

Reported-by: lordnn
2020-09-20 01:11:13 +02:00