Commit graph

1764 commits

Author SHA1 Message Date
Romain Vimont
59656fe649 Fix typo in error message 2022-02-24 23:26:12 +01:00
Romain Vimont
e4bb2b8728 Add libusb error log
Log libusb_get_string_descriptor_ascii() errors.

Refs #3050 <https://github.com/Genymobile/scrcpy/issues/3050>
2022-02-24 23:25:02 +01:00
Romain Vimont
adbe7908c6 Fix icon path in README
The data/ directory was moved to app/data/.

Refs 36c75e15b8
2022-02-23 01:21:18 +01:00
Romain Vimont
49434da36e Update links to v1.23 2022-02-22 23:48:00 +01:00
Romain Vimont
7deccef1c2 Bump version to 1.23 2022-02-22 21:01:55 +01:00
Romain Vimont
977735f916 Merge branch 'master' into dev 2022-02-22 21:01:43 +01:00
Romain Vimont
71ef5cc0a9 Add missing include for vector
Include stdlib.h for realloc().
2022-02-22 21:00:43 +01:00
Romain Vimont
4ab4548769 Add contact links to the README
Add Reddit and Twitter links (and an additional link to the GitHub
issues).
2022-02-22 19:36:22 +01:00
Romain Vimont
3ce6f8ca91 Add Bash completion script
Fixes #2930 <https://github.com/Genymobile/scrcpy/issues/2930>
Refs #3012 <https://github.com/Genymobile/scrcpy/pull/3012>
2022-02-22 19:22:12 +01:00
hltdev8642
26953784d9 Add ZSH completion script
PR #3012 <https://github.com/Genymobile/scrcpy/pull/3012>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 19:15:27 +01:00
Romain Vimont
2716385887 Move "Device unauthorized" in FAQ
Put "Device not detected" first.
2022-02-22 19:12:02 +01:00
Romain Vimont
1f951f1a3a Update FAQ to match the latest version 2022-02-22 19:08:15 +01:00
Romain Vimont
6a9b2f2c36 Remove spurious empty line 2022-02-22 18:31:37 +01:00
Flying Press
ff8a69d8ec Mention adb wireless option for Android 11+
Add a paragraph about toggling an option to bypass having to physically
connect the device to the user's computer.

PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Flying Press
1693797277 Make step more explicit in wireless section
PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Flying Press
8610e9a454 Add troubleshooting in wireless section
Add a small troubleshooting section since wireless might add some
complexity, and to lessen incoming relevant issue posts.

PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Flying Press
528275d501 Improve phrasing in wireless section
PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Flying Press
78b18b7cee Renumber steps in wireless section
The actual numbers are ignored by markdown, but start at 1 for
consistency.

PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Flying Press
90816291d4 Add an explicit first step in wireless section
Mention that the device must be plugged via USB before configuring
TCP/IP connections.

It wasn't obvious that the device should be first plugged before running
scrcpy wirelessly, especially to those who aren't very familiar with
adb.

Note from committer: add this new step with index 0 to make the diff
readable, the next commit will renumber all the steps.

PR #1303 <https://github.com/Genymobile/scrcpy/pull/1303>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-22 18:27:25 +01:00
Romain Vimont
3e0df6ad05 Update HID/OTG features in README
HID/OTG features are not limited to Linux anymore.

Refs 82a99f69ec
2022-02-22 18:27:13 +01:00
Romain Vimont
79ed83ab68 Reorder --tcpip option in cli
To keep options in alphabetic order.
2022-02-22 18:10:30 +01:00
Romain Vimont
71b41d846f Also retry on IllegalArgumentException
MediaCodec.configure() may throw an IllegalArgumentException if it does
not support the requested size. Also retry on this exception.

Fixes #2993 <https://github.com/Genymobile/scrcpy/issues/2993>
Refs #2947 <https://github.com/Genymobile/scrcpy/pull/2947>
Refs #2990 <https://github.com/Genymobile/scrcpy/pull/2990>
PR #3043 <https://github.com/Genymobile/scrcpy/pull/3043>
2022-02-22 10:27:11 +01:00
Romain Vimont
e2e76c5d48 Increase adb devices -l max output size
For simplicity, the parsing of `adb devices -l` output is performed in a
single pass on the whole output.

