rk3588_t:/ # settings put system accelerometer_rotation 0
rk3588_t:/ # settings put system user_rotation 0
rk3588_t:/ # settings put system user_rotation 1
rk3588_t:/ # settings put system user_rotation 2
rk3588_t:/ # settings put system user_rotation 3
20251202使用input命令模拟物理旋转让荣品RD-RK3588-MID开发板的LCD屏旋转90度
2025/12/2 19:16
Microsoft Windows [版本 10.0.19045.6216]
(c) Microsoft Corporation。保留所有权利。
C:\Users\QQ>adb shell
rk3588_t:/ $ su
rk3588_t:/ #
rk3588_t:/ # settings put system accelerometer_rotation 0
rk3588_t:/ # settings put system user_rotation 0
rk3588_t:/ #
rk3588_t:/ # settings put system user_rotation 1
rk3588_t:/ #
rk3588_t:/ # settings put system user_rotation 2
rk3588_t:/ #
rk3588_t:/ # settings put system user_rotation 3
rk3588_t:/ #
rk3588_t:/ # settings put system user_rotation 4
Exception occurred while executing 'put':
java.lang.IllegalArgumentException: Invalid value: 4 for setting: user_rotation
at com.android.providers.settings.SettingsProvider.validateSystemSettingValue(SettingsProvider.java:1972)
at com.android.providers.settings.SettingsProvider.mutateSystemSetting(SettingsProvider.java:1940)
at com.android.providers.settings.SettingsProvider.insertSystemSetting(SettingsProvider.java:1856)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:468)
at android.content.ContentProvider.call(ContentProvider.java:2511)
at android.content.ContentProvider$Transport.call(ContentProvider.java:525)
at com.android.providers.settings.SettingsService$MyShellCommand.putForUser(SettingsService.java:382)
at com.android.providers.settings.SettingsService$MyShellCommand.onCommand(SettingsService.java:278)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.providers.settings.SettingsService.onShellCommand(SettingsService.java:50)
at android.os.Binder.shellCommand(Binder.java:1049)
at android.os.Binder.onTransact(Binder.java:877)
at android.os.Binder.execTransactInternal(Binder.java:1285)
at android.os.Binder.execTransact(Binder.java:1244)
255|rk3588_t:/ #
255|rk3588_t:/ #


rk3588_t:/ # settings put system user_rotation 0
rk3588_t:/ #

rk3588_t:/ # settings put system user_rotation 1
rk3588_t:/ #

rk3588_t:/ # settings put system user_rotation 2
rk3588_t:/ #

rk3588_t:/ # settings put system user_rotation 3

