当前位置: 首页 > ops >正文

20250609在荣品的PRO-RK3566开发板的Android13下解决串口可以执行命令但是脚本执行命令异常的问题

20250609在荣品的PRO-RK3566开发板的Android13下解决串口可以执行命令但是脚本执行命令异常的问题
2025/6/9 20:54


缘起,为了跨网段推流,千辛万苦配置好了网络参数。
但是命令iptables -t filter -F tetherctrl_FORWARD可以在调试串口/DEBUG口正确执行。
一添加到自启动脚本中就出现各种异常!

/vendor/bin/autostart_test.sh


网络配置如下:
RK3566配置路由使D能PING通A
A:192.169.144.119
B:192.168.144.55
C:192.168.43.1
D:192.168.43.33

设备A和B是图传,在同一个网段,可以互相PING通。
【B和C】都接在RK3566【Android13】上。
C通过AP6256虚拟成为softAP。
D为笔记本电脑,通过softAP/以太网络共享接到C上。

现在,想让D来PING通A,改如何配置RK3566的路由表?

A的网关配置为B,D的网关配置为C。softAP通了。
但是以太网不通。
经过专家诊断:
需要执行:
iptables -t filter -F tetherctrl_FORWARD

至于执行:iptables -t filter -F tetherctrl_FORWARD的效果,

通过命令 iptables -t filter -L 可以查询到,
清除了网络规则:tetherctrl_FORWARD


经过艰难调试,后来怀疑是在shell脚本中需要使用完整的路径。
【偶然的原因,在init.rc中,发现别人都是使用完整的路径的^_】
搞定/办结问题!


【autostart_test.sh】
#!/vendor/bin/sh
echo "Forlinx::::::::::::::::::GNSS_CONFIG start!" > /dev/ttyFIQ0
echo "This is a test" > /dev/ttyFIQ0
echo $(date) > /data/date.txt
echo "Forlinx::::::::::::::::::GNSS_CONFIG end!" > /dev/ttyFIQ0
#/system/bin/rk3566_android_serial
sleep 180
/system/bin/iptables -t filter -F tetherctrl_FORWARD

/system/bin/uart2tcp


完整的LOG:

执行前:
Microsoft Windows [版本 10.0.19045.5737]
(c) Microsoft Corporation。保留所有权利。

C:\Users\QQ>adb shell
rk3566_t:/ $ su
rk3566_t:/ #
rk3566_t:/ # iptables -t filter -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
bw_INPUT   all  --  anywhere             anywhere
fw_INPUT   all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
oem_fwd    all  --  anywhere             anywhere
fw_FORWARD  all  --  anywhere             anywhere
bw_FORWARD  all  --  anywhere             anywhere
tetherctrl_FORWARD  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
oem_out    all  --  anywhere             anywhere
fw_OUTPUT  all  --  anywhere             anywhere
st_OUTPUT  all  --  anywhere             anywhere
bw_OUTPUT  all  --  anywhere             anywhere

Chain bw_FORWARD (1 references)
target     prot opt source               destination

Chain bw_INPUT (1 references)
target     prot opt source               destination
bw_global_alert  all  --  anywhere             anywhere
RETURN     esp  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere             mark match 0x100000/0x100000
MARK       all  --  anywhere             anywhere             MARK or 0x100000

Chain bw_OUTPUT (1 references)
target     prot opt source               destination
bw_global_alert  all  --  anywhere             anywhere

Chain bw_costly_shared (0 references)
target     prot opt source               destination
bw_penalty_box  all  --  anywhere             anywhere

