Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
110.7k stars 10.61k forks source link

use .\scrcpy.exe -M error #4751

Closed 17ayst closed 7 months ago

17ayst commented 7 months ago

Environment

Describe the bug .\scrcpy.exe -M error

On errors, please provide the output of the console (and adb logcat if relevant).

java.io.IOException: android.system.ErrnoException: write failed: ENOTSUP (Operation not supported on transport endpoint)
        at com.genymobile.scrcpy.UhidManager.open(UhidManager.java:66)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:208)
        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:764)
Caused by: android.system.ErrnoException: write failed: ENOTSUP (Operation not supported on transport endpoint)
        at libcore.io.Linux.writeBytes(Native Method)
        at libcore.io.Linux.write(Linux.java:288)
        at libcore.io.BlockGuardOs.write(BlockGuardOs.java:345)
        at android.system.Os.write(Os.java:621)
        at com.genymobile.scrcpy.UhidManager.open(UhidManager.java:58)
        ... 5 more
[server] ERROR: Failed to close uhid: close failed: EBADF (Bad file descriptor)
INFO: Renderer: direct3d
WARN: Demuxer 'audio': stream explicitly disabled by the device
ERROR: Demuxer 'video': stream disabled due to connection error
ERROR: Demuxer error
17ayst commented 7 months ago

The reason is that the Android version is too low

anotheruserofgithub commented 6 months ago

@17ayst What's the output of adb shell cat /ueventd.rc, if this file exists on your device?

I have a (custom ROM and rooted) 8.1.0 device and uhid is available (but uinput requires root access):

/dev/uhid                 0660   uhid       uhid
/dev/uinput               0660   system     bluetooth

See also https://github.com/Genymobile/scrcpy/pull/4473#issuecomment-2057798824.

17ayst commented 6 months ago

like this:

subsystem adf
    devname uevent_devname

subsystem graphics
    devname uevent_devpath
    dirname /dev/graphics

subsystem drm
    devname uevent_devpath
    dirname /dev/dri

subsystem oncrpc
    devname uevent_devpath
    dirname /dev/oncrpc

subsystem adsp
    devname uevent_devpath
    dirname /dev/adsp

subsystem msm_camera
    devname uevent_devpath
    dirname /dev/msm_camera

subsystem input
    devname uevent_devpath
    dirname /dev/input

subsystem mtd
    devname uevent_devpath
    dirname /dev/mtd

subsystem sound
    devname uevent_devpath
    dirname /dev/snd

# ueventd can only set permissions on device nodes and their associated
# sysfs attributes, not on arbitrary paths.
#
# format for /dev rules: devname mode uid gid
# format for /sys rules: nodename attr mode uid gid
# shortcut: "mtd@NN" expands to "/dev/mtd/mtdNN"

/dev/null                 0666   root       root
/dev/zero                 0666   root       root
/dev/full                 0666   root       root
/dev/ptmx                 0666   root       root
/dev/tty                  0666   root       root
/dev/random               0666   root       root
/dev/urandom              0666   root       root
# Make HW RNG readable by group system to let EntropyMixer read it.
/dev/hw_random            0440   root       system
/dev/ashmem               0666   root       root
/dev/binder               0666   root       root
/dev/hwbinder             0666   root       root
/dev/vndbinder            0666   root       root

/dev/pmsg0                0222   root       log

# the msm hw3d client device node is world writable/readable.
/dev/msm_hw3dc            0666   root       root

# gpu driver for adreno200 is globally accessible
/dev/kgsl                 0666   root       root