https://chat.deepseek.com/a/chat/s/520fa508-bc6c-484d-9fcf-a40fc294768f
RK3588 Android13屏幕旋转命令指南
RK3588的Android13,请问如何使用命令旋转屏幕?
在Android中,屏幕旋转通常可以通过设置系统属性或者使用窗口管理器(WindowManager)来实现。在RK3588的Android13上,我们可以尝试以下几种方法:
使用settings命令修改系统设置中的用户旋转状态。
使用wm命令设置屏幕旋转。
直接设置系统属性persist.demo.hdmirotation或类似属性(这取决于设备制造商,RK平台可能有自己的实现)。
但是,请注意,不同的设备制造商可能会有不同的实现方式。在RK3588上,通常可以通过设置系统属性ro.sf.hwrotation来在启动时旋转屏幕,但这需要重启才能生效。对于动态旋转,我们通常使用Android提供的标准方法。
下面介绍两种常用的命令方法:
方法一:使用settings命令
Android提供了settings命令来修改系统设置。我们可以通过修改accelerometer_rotation(是否允许自动旋转)和user_rotation(用户选择的旋转角度)来实现。
首先,关闭自动旋转,然后设置旋转角度:
bash
# 关闭自动旋转
settings put system accelerometer_rotation 0
# 设置旋转角度(0、90、180、270)
settings put system user_rotation 0
其中,旋转角度可以是0(0度)、1(90度)、2(180度)、3(270度)。
方法二:使用wm命令
wm命令可以直接设置屏幕的旋转角度。
bash
# 设置屏幕旋转角度(0、90、180、270)
wm rotation 0
注意:wm命令在Android中可能已经被移除或限制,但在一些系统上仍然可用。如果不可用,可以尝试使用settings命令。
方法三:使用系统属性(特定平台)
在RK平台上,有时可以通过设置系统属性persist.demo.hdmirotation来旋转HDMI显示,但这可能不是标准方法,并且可能因系统版本而异。
例如,设置HDMI旋转90度:
bash
setprop persist.demo.hdmirotation 90
然后重启设备,或者重新插拔HD线(如果可行的话)。但这种方法不一定适用于动态旋转,而且可能只适用于HDMI显示。
总结
对于动态旋转屏幕,建议先尝试settings命令,因为这是Android的标准方法。如果不行,再尝试wm命令。如果是在特定平台上(如RK3588)且上述方法无效,可以查阅该平台的开发文档或咨询设备制造商,看是否有特定的系统属性可以控制。
注意:这些命令通常需要root权限才能执行。在非root设备上,普通应用无法修改这些设置,除非有系统签名权限。
请根据你的实际设备情况选择合适的方法。
在RK3588的Android 13系统中,有多种方法可以旋转屏幕。以下是几种常用的命令方式:
方法一:使用 wm 命令(推荐)
bash
# 旋转到竖屏(0度)
adb shell wm rotation 0
# 旋转到横屏(90度)
adb shell wm rotation 90
# 旋转到倒竖屏(180度)
adb shell wm rotation 180
# 旋转到倒横屏(270度)
adb shell wm rotation 270
方法二:修改系统属性
bash
# 设置屏幕旋转角度
adb shell setprop persist.vendor.sys.fw.rotation 0 # 竖屏
adb shell setprop persist.vendor.sys.fw.rotation 90 # 横屏
adb shell setprop persist.vendor.sys.fw.rotation 180 # 倒竖屏
adb shell setprop persist.vendor.sys.fw.rotation 270 # 倒横屏
# 重启显示服务使设置生效
adb shell killall surfaceflinger
方法三:使用 input 命令模拟物理旋转
bash
# 强制横屏
adb shell settings put system accelerometer_rotation 0
adb shell settings put system user_rotation 1
# 强制竖屏
adb shell settings put system accelerometer_rotation 0
adb shell settings put system user_rotation 0
方法四:通过 dumpsys 修改显示配置
bash
# 查看当前显示信息
adb shell dumpsys display
# 修改显示方向(需要root权限)
adb shell wm set-user-rotation 1 # 横屏
adb shell wm set-user-rotation 0 # 竖屏
方法五:永久性配置(需修改系统配置)
如果需要开机默认旋转,可以修改系统属性:
bash
# 设置永久性横屏
adb shell setprop ro.sf.hwrotation 90
adb shell setprop ro.sf.lcd_density 160 # 可能需要调整DPI
# 重启生效
adb reboot
实用脚本示例
创建一个批量执行脚本 rotate_screen.sh:
bash
#!/bin/bash
# 旋转屏幕脚本
echo "选择屏幕方向:"
echo "1. 竖屏 (0°)"
echo "2. 横屏 (90°)"
echo "3. 倒竖屏 (180°)"
echo "4. 倒横屏 (270°)"
read -p "请输入选择 [1-4]: " choice
case $choice in
1)
adb shell wm rotation 0
echo "已设置为竖屏"
;;
2)
adb shell wm rotation 90
echo "已设置为横屏"
;;
3)
adb shell wm rotation 180
echo "已设置为倒竖屏"
;;
4)
adb shell wm rotation 270
echo "已设置为倒横屏"
;;
*)
echo "无效选择"
;;
esac
注意事项
权限要求:部分命令可能需要root权限
ADB连接:确保设备已开启USB调试并连接成功
系统版本:不同Android版本命令可能略有差异
恢复默认:要恢复自动旋转,可执行:
bash
adb shell settings put system accelerometer_rotation 1
验证旋转结果
bash
# 检查当前旋转状态
adb shell dumpsys display | grep mCurrentOrientation
adb shell wm rotation
推荐使用方法一的 wm rotation 命令,这是Android官方推荐的方式,兼容性最好且无需重启即可生效。


8295

被折叠的 条评论
为什么被折叠?



