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

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


 

相关文章:

  • Qt开发输入法-接Qt 相关 编译流程及交叉编译 部署所遇到的问题总结
  • 【Qt】控件 QWidget
  • MySQL 知识小结(一)
  • Zabbix 高可用架构部署方案(2最新版)
  • 板凳-------Mysql cookbook学习 (十--3)
  • 轻量安全的密码管理工具Vaultwarden
  • 第三章 3.1 传感器安全
  • DAP-seq测序(DNA亲和纯化测序)!
  • 西电计组第五章-指令系统
  • LeetCode Hot100刷题——合并两个有序链表
  • LeetCode 0386.字典序排数:细心总结条件
  • 【动态规划】B4336 [中山市赛 2023] 永别|普及+
  • (12)-Fiddler抓包-Fiddler设置IOS手机抓包
  • IDEA运行VUE项目报错相关
  • Trace32 远程调试无法连接问题分析------解决方案
  • 互联网大厂Java求职面试:云原生与微服务架构的深度探讨
  • 使用MFC中的CEvent实现两个线程之间的交替打印
  • 题山采玉:Day3
  • 云原生周刊:k0s 成为 CNCF 沙箱项目
  • Python自然语言处理库之gensim使用详解
  • 代刷网站只做软件吗/网站优化名词解释
  • 家政网站建设/成年学校培训班
  • 浙江省建设厅网站查询/互联网推广是什么意思
  • 怎么查看网站有没有备案/武汉seo优化公司
  • 做网站域名有什么用/百度关键词点击价格查询
  • 教学成果展示网站 课程体系建设/营业推广策划