This output was limited to 4096 bytes. Since there are about 100 chars
per device line, this limited the number of connected devices to ~40.

Increase to 65536 bytes to avoid a limitation in practice.

PR #3035 <https://github.com/Genymobile/scrcpy/pull/3035>
2022-02-21 00:03:45 +01:00
Romain Vimont
4b8cb042c4 Use vector for listing ADB devices
This avoids the hardcoded maximum number of ADB devices detected (16).

Refs #3029 <https://github.com/Genymobile/scrcpy/pull/3029>
PR #3035 <https://github.com/Genymobile/scrcpy/pull/3035>

Co-authored-by: Daniel Ansorregui <d.ansorregui@samsung.com>
2022-02-20 23:59:35 +01:00
Romain Vimont
1790e88278 Use vector for listing USB devices
This avoids the hardcoded maximum number of USB devices detected (16).

Refs #3029 <https://github.com/Genymobile/scrcpy/pull/3029>
PR #3035 <https://github.com/Genymobile/scrcpy/pull/3035>
2022-02-20 23:59:35 +01:00
Romain Vimont
c070723bc8 Add sc_vector
Adapt vlc_vector [1], that I initially wrote while implementing the VLC
playlist [2].

Change the implementation to use "statement expressions" [3], which are
forbidden in VLC because "non-standard", but:
 - they are supported by gcc and clang;
 - they are already used in the scrcpy codebase;
 - they avoid implementation hacks (VLC_VECTOR_FAILFLAG_);
 - they allow a better API (sc_vector_index_of() may return the result
   without an output parameter).

PR #3035 <https://github.com/Genymobile/scrcpy/pull/3035>

[1]: 0857947aba/include/vlc_vector.h
[2]: https://blog.rom1v.com/2019/05/a-new-core-playlist-for-vlc-4
[3]: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
2022-02-20 23:59:35 +01:00
Romain Vimont
36c75e15b8 Move data/ to app/
The files in data/ are specific to the client app (not the server).

This also avoids to reference the parent directory (../) from
app/meson.build.

Refs 8d583d36e2
2022-02-20 17:56:50 +01:00
Romain Vimont
d9bc5082ab Disable USB features for win32
Currently, there is an issue with the libusb prebuilt dll.

Refs libusb/#1049 <https://github.com/libusb/libusb/issues/1049>
PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:52 +01:00
Romain Vimont
73a5311ac6 Forbid HID input without OTG on Windows
On Windows, if the adb daemon is running, opening the USB device will
necessarily fail, so HID input is not possible.

Refs #2773 <https://github.com/Genymobile/scrcpy/issues/2773>
PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:42 +01:00
Romain Vimont
25296ae167 Kill adb daemon in OTG mode on Windows
On Windows, it is not possible to open a USB device from several
process, so HID events may only work if no adb daemon is running.

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:39 +01:00
Romain Vimont
3bb24b3926 Make intr optional for adb commands
All adb commands are executed with an "interruptor", so that they can be
interrupted on Ctrl+C.

Make this interruptor optional, so that we could call "adb kill-server"
in OTG mode. This command always returns almost immediately anyway.

Ideally, we should make all blocking calls interruptible (including
libusb calls, by using the asynchronous API), but it's a lot of work,
and in practice it works well enough.

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:36 +01:00
Romain Vimont
6ee75c0cff Remove obsolete text in error message
The HID/OTG features are now available on all platforms.

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:30 +01:00
Romain Vimont
6b65cd405a Build for Windows with libusb support
Fixes #2773 <https://github.com/Genymobile/scrcpy/issues/2773>
PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:12 +01:00
Romain Vimont
ff3cb31cb4 Fix libusb callback for Windows
Add LIBUSB_CALL so that the callback has the correct signature on
Windows (including __attribute__((stdcall))).

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:09 +01:00
Romain Vimont
06243e7c3c Avoid PRIx16 printf format on Windows
Convert uint16_t to unsigned to avoid using PRIx16, which may not exist
on Windows.

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:39:04 +01:00
Romain Vimont
b9b2879789 Remove USB hotplug callback error log
If it fails, the error is already logged by sc_usb_register_callback().

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:38:51 +01:00
Romain Vimont
be1936bb85 Report USB device disconnection when detected
USB device disconnection is detected via a hotplug callback when it is
supported.