# kms driver for drm based gpu
/dev/dri/*                0666   root       graphics

# these should not be world writable
/dev/diag                 0660   radio      radio
/dev/diag_arm9            0660   radio      radio
/dev/ttyMSM0              0600   bluetooth  bluetooth
/dev/uhid                 0660   uhid       uhid
/dev/uinput               0660   system     bluetooth
/dev/alarm                0664   system     radio
/dev/rtc0                 0640   system     system
/dev/tty0                 0660   root       system
/dev/graphics/*           0660   root       graphics
/dev/msm_hw3dm            0660   system     graphics
/dev/input/*              0660   root       input
/dev/eac                  0660   root       audio
/dev/cam                  0660   root       camera
/dev/pmem                 0660   system     graphics
/dev/pmem_adsp*           0660   system     audio
/dev/pmem_camera*         0660   system     camera
/dev/oncrpc/*             0660   root       system
/dev/adsp/*               0660   system     audio
/dev/snd/*                0660   system     audio
/dev/mt9t013              0660   system     system
/dev/msm_camera/*         0660   system     system
/dev/akm8976_daemon       0640   compass    system
/dev/akm8976_aot          0640   compass    system
/dev/akm8973_daemon       0640   compass    system
/dev/akm8973_aot          0640   compass    system
/dev/bma150               0640   compass    system
/dev/cm3602               0640   compass    system
/dev/akm8976_pffd         0640   compass    system
/dev/lightsensor          0640   system     system
/dev/msm_pcm_out*         0660   system     audio
/dev/msm_pcm_in*          0660   system     audio
/dev/msm_pcm_ctl*         0660   system     audio
/dev/msm_snd*             0660   system     audio
/dev/msm_mp3*             0660   system     audio
/dev/audience_a1026*      0660   system     audio
/dev/tpa2018d1*           0660   system     audio
/dev/msm_audpre           0660   system     audio
/dev/msm_audio_ctl        0660   system     audio
/dev/htc-acoustic         0660   system     audio
/dev/vdec                 0660   system     audio
/dev/q6venc               0660   system     audio
/dev/snd/dsp              0660   system     audio
/dev/snd/dsp1             0660   system     audio
/dev/snd/mixer            0660   system     audio
/dev/smd0                 0640   radio      radio
/dev/qmi                  0640   radio      radio
/dev/qmi0                 0640   radio      radio
/dev/qmi1                 0640   radio      radio
/dev/qmi2                 0640   radio      radio
/dev/bus/usb/*            0660   root       usb
/dev/mtp_usb              0660   root       mtp
/dev/usb_accessory        0660   root       usb
/dev/tun                  0660   system     vpn

# CDMA radio interface MUX
/dev/ts0710mux*           0640   radio      radio
/dev/ppp                  0660   radio      vpn

# sysfs properties
/sys/devices/platform/trusty.*      trusty_version        0440  root   log
/sys/devices/virtual/input/input*   enable      0660  root   input
/sys/devices/virtual/input/input*   poll_delay  0660  root   input
/sys/devices/virtual/usb_composite/*   enable      0664  root   system
/sys/devices/system/cpu/cpu*   cpufreq/scaling_max_freq   0664  system system
/sys/devices/system/cpu/cpu*   cpufreq/scaling_min_freq   0664  system system

# DVB API device nodes
/dev/dvb*                 0660   root       system
anotheruserofgithub commented 6 months ago

Thanks! So the question is whether you user is granted the uhid group permission. What is the output of adb shell groups?

yume-chan commented 6 months ago

Or maybe the Linux kernel doesn't support new UHID commands. The stack trace shows open was successful but write wasn't.

if the event ID is not supported, it will return -EOPNOTSUPP.

https://www.kernel.org/doc/html/v5.14/hid/uhid.html

Copilot says the new commands were added in version 4.17.

anotheruserofgithub commented 6 months ago

Or maybe the Linux kernel doesn't support new UHID commands. The stack trace shows open was successful but write wasn't.

Fair enough! :)

Copilot says the new commands were added in version 4.17.

Although they seem to exist since v3.15 (2014): https://github.com/torvalds/linux/commit/4522643aa9630be17238edf1b4c0b690c5dd7f5d

@17ayst What is the kernel version of your device?

17ayst commented 6 months ago

Sorry for the delay, I was quite busy and forgot to respond earlier. kernel version is 3.10.73-yesimxev.

17ayst commented 6 months ago

It seems the issue lies here; the version is less than v3.15.

anotheruserofgithub commented 6 months ago

Yes that makes sense. Thanks for your replies! :)