RV1106上Alpine使用

前言说明

  1. 我测试的硬件设备是:SoloLinker-A V1版本 RV1106G3 256M内存 8G储存EMMCSoloLinker-A V2版本 RV1106G2 128M内存 128储存NAND

  2. 运行系统用的是:RV1106-SOLOLINKER-EMMC_WIFI_ALPINE-240407

  3. 使用的屏幕:大显伟业4.0寸RGB屏华显科技4.0寸RGB屏(需要转接板且触摸部分失灵)

  4. NAND版本SSHD开机时可能因为权限导致无法启动(EMMC无问题)

1
2
3
4
5
报错:/var/empty must be owned by root and not group or world-writable.
原因:NAND版本系统在打包或刷入时改变了文件所有者导致,所以需要重新调整

mkdir -p /var/empty/sshd
chown root:root -R /var/empty

ADB和RNDIS

  1. 刷完本固件后默认同时开启ADB和RNDIS,可用的登录方式:串口调试,ADB调试,RNDIS网卡SSH登录。

  2. 刷完开机在SOLOLINKER-A内部会虚拟一个名为usb0静态IP:172.32.0.70的网卡。然后请在你Windows电脑上配置RNDIS虚拟的网卡为同一网段的静态IP

  3. 打开Windows的设置 —> 高级网络设置 —> 更改适配器选项 -> 【Remote NDIS based nternet Sharing Device】右键属性 -> 双击【Internet 协议版本(TCP/IPv4)】-> 使用下面的IP地址设置为 【172.32.0.100】 其余默认即可

  4. 现在那就可用通过ssh root@172.32.0.70登录SOLOLINKER-A设备了,当然也是可以通过ADB登录的

  5. ADB访问的话在电脑上没有其他Android设备的情况下,直接adb shell即可登录

  6. 当然也可通过串口调试,这里就不多说了

EMMC为磁盘扩容

  1. EMMC刷完后仅剩余储存空间只有几兆。而NAND无需扩容,因为刷入时已经写死了

  2. 执行 /etc/init.d/T_S99_First_Resize_Disk start 可扩容到100%

  3. 扩容仅需执行一次即可,后续就不用再次执行了

有线网卡

  1. 如果你仅需临时连接下,那么接好网线后可以如下操作,但重启后不会自动连接
1
2
3
4
5
# 默认网卡是关闭的需要先启用
ifconfig eth0 up

# 然后让其通过DHCP获取IP,上级网络非DHCP方式的请自测
udhcpc -i eth0
  1. 需要开机就自动连接有线网的可以如下操作
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 如果不需要通过eth0联网,则可跳过这步。因为如果没有插入网线会频繁提示:udhcpc: broadcasting discover

# Alpine使用 ifupdown-ng 包来管理网络,可以编辑 /etc/network/interfaces 来配置它
# vi /etc/network/interfaces 然后添加如下到该配置文件
auto eth0
iface eth0 inet dhcp

# 临时启动网络服务(重启失效)
rc-service networking start

# 也可设置为开机自启,但是后期如果不接网线开机会频繁提示:udhcpc: broadcasting discover
rc-update add networking default

# 该服务启动后主机名会自动设置,会自动运行udhcpc为上面配置的网卡服务

WiFi的使用

  1. 刷完后默认启用adb和rndis功能,可以通过下面方法使用WiFi。注意:WiFi和ADB与RNDIS不可共存

  2. 临时连接使用WiFi的方法,请在串口调试下执行,ADB和RNDIS连接的会直接失联

1
2
3
4
5
6
7
8
9
10
11
12
13
# 注意:以下操作通过ADB和RNDIS连接的会直接失联,但重启后会恢复
# 注意:默认是为V2版本设置的,如果你的设备是V1,把文件 /etc/init.d/T_S55_Start_Wlan_BT 中 GPIO_PIN=6 改为 GPIO_PIN=4

# 先将WiFi信息写入配置文件
wpa_passphrase "SSID" "password" > /etc/wpa_supplicant/wpa_supplicant.conf

# 然后执行如下脚本切换USB为WiFi并加载驱动
/etc/init.d/T_S55_Start_Wlan_BT start