Chain bw_data_saver (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain bw_global_alert (2 references)
target     prot opt source               destination
           all  --  anywhere             anywhere             ! quota globalAlert: 2097152 bytes

Chain bw_happy_box (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere            match bpf pinned /sys/fs/bpf/netd_shared/prog_netd_skfilter_allowlist_xtbpf
bw_data_saver  all  --  anywhere             anywhere

Chain bw_penalty_box (1 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            match bpf pinned /sys/fs/bpf/netd_shared/prog_netd_skfilter_denylist_xtbpf reject-with icmp-port-unreachable
bw_happy_box  all  --  anywhere             anywhere

Chain fw_FORWARD (1 references)
target     prot opt source               destination

Chain fw_INPUT (1 references)
target     prot opt source               destination

Chain fw_OUTPUT (1 references)
target     prot opt source               destination

Chain oem_fwd (1 references)
target     prot opt source               destination

Chain oem_out (1 references)
target     prot opt source               destination

Chain st_OUTPUT (1 references)
target     prot opt source               destination

Chain st_clear_caught (2 references)
target     prot opt source               destination

Chain st_clear_detect (0 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere             connmark match  0x2000000/0x2000000 reject-with icmp-port-unreachable
RETURN     all  --  anywhere             anywhere             connmark match  0x1000000/0x1000000
CONNMARK   tcp  --  anywhere             anywhere             u32 "0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x0&0xffff0000=0x16030000&&0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x4&0xff0000=0x10000" CONNMARK or 0x1000000
CONNMARK   udp  --  anywhere             anywhere             u32 "0x0>>0x16&0x3c@0x8&0xffff0000=0x16fe0000&&0x0>>0x16&0x3c@0x14&0xff0000=0x10000" CONNMARK or 0x1000000
RETURN     all  --  anywhere             anywhere             connmark match  0x1000000/0x1000000
st_clear_caught  tcp  --  anywhere             anywhere             state ESTABLISHED u32 "0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x0&0x0=0x0"
st_clear_caught  udp  --  anywhere             anywhere

Chain st_penalty_log (0 references)
target     prot opt source               destination
CONNMARK   all  --  anywhere             anywhere             CONNMARK or 0x1000000
NFLOG      all  --  anywhere             anywhere

Chain st_penalty_reject (0 references)
target     prot opt source               destination
CONNMARK   all  --  anywhere             anywhere             CONNMARK or 0x2000000
NFLOG      all  --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain tetherctrl_FORWARD (1 references)
target     prot opt source               destination
DROP       all  --  anywhere             anywhere

Chain tetherctrl_counters (0 references)
target     prot opt source               destination
rk3566_t:/ # iptables -t filter -L


执行后:
Microsoft Windows [版本 10.0.19045.5737]
(c) Microsoft Corporation。保留所有权利。

C:\Users\QQ>adb shell
rk3566_t:/ $ su
rk3566_t:/ #
rk3566_t:/ # iptables -t filter -F tetherctrl_FORWARD
rk3566_t:/ # iptables -t filter -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
bw_INPUT   all  --  anywhere             anywhere
fw_INPUT   all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
oem_fwd    all  --  anywhere             anywhere
fw_FORWARD  all  --  anywhere             anywhere
bw_FORWARD  all  --  anywhere             anywhere
tetherctrl_FORWARD  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
oem_out    all  --  anywhere             anywhere
fw_OUTPUT  all  --  anywhere             anywhere
st_OUTPUT  all  --  anywhere             anywhere
bw_OUTPUT  all  --  anywhere             anywhere

Chain bw_FORWARD (1 references)
target     prot opt source               destination

Chain bw_INPUT (1 references)
target     prot opt source               destination
bw_global_alert  all  --  anywhere             anywhere
RETURN     esp  --  anywhere             anywhere
RETURN     all  --  anywhere             anywhere             mark match 0x100000/0x100000
MARK       all  --  anywhere             anywhere             MARK or 0x100000

Chain bw_OUTPUT (1 references)
target     prot opt source               destination
bw_global_alert  all  --  anywhere             anywhere

Chain bw_costly_shared (0 references)
target     prot opt source               destination
bw_penalty_box  all  --  anywhere             anywhere

Chain bw_data_saver (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere

Chain bw_global_alert (2 references)
target     prot opt source               destination
           all  --  anywhere             anywhere             ! quota globalAlert: 2097152 bytes

Chain bw_happy_box (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere            match bpf pinned /sys/fs/bpf/netd_shared/prog_netd_skfilter_allowlist_xtbpf
bw_data_saver  all  --  anywhere             anywhere

Chain bw_penalty_box (1 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            match bpf pinned /sys/fs/bpf/netd_shared/prog_netd_skfilter_denylist_xtbpf reject-with icmp-port-unreachable
bw_happy_box  all  --  anywhere             anywhere

Chain fw_FORWARD (1 references)
target     prot opt source               destination

Chain fw_INPUT (1 references)
target     prot opt source               destination

Chain fw_OUTPUT (1 references)
target     prot opt source               destination

Chain oem_fwd (1 references)
target     prot opt source               destination

Chain oem_out (1 references)
target     prot opt source               destination

Chain st_OUTPUT (1 references)
target     prot opt source               destination

Chain st_clear_caught (2 references)
target     prot opt source               destination

Chain st_clear_detect (0 references)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere             connmark match  0x2000000/0x2000000 reject-with icmp-port-unreachable
RETURN     all  --  anywhere             anywhere             connmark match  0x1000000/0x1000000
CONNMARK   tcp  --  anywhere             anywhere             u32 "0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x0&0xffff0000=0x16030000&&0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x4&0xff0000=0x10000" CONNMARK or 0x1000000
CONNMARK   udp  --  anywhere             anywhere             u32 "0x0>>0x16&0x3c@0x8&0xffff0000=0x16fe0000&&0x0>>0x16&0x3c@0x14&0xff0000=0x10000" CONNMARK or 0x1000000
RETURN     all  --  anywhere             anywhere             connmark match  0x1000000/0x1000000
st_clear_caught  tcp  --  anywhere             anywhere             state ESTABLISHED u32 "0x0>>0x16&0x3c@0xc>>0x1a&0x3c@0x0&0x0=0x0"
st_clear_caught  udp  --  anywhere             anywhere

Chain st_penalty_log (0 references)
target     prot opt source               destination
CONNMARK   all  --  anywhere             anywhere             CONNMARK or 0x1000000
NFLOG      all  --  anywhere             anywhere

Chain st_penalty_reject (0 references)
target     prot opt source               destination
CONNMARK   all  --  anywhere             anywhere             CONNMARK or 0x2000000
NFLOG      all  --  anywhere             anywhere
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

Chain tetherctrl_FORWARD (1 references)
target     prot opt source               destination

Chain tetherctrl_counters (0 references)
target     prot opt source               destination
rk3566_t:/ # iptables -t filter -L


 

http://www.xdnf.cn/news/12910.html

相关文章:

  • Electron 防脱壳转二进制 JSC 打包过程以及踩坑记录
  • 103页战略设计的核心:麦肯锡思维框架、分析方法与实施路径
  • AI会取代IT从业者吗?
  • 【从零开始学习JVM | 第四篇】类加载器和双亲委派机制(高频面试题)
  • C语言变量存储与指针:基础篇
  • 【HTML-16】深入理解HTML中的块元素与行内元素
  • Coze工作流-语音故事创作-文本转语音的应用
  • Ansible+Zabbix-agent2快速实现对多主机监控
  • 13.Websocket
  • WebRTC(一):整体架构
  • 【STM32】G030单片机开启超过8个ADC通道的方法
  • mongodb源码分析session执行handleRequest命令find过程
  • [ linux-系统 ] 进程控制
  • UNECE R79——解读自动驾驶相关标准法规
  • C++中vector类型的介绍和使用
  • 生成对抗网络(GAN)损失函数解读
  • 使用MFC中的CEvent实现两个线程之间的交替打印
  • 【Linux系统】Linux环境变量:系统配置的隐形指挥官
  • Gemini 2.5 Pro (0605版本) 深度测评与体验指南
  • MySQL 8.0 OCP 英文题库解析(十二)
  • Rust 学习笔记:共享状态并发
  • 三维GIS开发cesium智慧地铁教程(5)Cesium相机控制
  • 从零手写Java版本的LSM Tree (三):MemTable 内存表
  • 图表类系列各种样式PPT模版分享
  • 高性能低功耗之道:全志A133在智能硬件中的全面应用
  • 设计模式-抽象工厂模式
  • CSS3 常用功能详细使用指南
  • App Trace技术解析:传参安装、一键拉起与快速安装
  • 【Linux】Linux安装并配置RabbitMQ
  • Maven 多仓库治理与发布策略深度实践