Atlas 200外设驱动开发和调试指南_ WiFi 和蓝牙
收藏回复举报
Atlas 200外设驱动开发和调试指南_ WiFi 和蓝牙
发表于2023-04-15 18:24:30
0 查看

Atlas 200外设驱动开发和调试指南_ WiFi 和蓝牙 

调试基于Atlas 200 参考板驱动包进行重构调试,调试方法请参考https://support.huawei.com/enterprise/zh/doc/EDOC1100193743/3db58fa7 

 

1 芯片型号 

    WiFi和蓝牙功能使用芯片RTL8822CE芯片,芯片集成w²fi和蓝牙功能。 

2 固件烧录 

    是否需要烧录固件:否 

3 内核配置 

    是否需要使能内核配置:否 

4 驱动调试 

    驱动下载链接:¯ììÝäǿȍȍg²ì¯ñbȇcÑmȍÃwfingžàȍàìw88 

    编译驱动后,主要需要使用以下几个驱动和固件文件: 

    rtw_core.ko 

    rtw_pci.ko 

    rtw_8822c.ko 

    rtw_8822ce.ko 

    rtw8822c_fw.bin 

    rtw8822c_wow_fw.bin 

    将固件文件rtw8822c_fw.bin和rtw8822c_wow_fw.bin放到路径ȍòbȍfiàmw†àžȍàìw88下。 

    按照顺序插入以下驱动: 

    insmod rtw_core.ko 

    insmod rtw_pci.ko 

    insmod rtw_8822c.ko 

    insmod rtw_8822ce.ko 

    使用dmesg | grep rtw可查看驱动初始化信息。 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ dmesg | grep rtw 

    [ 11.792086] rtw_8822ce 0000:83:00.0: assign IRQ: got 0 

    [ 11.792165] rtw_8822ce 0000:83:00.0: enabling device (0000 -> 0002) 

    [ 11.792179] rtw_8822ce 0000:83:00.0: enabling bus mastering 

    [ 11.799740] rtw_8822ce 0000:83:00.0: Firmware version 9.9.4, H2C version 15 

    [ 11.806188] rtw_8822ce 0000:83:00.0: Firmware version 9.9.6, H2C version 15 

    [ 11.823201] rtw_8822ce 0000:83:00.0: use rfe_def[1] 

    [ 11.868246] rtw_8822ce 0000:83:00.0 wlp131s0: renamed from wlan0 

    通过²fcÑnfig -a也可以查到w²fi网卡 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ ²fcÑÊfig -a 

    enp132s0u3: fl†gäɊ4099ɍkWȀBZKC^fȀMk>f/C^fɌ mtu 1500 

    inet 192.168.1.22 netmask 255.255.255.0 broadcast 192.168.1.255 

    ether 06:64:16:0f:41:53 txqueuelen 1000 (Ethernet) 

    RX packets 61 bytes 6966 (6.9 KB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 38 bytes 8898 (8.8 KB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    eth0: fl†gäɊ4163ɍkWȀBZKC^fȀZkNN/N'ȀMk>f/C^fɌ mtu 1500 

    inet 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255 

    ether 4a:60:bf:da:78:27 txqueuelen 1000 (Ethernet) 

    RX packets 44680 bytes 6799567 (6.7 MB) 

    RX errors 0 dropped 15 overruns 0 frame 0 

    TX packets 127837 bytes 7917617 (7.9 MB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    device interrupt 69 

    lo: fl†gäɊ73ɍkWȀ>KKWBC<ȀZkNN/N'Ɍ mtu 65536 

    inet 127.0.0.1 netmask 255.0.0.0 

    loop txqueuelen 1000 (Local Loopback) 

    RX packets 107856 bytes 8824065 (8.8 MB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 107856 bytes 8824065 (8.8 MB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    usb0: fl†gäɊ4099ɍkWȀBZKC^fȀMk>f/C^fɌ mtu 1500 

    ether 9a:1e:0e:35:f1:07 txqueuelen 1000 (Ethernet) 

    RX packets 0 bytes 0 (0.0 B) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 0 bytes 0 (0.0 B) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    wlp131s0: fl†gäɊ4099ɍkWȀBZKC^fȀMk>f/C^fɌ mtu 1500 

    ether 1c:bf:c0:6d:1e:79 txqueuelen 1000 (Ethernet) 

    RX packets 7958 bytes 10614427 (10.6 MB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 3189 bytes 367899 (367.8 KB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    10.5 测试工具 

    ● WiFi测试 

    WiFi测试工具使用wpa_supplicant,包括二进制工具wpa_passphrase、 

    wpa_supplicant和wpa_cli。 

    wpa_supplicant工具是开源工具,工具的下载和编译请自行搜索。 

    连接w²fi测试 

    使用wpa_passphrase将 w²fi热点名和密码写入配置文件/etc/wpa_supplicant/ 

    wpa_supplicant.conf 

    配置命令:wpa_passphrase "热点名" "密码" > /etc/wpa_supplicant/ 

    wpa_supplicant.conf 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ wpa_passphrase "nova 7 5G" 

    "1234567890" > /etc/wpa_supplicant/wpa_supplicant.conf 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ cat /etc/wpa_supplicant/ 

    wpa_supplicant.conf 

    network={ 

    ssid="nova 7 5G" 

    #psk="1234567890" 

    psk=b8dde5b43fd7d205718d130f8a1209b205f4b8d1fcbaaf5135377601de74881d 

    } 

    使用wpa_supplicant连接网络wpa_supplicant -Dnl80211 -iwlp131s0 -c/etc/ 

    wpa_supplicant/wpa_supplicant.conf -B 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ wpa_supplicant -D nl80211 -i wlp131s0 

    -c /etc/wpa_supplicant/wpa_supplicant.conf -B 

    Successfully initialized wpa_supplicant 

    然后使用dhclient wlp131s0自动获取IP,ping www.baidu.com进行测试。 

    根据wlp131s0自动获取的IP,增加默认路由的配置 

    route add default gw 172.20.10.1 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ dhclient wlp131s0 

    cmp: EOF on /tmp/tmp.H4dZUYeWAR which is empty 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ ²fcÑÊfig -a 

    enp132s0u3: fl†gäɊ4099ɍkWȀBZKC^fȀMk>f/C^fɌ mtu 1500 

    inet 192.168.1.22 netmask 255.255.255.0 broadcast 192.168.1.255 

    ether 06:64:16:0f:41:53 txqueuelen 1000 (Ethernet) 

    RX packets 61 bytes 6966 (6.9 KB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 38 bytes 8898 (8.8 KB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    eth0: fl†gäɊ4163ɍkWȀBZKC^fȀZkNN/N'ȀMk>f/C^fɌ mtu 1500 

    inet 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255 

    ether 4a:60:bf:da:78:27 txqueuelen 1000 (Ethernet) 

    RX packets 45189 bytes 6834201 (6.8 MB) 

    RX errors 0 dropped 15 overruns 0 frame 0 

    TX packets 128084 bytes 7943175 (7.9 MB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    device interrupt 69 

    lo: fl†gäɊ73ɍkWȀ>KKWBC<ȀZkNN/N'Ɍ mtu 65536 

    inet 127.0.0.1 netmask 255.0.0.0 

    loop txqueuelen 1000 (Local Loopback) 

    RX packets 107856 bytes 8824065 (8.8 MB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 107856 bytes 8824065 (8.8 MB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    usb0: fl†gäɊ4099ɍkWȀBZKC^fȀMk>f/C^fɌ mtu 1500 

    ether 9a:1e:0e:35:f1:07 txqueuelen 1000 (Ethernet) 

    RX packets 0 bytes 0 (0.0 B) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 0 bytes 0 (0.0 B) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    wlp131s0: fl†gäɊ4163ɍkWȀBZKC^fȀZkNN/N'ȀMk>f/C^fɌ mtu 1500 

    inet 192.168.43.123 netmask 255.255.255.0 broadcast 192.168.43.255 

    ether 1c:bf:c0:6d:1e:79 txqueuelen 1000 (Ethernet) 

    RX packets 7976 bytes 10620301 (10.6 MB) 

    RX errors 0 dropped 0 overruns 0 frame 0 

    TX packets 3195 bytes 369359 (369.3 KB) 

    TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ ping www.baidu.com 

    PING www.a.shifen.com (36.152.44.95) 56(84) bytes of data. 

    From 192.168.0.2 icmp_seq=1 Destination Host Unreachable 

    From 192.168.0.2 icmp_seq=2 Destination Host Unreachable 

    From 192.168.0.2 icmp_seq=3 Destination Host Unreachable 

    From 192.168.0.2 icmp_seq=4 Destination Host Unreachable 

    From 192.168.0.2 icmp_seq=5 Destination Host Unreachable 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ route add default gw 192.168.43.1 

    àÑÑìʵš†v²nc²ȝm²n²ǿȍòbȍfiàmw†àžȍàìw88ȅ ping www.baidu.com 

    PING www.a.shifen.com (36.152.44.95) 56(84) bytes of data. 

    64 bytes from 36.152.44.95: icmp_seq=1 ttl=53 time=55.9 ms 

    64 bytes from 36.152.44.95: icmp_seq=2 ttl=53 time=90.2 ms 

    64 bytes from 36.152.44.95: icmp_seq=3 ttl=53 time=31.8 ms 

    64 bytes from 36.152.44.95: icmp_seq=4 ttl=53 time=46.8 ms 

    64 bytes from 36.152.44.95: icmp_seq=5 ttl=53 time=38.8 ms 

    64 bytes from 36.152.44.95: icmp_seq=7 ttl=53 time=133 ms 

    64 bytes from 36.152.44.95: icmp_seq=8 ttl=53 time=64.1 ms 

    需要使用wpa_cli工具操作连接w²fi,需要在配置文件/etc/wpa_supplicant/ 

    wpa_supplicant.conf写入如下配置 

    ctrl_interface=/var/run/wpa_supplicant 

    ñݚ†ìžȎcÑÊfigɊ1 

    ● 蓝牙测试 

    蓝牙测试工具使用bluez,需要使用工具bluetoothd和bluetoothctl工具进行蓝牙的配对测试。 

    bluez工具是开源工具,工具的下载和编译请自行搜索。 

    蓝牙测试工具方法如下: 

    启动服务端进程 

    ./bluetoothd & 

    root@davinci-mini:/usr/local/bluez_tools/libexec/bluetooth# ./bluetoothd & 

    [1] 10165 

    执行终端工具,进行蓝牙的搜索、配对和连接测试 

    ./bluetoothctl 

    root@davinci-mini:/usr/local/bluez_tools/bin# ./bluetoothctl 

    Waiting to connect to bluetoothd...[bluetooth]# 

    [bluetooth]# Agent registered 

    [bluetooth]# [CHG] Controller 1C:BF:C0:6D:1E:7A Pairable: yes 

    power on 

    [bluetooth]# power on 

    [bluetooth]# [CHG] Controller 1C:BF:C0:6D:1E:7A Class: 0x000c0000 

    [bluetooth]# Changing power on succeeded 

    [bluetooth]# [CHG] Controller 1C:BF:C0:6D:1E:7A Powered: yes 

    agent on 

    [bluetooth]# agent on 

    Agent is already registered 

    default-agent 

    [bluetooth]# default-agent 

    [bluetooth]# Default agent request successful 

    scan on 

    [bluetooth]# scan on 

    [bluetooth]# Discovery started 

    [bluetooth]# [CHG] Controller 1C:BF:C0:6D:1E:7A Discovering: yes 

    [bluetooth]# [NEW] Device 6B:0C:A3:8F:F4:AE 6B-0C-A3-8F-F4-AE 

    [bluetooth]# [NEW] Device 62:CD:1D:69:56:5E 62-CD-1D-69-56-5E 

    [bluetooth]# [CHG] Device 62:CD:1D:69:56:5E RSSI: -50 

    [bluetooth]# [NEW] Device 40:3D:03:28:F5:B0 40-3D-03-28-F5-B0 

    [bluetooth]# [CHG] Device 62:CD:1D:69:56:5E RSSI: -70 

    [bluetooth]# [NEW] Device 6D:F1:67:FA:4E:07 6D-F1-67-FA-4E-07 

    [bluetooth]# [NEW] Device 53:56:3A:7A:34:EE 53-56-3A-7A-34-EE 

    [bluetooth]# [CHG] Device 62:CD:1D:69:56:5E RSSI: -62 

    [bluetooth]# [NEW] Device A4:5E:60:BA:D2:A0 A4-5E-60-BA-D2-A0 

    [bluetooth]# [NEW] Device 74:45:2D:36:F4:FA nova 7 5G 

    trust yourDeviceMAC 

    [bluetooth]# trust 74:45:2D:36:F4:FA 

    [bluetooth]# Changing 74:45:2D:36:F4:FA trust succeeded 

    pair yourDeviceMAC 

    [bluetooth]# pair 74:45:2D:36:F4:FA 

    Attempting to pair with 74:45:2D:36:F4:FA 

    [bluetooth]# [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA Connected: yes 

    [nova 7 5G]# Request cÑnfiàm†ì²Ñn 

    [nova 7 5G]# [agent] CÑnfiàm passkey 657516 (yes/no): yes 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA Modalias: 

    bluetooth:v010Fp107Ed1436 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000046a-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001105-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000110a-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000110c-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001112-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001115-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001116-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000111f-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000112f-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001132-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001200-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001800-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001801-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000fdd1-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000fe35-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 11c8b310-80e4-4276-afc0-f81590b2177f 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 8ce255c0-200a-11e0-ac64-0800200c9a66 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 9664aa26-d76c-43ad-9775-d310f253a408 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA ServicesResolved: yes 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA Paired: yes 

    [nova 7 5G]# Pairing successful 

    connect yourDeviceMAC 

    [bluetooth]# connect 74:45:2D:36:F4:FA 

    Attempting to connect to 74:45:2D:36:F4:FA 

    [bluetooth]# [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA Connected: yes 

    [nova 7 5G]# [bluetooth]# [CHG] Device 74:45:2D:36:F4:FA Connected: no 

    [bluetooth]# Failed to connect: org.bluez.Error.Failed 

    [bluetooth]# [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA Connected: yes 

        [nova 7 5G]# Request cÑnfiàm†ì²Ñn 

    [nova 7 5G]# [agent] CÑnfiàm passkey 454584 (yes/no): yes 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000046a-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001105-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001108-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000110a-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000110c-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001112-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001115-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001116-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000111f-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000112f-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001132-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001200-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001800-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    00001801-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000fdd1-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 

    0000fe35-0000-1000-8000-00805f9b34fb 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 11c8b310-80e4-4276-afc0-f81590b2177f 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 8ce255c0-200a-11e0-ac64-0800200c9a66 

    [nova 7 5G]# [CHG] Device 74:45:2D:36:F4:FA UUIDs: 9664aa26-d76c-43ad-9775- 

    d310f253a408 

    [nova 7 5G]# Authorize service 

    [nova 7 5G]# [agent] Authorize service 00001108-0000-1000-8000-00805f9b34fb 

    (yes/no): yes 

本帖最后由 匿名用户 于 2023/04/15 18:24:44 编辑

我要发帖子