In addition, report disconnection on libusb calls returning
LIBUSB_ERROR_NO_DEVICE or LIBUSB_ERROR_NOT_FOUND. This allows to detect
disconnection after a libusb call when hotplug is not available.

PR #3011 <https://github.com/Genymobile/scrcpy/pull/3011>
2022-02-20 17:38:14 +01:00
Romain Vimont
3ee3f8dc02 Work around mouse capture SDL bug on macOS
On macOS, SDL relative mouse mode does not work correctly when the
cursor is outside the window.

As a workaround, move the cursor inside the window before setting the
relative mouse mode.

Refs SDL/#5340 <https://github.com/libsdl-org/SDL/issues/5340>
PR #3031 <https://github.com/Genymobile/scrcpy/pull/3031>
2022-02-20 17:28:02 +01:00
Romain Vimont
9db42341e4 Pass screen instance to mouse capture functions
Using the screen instance or not in these functions is an implementation
detail. Further changes will require the screen instance.

Refs 7848a387c8
PR #3031 <https://github.com/Genymobile/scrcpy/pull/3031>
2022-02-20 17:27:53 +01:00
Romain Vimont
82a99f69ec Remove "linux-only" mentions for HID/OTG features
HID/OTG features are not limited to Linux anymore.

PR #3031 <https://github.com/Genymobile/scrcpy/pull/3031>
2022-02-20 17:27:43 +01:00
Romain Vimont
33202491e1 Build on macOS with libusb support
Fixes #2774 <https://github.com/Genymobile/scrcpy/issues/2774>
PR #3031 <https://github.com/Genymobile/scrcpy/pull/3031>
2022-02-20 17:27:22 +01:00
Romain Vimont
b4fd882ece Fix typo 2022-02-20 17:21:25 +01:00
Romain Vimont
c4ab65eb79 Remove useless '\n' in log 2022-02-18 21:18:36 +01:00
Romain Vimont
6edf50d447 Remove fprintf() in tests
It was committed by mistake.
2022-02-18 19:34:54 +01:00
Romain Vimont
4b018be789 Add --print-fps to enable FPS counter on start
The FPS counter could be enabled/disabled via MOD+i.

Add a command line option to enable it on start. This is consistent with
other features like --turn-screen-off or --fullscreen.

Fixes #468 <https://github.com/Genymobile/scrcpy/issues/468>
PR #3030 <https://github.com/Genymobile/scrcpy/pull/3030>
2022-02-18 18:16:50 +01:00
Romain Vimont
fa93c8a91b Move FPS counter start/stop logs
This will allow to print the same logs for every start/stop call.

PR #3030 <https://github.com/Genymobile/scrcpy/pull/3030>
2022-02-18 18:16:12 +01:00
Romain Vimont
0e22032710 Update FAQ about Windows scaling behavior
Recommend to update to v1.22 before suggesting manual configuration.

Fixes #3028 <https://github.com/Genymobile/scrcpy/issues/3028>
PR #3032 <https://github.com/Genymobile/scrcpy/pull/3032>
2022-02-18 18:13:35 +01:00
Romain Vimont
03705b828b Use sc_prefix for fps counter 2022-02-17 19:55:24 +01:00
Firq
7a138c6929 Fix links in German README
There were three links that weren't displayed correctly due to incorrect
references:
 - the Windows release link to `README.md#windows`
 - 2 links that expected a German reference but got an English reference

PR #3026 <https://github.com/Genymobile/scrcpy/pull/3026>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-02-16 20:44:09 +01:00
Romain Vimont
85edba20e7 Enforce deadline reached on timeout
The value of sc_tick_now() has microsecond precision, but
sc_cond_timedwait() has only millisecond precision.

To guarantee that sc_tick_now() >= deadline when sc_cond_timedwait()
returns due to timeout, round up to the next millisecond.

This avoids to call a non-blocking sc_cond_timedwait() in a loop for no
reason until a target deadline during up to 1 millisecond.

Refs 682a691173
2022-02-16 18:29:30 +01:00