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

Mouse clicks do not work #70

Closed
Pong420 opened this issue Mar 15, 2018 · 86 comments
Closed

Mouse clicks do not work #70

Pong420 opened this issue Mar 15, 2018 · 86 comments

Comments

@Pong420
Copy link

Pong420 commented Mar 15, 2018

I am using Xiaomi max 2 on macOS High Sierra 10.13.3

scrcpy v1.0

dependencies:
 - SDL 2.0.8
 - libavcodec 57.107.100
 - libavformat 57.83.100
 - libavutil 55.78.100
@izayl
Copy link

izayl commented Mar 15, 2018

Xiaomi Mi 6 has the same issue

@izayl
Copy link

izayl commented Mar 15, 2018

@Pong420 Maybe this issue can fix. But I have not test it.

@Pong420
Copy link
Author

Pong420 commented Mar 15, 2018

@izayl It seems to not be working for me

@rom1v
Copy link
Collaborator

rom1v commented Mar 15, 2018

Duplicate of #18.

Already fixed on v1.1.

@izayl
Copy link

izayl commented Mar 15, 2018

@rom1v I have pull the newest code of master. But the problem still exist.

@rom1v
Copy link
Collaborator

rom1v commented Mar 15, 2018

scrcpy -v

?

@rom1v
Copy link
Collaborator

rom1v commented Mar 15, 2018

Did you compile using prebuilt server v1.1?

@Pong420
Copy link
Author

Pong420 commented Mar 15, 2018

sorry, how to check prebuilt server version?

v1.1 still not work

scrcpy v1.1

dependencies:
 - SDL 2.0.8
 - libavcodec 57.107.100
 - libavformat 57.83.100
 - libavutil 55.78.100

@izayl
Copy link

izayl commented Mar 15, 2018

I find the reason of the issue,switch below option for obtain the permission of simulating Input

image

@rom1v
Copy link
Collaborator

rom1v commented Mar 15, 2018

Did you compile everything, or downloaded the prebuilt server (the Android part)?

If you don't know, please give the result of:

mesonconf x

(from the scrcpy root directory)

@Pong420
Copy link
Author

Pong420 commented Mar 15, 2018

Solved, enable the permission of simulating Input work for me

Thanks all

@Pong420 Pong420 closed this as completed Mar 15, 2018
@rom1v
Copy link
Collaborator

rom1v commented Mar 15, 2018

@izayl Thank you very much! I added a question in the FAQ.

@moamahi
Copy link

moamahi commented Jun 13, 2018

Ciao guys. Thank you so much for great work!
I'm on a vernee mix 2 (not a grat phone and probably a corner case).
I'm not able to click with left mouse. Only right. Unfortunately I can't find that option in my menu (doesn't exist at all). Is there a way for sending the option via ABD?
Using Windows (10 64bit)
I've tryed 1.0 1.1 1.2 (64bit) Vernee mix run android 7.0 security patch nov. 2017

@halilozercan
Copy link

Nokia 8 does not have that option in developer settings. My problem turned out be a slightly weird one. If I move scrcpy window from the screen it started on to a different monitor, mouse inputs become unreponsive.

@rom1v
Copy link
Collaborator

rom1v commented Oct 18, 2018

@halilozercan #15

@ghost
Copy link

ghost commented Jun 13, 2019

the screen off mirroring function does not work with either Ctrl+
o or terminal command …it says “unrecognised option”
help please.. my phone is poco F1

@rom1v
Copy link
Collaborator

rom1v commented Jun 14, 2019

the screen off mirroring function does not work with either Ctrl+o or terminal command …it says “unrecognised option”

(please do not post on an unrelated issue)

You need scrcpy v1.9.

scrcpy --version

@xx299x
Copy link

xx299x commented Aug 6, 2019

Xiaomi Mi 6 has the same issue

My Xiaomi Mi 6 no problem in windows.

@dottyunnan
Copy link

I want to know recording MP4's format.

@Ggot
Copy link

Ggot commented Jan 3, 2020

why my android OPPO R15 no USB debugging(Security settings) option? so I cannot click my simulating screen .

@mochadwi
Copy link

mochadwi commented Jan 16, 2020

thanks this happened in xiaomi smartphone, but also occurred in a few devices like Oppo @Pong420

@n-3rd23
Copy link

n-3rd23 commented Apr 15, 2020

thank you enabling USB debugging (security settings) worked on my phone mi 4

@vajra108
Copy link

Thanks you @imkkdev I am using Xiaomi Mi11t Lite MIUI13/ Android 12 Phone, I can confirm it works after set the USB debug security settings and reboot, reboot is must!

omg so much time lost because I didn't reboot, thank you!

@rom1v
Copy link
Collaborator

rom1v commented Mar 23, 2023

@vajra108 Thank you, I just mentioned it in the doc: 21df2c2

@F640
Copy link

F640 commented Mar 26, 2023

My Device: Xiaomi M2101K6G (Android 12)

It does not work as it requires a connection or account to Xiaomi but since I don't want an account, it will never work, unless someone finds the app that we can remove to bypass this.

xiaomi-usb

You can just make a throwaway Mi account in browser with disposable (or throwaway or temporary) email services, and fill fake info if they ask for while making Mi account. Create account, sign in, turn on, then sign out. Rebooting your device also recommended afterwards. Just hope they won't ask your phone number.

@Jamalalqale
Copy link

Just disable the MIUI optimization

@owenstake
Copy link

Thanks you @imkkdev I am using Xiaomi Mi11t Lite MIUI13/ Android 12 Phone, I can confirm it works after set the USB debug security settings and reboot, reboot is must!

reboot save my day!

@kilo1994
Copy link

Running Android 14 on the Pixel 7 Pro. No "USB debugging (Security Settings)" option under Develop
image

@rom1v
Copy link
Collaborator

rom1v commented Oct 31, 2023

On Android 14, use the latest version (v2.1.1 currently)

@kilo1994
Copy link

That did it, thanks!

@eevmanu
Copy link

eevmanu commented Apr 7, 2024

On Android 14, use the latest version (v2.1.1 currently)

thx @rom1v


to anyone who could find this helpful, the version I had via apt isn't equal or greater than v2.1.1 ...

$ apt show scrcpy 2>/dev/null | grep -i version
Version: 1.17-1

... neither the version from snap

$ snap info scrcpy | grep -A 4 channels
channels:
  latest/stable:    v1.25             2022-12-28 (399)  87MB -
  latest/candidate: ^
  latest/beta:      v1.25-1-g4c43784f 2022-12-28 (401)  87MB -
  latest/edge:      v1.21-2-g5704ec6  2021-12-07 (358) 101MB -

because I was having this error

error stack trace
[server] ERROR: Exception on thread Thread[Thread-2,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
	at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:75)
	at com.genymobile.scrcpy.Device.injectEvent(Device.java:192)
	at com.genymobile.scrcpy.Device.injectEvent(Device.java:196)
	at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:231)
	at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:102)
	at com.genymobile.scrcpy.Controller.control(Controller.java:79)
	at com.genymobile.scrcpy.Server$3.run(Server.java:132)
	at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:72)
	... 7 more
