2021年4月16日 星期五

使用 scrcpy 操作手機 (Gentoo)

先來張擷圖,可以透過電腦來操作手機,是蠻方便的,而且可以在 Linux 下使用。

Gentoo 官方的 portage 沒有 scrcpy 這軟體,必須找 overlay 的 ebuild。

安裝好後,第一次執行

ajax@aj-i7 ~ $ scrcpy
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
exec: No such file or directory
ERROR: Command not found: [adb], [push], [/usr/share/scrcpy/scrcpy-server], [/data/local/tmp/scrcpy-server.jar]
ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
INFO: You may install 'adb' by "apt install adb"
ERROR: Could not execute "adb push"

找不到 adb 指令,關於 Gentoo 的 adb 說明: Android/adb

安裝 dev-util/android-tools package 之後再執行

ajax@aj-i7 ~ $ scrcpy
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
* daemon not running; starting now at tcp:5037
* daemon started successfully
adb: error: failed to get feature set: no devices/emulators found
ERROR: "adb push" returned with value 1

需要在手機開啟 USB debug,這個無需 root,一般是在 [系統資訊] 的某個項目上點 7下,就會出現開發者選項。

再次執行

ajax@aj-i7 ~ $ scrcpy
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 1.3 MB/s (34930 bytes in 0.025s)
[server] INFO: Device: samsung SM-A315G (Android 10)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
	at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
	at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2789)
	at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:113)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:94)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
	at com.genymobile.scrcpy.Server.main(Server.java:252)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:342)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 460.56
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400
WARN: Device disconnected

還是不行,但只差一步了,指令要加解析度

ajax@aj-i7 ~ $ scrcpy -m 1080
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 5.6 MB/s (34930 bytes in 0.006s)
[server] INFO: Device: samsung SM-A315G (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 460.56
INFO: Trilinear filtering enabled
INFO: Initial texture: 488x1080
  ==> 連上手機,開啟手機螢幕視窗
....
  ==> 關閉手機螢幕視窗
WARN: Killing the server...


旋轉90度的指令 "scrcpy -m 1080  --lock-video-orientation 1"


使用 appimage

 media-sound/jack2





沒有留言:

張貼留言

網誌存檔