# 连接到上面配置的WiFi并通过DHCP获取IP
/etc/init.d/T_S80_Connect_Wifi start

# 现在就已经接入网络了,但这种方式重启就失效了
  1. 开机就自动连接WiFi的方法,如果配置错误可在串口调试下改回
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 注意:默认是为V2版本设置的,如果你的设备是V1,把文件 /etc/init.d/T_S55_Start_Wlan_BT 中 GPIO_PIN=6 改为 GPIO_PIN=4

# 先将你的WiFi信息写入配置文件(非常重要,否则会使用默认的无线配置)
wpa_passphrase "SSID" "password" > /etc/wpa_supplicant/wpa_supplicant.conf

# 重命名让脚本能开机自启。注意:操作完需要重启后才能生效
mv /etc/init.d/T_S55_Start_Wlan_BT /etc/init.d/S55_Start_Wlan_BT
mv /etc/init.d/T_S80_Connect_Wifi /etc/init.d/S80_Connect_Wifi

# 默认的无线配置文件内容如下,你也可以将自己的WiFi改成如下相同让它连接
# /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="RV1106"
psk="1234567890"
priority=9
}

蓝牙的使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# 必须要先启动服务,直接执行bluetoothctl会报错
rc-update add bluetooth # 开机自启
rc-service bluetooth start # 手动启动

# 先查看蓝牙硬件情况
Alpine:~# hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: E8:51:9E:90:89:EC ACL MTU: 1021:9 SCO MTU: 255:4
DOWN
RX bytes:656 acl:0 sco:0 events:40 errors:0
TX bytes:402 acl:0 sco:0 commands:40 errors:0
Features: 0xbf 0x2e 0x4d 0xfe 0xd8 0x3f 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
Link policy: RSWITCH SNIFF
Link mode: PERIPHERAL ACCEPT

# 上面可用看到hci0是关闭的,现在打开它
Alpine:~# hciconfig hci0 up

# 再次查看蓝牙硬件情况可看到它已经开启了
Alpine:~# hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: E8:51:9E:90:89:EC ACL MTU: 1021:9 SCO MTU: 255:4
UP RUNNING
RX bytes:1312 acl:0 sco:0 events:80 errors:0
TX bytes:804 acl:0 sco:0 commands:80 errors:0
Features: 0xbf 0x2e 0x4d 0xfe 0xd8 0x3f 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV3
Link policy: RSWITCH SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'AIC8820'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: (0xd) Revision: 0xb
LMP Version: (0xd) Subversion: 0xb
Manufacturer: not assigned (2875)


# 使用该命令后会进入交互界面
Alpine:~# bluetoothctl

[bluetooth]# power on # 启动蓝牙
[bluetooth]# agent on # 蓝牙代理用于管理及收发蓝牙配对码
[bluetooth]# default-agent # 设置agent为默认模式

[bluetooth]# agent # 查看支持的代理
DisplayOnly KeyboardDisplay NoInputNoOutput off
DisplayYesNo KeyboardOnly auto on
[bluetooth]# agent KeyboardOnly # 设置键盘为例

[bluetooth]# scan on # 先扫描附近设备,已连接G913键盘为例
[NEW] Device 50:98:39:35:C2:73 Mi12
[NEW] Device EB:DD:92:06:F5:1B G913 TKL

[bluetooth]# scan off # 扫描出了要配对的设备就让它停止扫描
[bluetooth]# pair EB:DD:92:06:F5:1B # 与设备配对,过程中可能需要输入配对码及确认
[bluetooth]# trust EB:DD:92:06:F5:1B # 信任设备让下次无需再次配对
[bluetooth]# connect EB:DD:92:06:F5:1B # 连接到设备
[bluetooth]# info EB:DD:92:06:F5:1B # 查看已配对的设备信息


# 其他蓝牙命令
bluetoothctl devices # 列出已配对的设备
bluetoothctl discoverable on # 允许其他设备发现
bluetoothctl scan on # 扫描附近设备
bluetoothctl scan off # 停止扫描附近设备
bluetoothctl pair EB:DD:92:06:F5:1B # 与设备配对
bluetoothctl trust EB:DD:92:06:F5:1B # 信任蓝牙设备
bluetoothctl untrust EB:DD:92:06:F5:1B # 取消信任设备
bluetoothctl connect 50:9y8:39:35:C2:73 # 连接蓝牙设备
bluetoothctl disconnect EB:DD:92:06:F5:1B # 断开蓝牙设备连接
bluetoothctl remove EB:DD:92:06:F5:1B # 取消配对蓝牙设备
bluetoothctl block EB:DD:92:06:F5:1B # 阻止特定设备连接