Caused by: java.lang.NullPointerException
	at java.util.Objects.requireNonNull(Objects.java:207)
	at android.hardware.input.InputManager.getInstance(InputManager.java:274)
	... 9 more

so the only way I had was building by myself, thx for the guide and the prebuilt server, with that everything was really easy

$ meson setup x --buildtype=release --strip -Db_lto=true -Dprebuilt_server=/path/to/scrcpy-server

output
The Meson build system
Version: 0.56.2
Source dir: "${HOME}"/tmp/scrcpy
Build dir: "${HOME}"/tmp/scrcpy/x
Build type: native build
Project name: scrcpy
Project version: 2.4
C compiler for the host machine: cc (gcc 11.2.0 "cc (Ubuntu 11.2.0-7ubuntu2) 11.2.0")
C linker for the host machine: cc ld.bfd 2.37
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency libavformat found: YES 58.76.100
Run-time dependency libavcodec found: YES 58.134.100
Run-time dependency libavutil found: YES 56.70.100
Run-time dependency libswresample found: YES 3.9.100
Run-time dependency sdl2 found: YES 2.0.14
Run-time dependency libavdevice found: YES 58.13.100
Run-time dependency libusb-1.0 found: YES 1.0.24
Checking for function "strdup" : YES
Checking for function "asprintf" : YES
Checking for function "vasprintf" : YES
Checking for function "nrand48" : YES
Checking for function "jrand48" : YES
Checking for function "reallocarray" : YES
Header <sys/socket.h> has symbol "SOCK_CLOEXEC" : YES
Configuring config.h using configuration
Build targets in project: 2

Found ninja-1.10.1 at /usr/bin/ninja

$ ninja -Cx

