Scrcpy: The Ctrl+V function of version 1.15.1 has no effect on some devices.

Created on 10 Aug 2020  Â·  20Comments  Â·  Source: Genymobile/scrcpy

Hello, I found that when some of my Android 7.1.2 phones use version 1.15.1, the Ctrl+V key combination does not have any effect.

bug copy_paste

Most helpful comment

When I use Ctrl+Shift+V on version 1.14, it can be pasted.

All 20 comments

When I use Ctrl+Shift+V on version 1.14, it can be pasted.

Ctrl+V key combination does not have any effect.

In which apps? What if you copy some text from the device (either with Ctrl+c or with long-press, then COPY) instead of from the computer, then Ctrl+v?

Since v1.15, Ctrl+v does 2 things:

  • it copies the computer clipboard to the device clipboard
  • it injects Ctrl+v on the device (which is handled by Android/the app).

The changes between v1.14 and v1.15 could be confusing. There are 3 ways to paste:

  1. injecting Ctrl+v (not possible in v1.14, Ctrl+v in v1.15)
  2. injecting PASTE (Ctrl+Shift+v in v1.14, MOD+v in v1.15) (only works on Android >= 7)
  3. injecting the clipboard content as a sequence of key events (Ctrl+v in v1.14, MOD+Shift+v in v1.15) (see 7ad47dfaab57a7e6c7462d7e6a2798a5f122ebaf)

See https://github.com/Genymobile/scrcpy#copy-paste

When I use Ctrl+Shift+V on version 1.14

Does MOD+v work in v1.15?

I tested MOD + V, but there is no response on these Android 7.1.2 devices, but it can be pasted in version 1.14.

By the way, not all mobile phones will be like this, this problem only occurs on some Android 7.1.2 devices.

Using one of these Android 7.1.2 devices, copy some text on the computer (with Ctrl+c), copy some text on the device (long-press, COPY).

Then could you describe the result for each case:

On v1.14:

  • Ctrl+v: ?
  • Ctrl+Shift+v: ?

On v1.15.1:

  • MOD+v: ?
  • Ctrl+v: ?
  • ~Ctrl+Shift+v~ MOD+Shift+v: ?

With adb:

  • adb shell input keyevent PASTE: ?

On v1.14:
Ctrl+v: Cannot paste non-ASCII characters
Ctrl+Shift+v: Can paste non-ASCII characters

On v1.15.1:
MOD+v: No response, the clipboard is not synchronized.
Ctrl+v: No response, the clipboard is not synchronized.
Ctrl+Shift+v: No response, the clipboard is not synchronized.

With adb:
adb shell input keyevent PASTE: Can paste non-ASCII characters

Ctrl+Shift+v: No response, the clipboard is not synchronized.

Sorry, I meant MOD+Shift+v.

MOD+Shift+v,cmd returns information:
[server] WARN: Could not inject char u+5378
[server] WARN: Could not inject char u+8f7d
[server] WARN: Could not inject char u+65e7
[server] WARN: Could not inject char u+7248

Without pasting any ASCII characters?

MOD+Shift+V can paste ASCII characters.

Could you please retest MOD+v and Ctrl+v on v1.15.1 + some more logs:

diff --git a/app/src/input_manager.c b/app/src/input_manager.c
index 1d73980c..14fe73d6 100644
--- a/app/src/input_manager.c
+++ b/app/src/input_manager.c
@@ -177,6 +177,7 @@ collapse_notification_panel(struct controller *controller) {
 static void
 set_device_clipboard(struct controller *controller, bool paste) {
     char *text = SDL_GetClipboardText();
+    LOGI("Computer clipboard: \"%s\"", text);
     if (!text) {
         LOGW("Could not get clipboard text: %s", SDL_GetError());
         return;
diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java
index 9100a9db..af3fe86a 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Controller.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java
@@ -117,6 +117,7 @@ public class Controller {
                 }
                 break;
             case ControlMessage.TYPE_SET_CLIPBOARD:
+                Ln.i("Set device clipboard (" + msg.getPaste() + "): \"" + msg.getText() + "\"");
                 setClipboard(msg.getText(), msg.getPaste());
                 break;
             case ControlMessage.TYPE_SET_SCREEN_POWER_MODE:
@@ -263,6 +264,7 @@ public class Controller {

         // On Android >= 7, also press the PASTE key if requested
         if (paste && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && device.supportsInputEvents()) {
+            Ln.i("Injecting PASTE");
             device.injectKeycode(KeyEvent.KEYCODE_PASTE);
         }

diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java
index de551f35..73a38296 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Device.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Device.java
@@ -224,6 +224,7 @@ public final class Device {

         String currentClipboard = getClipboardText();
         if (currentClipboard == null || currentClipboard.equals(text)) {
+            Ln.i("Clipboard already set, ignoring");
             // The clipboard already contains the requested text.
             // Since pasting text from the computer involves setting the device clipboard, it could be set twice on a copy-paste. This would cause
             // the clipboard listeners to be notified twice, and that would flood the Android keyboard clipboard history. To workaround this

Here is a binary (replace it in you v1.15.1 release):

  • scrcpy-server
    _SHA256: 7ce7dbd7a23895308c284f047ea4c0dd529700e28d1b3b5f1a0abc873c0b94dc_

_(if you are comfortable in applying diff and build to test, please tell me, it would avoid to generate a binary next time)_

Ctrl+V:
[server] INFO: Device: ZUK Z2 Plus (Android 7.1.2)
INFO: Renderer: direct3d
INFO: Initial texture: 1080x1920
[server] INFO: Set device clipboard (false): "1276425564@&^%$155"
[server] INFO: Clipboard already set, ignoring

MOD+V
[server] INFO: Device: ZUK Z2 Plus (Android 7.1.2)
INFO: Renderer: direct3d
INFO: Initial texture: 1080x1920
[server] INFO: Set device clipboard (true): "1276425564@&^%$155"
[server] INFO: Clipboard already set, ignoring
[server] INFO: Injecting PASTE

Neither method can paste this character into the device.

In fact, I really look forward to your perfect implementation of the Ctrl+V paste method.

Oh, got it! The condition was incorrect: 80a240cbd4657b7ffb67f69df01a4c104f0cfcb7

Could you please confirm that it fixes your problem?

  • scrcpy-server
    _SHA256: 4b5378ccfa4219415dc745d8224941ed65de331179cc0c5f551ef2f214bba3f7_

Thanks, it can be pasted normally!

Thank you so much, you can publish a fixed version!

Thank you for your report and tests :+1:

Merged in dev: 95f1ea0d80e6bb61579ae6c9a50554d235d91383

you can publish a fixed version!

Yes, the bug could require to publish v1.15.2, but I think that if everything is ok with the pinch-to-zoom implementation (https://github.com/Genymobile/scrcpy/issues/24#issuecomment-671063070), I will probably just publish v1.16 soon.

Very good, I am looking forward to it!

(If you have time, I'm interested in tests/feedbacks for the pinch-to-zoom feature :wink:)

Fixed in v1.16.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonyyang924 picture tonyyang924  Â·  4Comments

qymspace picture qymspace  Â·  3Comments

targor picture targor  Â·  3Comments

SuryaElavazhagan picture SuryaElavazhagan  Â·  4Comments

udit7395 picture udit7395  Â·  4Comments