# 连接G913键盘成功后的显示(默认的内核没有添加UHID驱动可能无法使用)
[G913 TKL]# info
Device EB:DD:92:06:F5:1B (random)
Name: G913 TKL
Alias: G913 TKL
Appearance: 0x03c1 (961)
Icon: input-keyboard
Paired: yes
Bonded: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (00010000-0000-1000-8000-011f2000046d)
Modalias: usb:v046DpB35Fd0021
Battery Percentage: 0x32 (50)
[G913 TKL]#

Alpine:~# bluetoothctl devices
Device EB:DD:92:06:F5:1B G913 TKL
Alpine:~# dmesg
[ 450.416032] input: G913 TKL Keyboard as /devices/virtual/misc/uhid/0005:046D:B35F.0001/input/input1
[ 450.418050] input: G913 TKL Mouse as /devices/virtual/misc/uhid/0005:046D:B35F.0001/input/input2
[ 450.418668] input: G913 TKL Consumer Control as /devices/virtual/misc/uhid/0005:046D:B35F.0001/input/input3
[ 450.418924] hid-generic 0005:046D:B35F.0001: input: BLUETOOTH HID v0.21 Keyboard [G913 TKL] on e8:51:9e:90:89:ec

音频播放

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
amixer						# 音频设置管理
alsamixer # 字符界面音频管理

# 查看音频设备列表
Alpine:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: rv1106acodec [rv1106-acodec], device 0: ffae0000.i2s-rv1106-hifi ff480000.acodec-0 [ffae0000.i2s-rv1106-hifi ff480000.acodec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
Alpine:~#

Alpine:~# aplay speaker_test.wav # 播放指定音频
Alpine:~# aplay -D hw:0,0 speaker_test.wav # 指定声卡播放,例如这个就是上面的:card 0,device 0

# aplay默认只能播放wav文件,需要播放其他格式的去安装其他软件
# 可用通过该网站转换:https://audiotoolset.com/cn/mp3-to-wav
# 编码器:s16le,质量:48k,采样率:8000即可,反正也是听个响,越大体积越大

其他杂项

  1. 屏幕显示示例程序可执行:/opt/lvgl_app

  2. RTC相关信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
date						# 查看当前时间
date -s "2024-04-08 08:00:00" # 设置当前时间

# hwclock 默认以localtime的时区显示时间,而不是UTC-0时区
hwclock -r # 获取显示RTC时间
hwclock -u # 使用UTC时间格式
hwclock -l # 使用本地时间格式
hwclock -s # 将硬件时钟同步到系统时钟
hwclock -w # 将系统时钟同步到硬件时钟
hwclock --set --date "2024-04-08 08:00:00" # 设置硬件时钟

# 有底板纽扣电池在彻底断电后硬件时间正常,date与其快8小时
Alpine:~# date
Mon Apr 8 01:48:21 CST 2024
Alpine:~# hwclock
Sun Apr 7 17:48:26 2024 0.000000 seconds
Alpine:~#

# 没有底板纽扣电池在彻底断电后硬件时间会回到20210101
Alpine:~# date
Fri Jan 1 20:00:53 CST 2021
Alpine:~# hwclock
Fri Jan 1 12:01:20 2021 0.000000 seconds

# 系统默认从RTC0即 /dev/rtc0 中获取时间进行设置。使用如下命令可查看RTC信息,默认从RTC0节点里获取
Alpine:~# cat /proc/driver/rtc # 查看RTC的信息
rtc_time : 17:05:05
rtc_date : 2024-04-07
alrm_time : 00:00:00
alrm_date : 2030-01-14
alarm_IRQ : no
alrm_pending : no
update IRQ enabled : no
periodic IRQ enabled : no
periodic IRQ frequency : 1
max user IRQ frequency : 64
24hr : yes
Alpine:~#