output
ninja: Entering directory `x'
[69/69] Linking target app/scrcpy

@Step72
Copy link

Step72 commented Apr 17, 2024

I use scrcpy on mac os 14.4.1 and redmi note 12 with android 14 but impossible to make the mouse click work!
Capture d’écran 2024-04-17 à 17 09 03

@rom1v
Copy link
Collaborator

rom1v commented Apr 17, 2024

@Step72
Copy link

Step72 commented Apr 17, 2024

@rom1v I can't validate my phone! Every time I have an error no found
Capture d’écran 2024-04-17 à 18 22 59

@rom1v
Copy link
Collaborator

rom1v commented Apr 17, 2024

scrcpy --otg -s 6da1ded7

@Step72
Copy link

Step72 commented Apr 17, 2024

if I put scrcpy --otg -s 6da1ded7 I can no longer use my mouse for my computer! This completely dooms my mouse to my phone. Why when I click on, for example, an application on my phone does it not open for me?

look here

@rom1v
Copy link
Collaborator

rom1v commented Apr 17, 2024

It's OTG mode. If you don't want OTG mode, then don't pass --otg. What do you want to do?

@Step72
Copy link

Step72 commented Apr 18, 2024

Watch this video
Why does it not open when I click on for exemple the Facebook app? On the other hand, if we look to the left at the terminal, we can clearly see that something is working!

If I run scrcpy --otg -s 6da1ded7 The mouse in my computer no longer works with my computer, computer! It is dedicated only to my phone. How can I simply press a key on the phone screen from the computer, for example Teamvier ?

@Step72
Copy link

Step72 commented Apr 18, 2024

It's okay, it works perfectly.
permettre d'accorder des autorisations et de simuler une entrée via USB Was not activated
Capture d’écran 2024-04-18 à 12 04 56

On the other hand, is it possible to wake the phone when it goes to sleep?

@InternetTourrer
Copy link

Hi I might be missing something obvious here but I can't find the option for "USB debugging (Security Settings)" I am on the latest version and have enabled just "USB Debugging" and cannot get mouse or keyboard to work. (Using Samsung Z Fold 3)
Screenshot_20240617_225012_Settings

@rom1v
Copy link
Collaborator

rom1v commented Jun 18, 2024

What is the full console output when you run scrcpy?

@llinfeng
Copy link

llinfeng commented Jul 6, 2024

... I can't find the option for "USB debugging (Security Settings)" I am on the latest version and have enabled just "USB Debugging" and cannot get mouse or keyboard to work. (Using Samsung Z Fold 3)

Likewise, I cannot get mouse nor keyboard to work on a Samsung Tab S9 (Android 14). I can only see what's on the tablet's screen. I think this can be something new after upgrading this tablet to Android 14.

What is the full console output when you run scrcpy?

Here is what I directly see when running `scrcpy` in Windows command-line (after having connected to the Samsung tablet through adb) on this tablet.
c:\programdata\chocolatey\lib\scrcpy\tools\scrcpy-server: 1 file pushed, 0 skipped. 74.7 MB/s (41159 bytes in 0.001s)
[server] INFO: Device: samsung SM-X710 (Android 14)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.addPrimaryClipChangedListener [interface android.content.IOnPrimaryClipChangedListener, class java.lang.String, int]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:103)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:111)
        at com.genymobile.scrcpy.Device.<init>(Device.java:103)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:65)
        at com.genymobile.scrcpy.Server.main(Server.java:335)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:385)
INFO: Renderer: direct3d
INFO: Initial texture: 1600x2560
[server] ERROR: Exception on thread Thread[Thread-2,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
        at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:65)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:195)
        at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:206)
        at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:210)
        at com.genymobile.scrcpy.Controller.injectKeycode(Controller.java:148)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:88)
        at com.genymobile.scrcpy.Controller.control(Controller.java:75)
        at com.genymobile.scrcpy.Server$3.run(Server.java:133)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:62)
        ... 8 more
Caused by: java.lang.NullPointerException
        at java.util.Objects.requireNonNull(Objects.java:207)
        at android.hardware.input.InputManager.getInstance(InputManager.java:401)
        ... 10 more
And, similarly, with a Samsung S22 Ultra.

Here, I noticed that the first [server] ERROR is logged immediately upon connection. The second [server] ERROR is logged when I tried to send a right-mouse-click.

c:\programdata\chocolatey\lib\scrcpy\tools\scrcpy-server: 1 file pushed, 0 skipped. 53.2 MB/s (41159 bytes in 0.001s)
[server] INFO: Device: samsung SM-S908U1 (Android 14)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.addPrimaryClipChangedListener [interface android.content.IOnPrimaryClipChangedListener, class java.lang.String, int]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:103)
        at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:111)
        at com.genymobile.scrcpy.Device.<init>(Device.java:103)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:65)
        at com.genymobile.scrcpy.Server.main(Server.java:335)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:385)
INFO: Renderer: direct3d
INFO: Initial texture: 720x1544
[server] ERROR: Exception on thread Thread[Thread-2,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
        at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:65)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:195)
        at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:206)
        at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:210)
        at com.genymobile.scrcpy.Controller.pressBackOrTurnScreenOn(Controller.java:264)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:108)
        at com.genymobile.scrcpy.Controller.control(Controller.java:75)
        at com.genymobile.scrcpy.Server$3.run(Server.java:133)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.ServiceManager.getInputManager(ServiceManager.java:62)
        ... 8 more
Caused by: java.lang.NullPointerException
        at java.util.Objects.requireNonNull(Objects.java:207)
        at android.hardware.input.InputManager.getInstance(InputManager.java:401)
        ... 10 more

@rom1v Please advise if there is a scrcpy flag for more verbose logs if the logs above are too preliminary.

@rom1v
Copy link
Collaborator

rom1v commented Jul 6, 2024

What is your scrcpy version? I guess you don't use the latest version (currently 2.5).

@llinfeng
Copy link

llinfeng commented Jul 6, 2024

Indeed, I was using old scrcpy previously (v1.24). Upgrading to v2.4.0 solved the issue already. (I ran choco upgrade scrcpy to upgrade.)

@elias8808
Copy link

I can't use my mouse or keyboard. Has anyone found a solution?

@elias8808
Copy link

solved. you must enable "usb debugging security settings" on your cell phone and then when connecting the cell phone to the PC, you must select "file transfer". this is how it worked for me.

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

No branches or pull requests