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 and keyboard #4984

Open
ozntyr opened this issue Jun 12, 2024 · 2 comments
Open

mouse and keyboard #4984

ozntyr opened this issue Jun 12, 2024 · 2 comments

Comments

@ozntyr
Copy link

ozntyr commented Jun 12, 2024

Environment

  • OS: WIN10
  • scrcpy version: scrcpy-win64-v2.4
  • installation method: Windows release (installation date: 12/06/2024)
  • device model: POCO X6 Pro 5G
  • Android version: 14 UP1A.230905.011 ( hyperos 1.0.8.0.UNLMIXM)

Describe the bug
found this on a yt video and followed it. the screen mirroring works and I can hear the sounds but it doesn't register keyboard and mouse inputs. in the video it showed how to do it on wifi too and while trying that I found that it gives the following errors when I try to click anywhere

Microsoft Windows [Version 10.0.19045.4170]
(c) Microsoft Corporation. Tüm hakları saklıdır.

C:\Users\Ozntyr\Desktop\scrcpy-win64-v2.4>scrcpy
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
ERROR: Multiple (2) ADB devices:
ERROR:     -->   (usb)  UWKRCAS8G6HU6LH6                device  2311DRK48G
ERROR:     --> (tcpip)  192.168.1.162:5555              device  2311DRK48G
ERROR: Select a device via -s (--serial), -d (--select-usb) or -e (--select-tcpip)
ERROR: Server connection failed

C:\Users\Ozntyr\Desktop\scrcpy-win64-v2.4>scrcpy
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)  192.168.1.162:5555              device  2311DRK48G
C:\Users\Ozntyr\Desktop\scrcpy-win64-v2.4\scrcpy-server: 1 file pushed, 0 skipped. 35.0 MB/s (69007 bytes in 0.002s)
[server] INFO: Device: [Xiaomi] POCO 2311DRK48G (Android 14)
INFO: Renderer: direct3d
INFO: Texture: 1216x2712
[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:58)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:230)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:234)
        at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:362)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:162)
        at com.genymobile.scrcpy.Controller.control(Controller.java:97)
        at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:105)
        at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
        at android.os.Parcel.createException(Parcel.java:3041)
        at android.os.Parcel.readException(Parcel.java:3024)
        at android.os.Parcel.readException(Parcel.java:2966)
        at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1590)
        at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1217)
        at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1227)
        ... 10 more
Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.input.InputManagerService.injectInputEventToTarget(InputManagerService.java:912)
        at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:752)
        at android.os.Binder.execTransactInternal(Binder.java:1346)
        at android.os.Binder.execTransact(Binder.java:1282)

[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:58)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:230)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:234)
        at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:362)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:162)
        at com.genymobile.scrcpy.Controller.control(Controller.java:97)
        at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:105)
        at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
        at android.os.Parcel.createException(Parcel.java:3041)
        at android.os.Parcel.readException(Parcel.java:3024)
        at android.os.Parcel.readException(Parcel.java:2966)
        at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1590)
        at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1217)
        at android.hardware.input.InputManagerGlobal.injectInputEvent(InputManagerGlobal.java:1227)
        ... 10 more
INFO: Texture: 2712x1216
INFO: Texture: 1216x2712
INFO: Texture: 2712x1216
INFO: Texture: 1216x2712
INFO: Texture: 2712x1216
INFO: Texture: 1216x2712
INFO: Texture: 2712x1216

@rom1v
Copy link
Collaborator

rom1v commented Jun 12, 2024

Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.

Please read: https://github.com/Genymobile/scrcpy#prerequisites

@ozntyr
Copy link
Author

ozntyr commented Jun 12, 2024

oohhh you mean this:
"On some devices, you also need to enable #70 (comment) USB debugging (Security Settings) (this is an item different from USB debugging) to control it using a keyboard and mouse. Rebooting the device is necessary once this option is set."
ok I'll try that. thanks, also I just tried -M and -K and they work fine I just need to alt+tab to exit

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

2 participants