0
点赞
收藏
分享

微信扫一扫

SSD202 驱动WIFI-ssw01b的AP模式

艾晓雪 2022-04-24 阅读 90

1 电路相关

  • 复位芯片方法1
echo ON > /dev/wifi_reset
echo OFF > /dev/wifi_reset
  • 复位芯片方法2
echo 71 > /sys/class/gpio/export  
echo out > /sys/class/gpio/gpio71/direction
echo 0 > /sys/class/gpio/gpio71/value
sleep 2
echo 1 > /sys/class/gpio/gpio71/value

2 编译步骤

内核编译:

  • Networking support ->Networking options ->802.1d Ethernet Bridging
  • CONFIG_RFKILL=y
    文件系统:
  • 工具需要:bridge-utils,wireless-tools, dhcpd

3 测试步骤

3.1 配置运行的动态库路径:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./:/config/lib/:/customer/lib/:/config/wifi/
export PATH=$PATH:/config/wifi/

3.2 加载驱动:

insmod /config/wifi/llc.ko
insmod /config/wifi/stp.ko
insmod /config/wifi/bridge.ko
/config/wifi/ssw01bInit.sh

3.2.1 初始化wifi芯片

  • 芯片 BANK-0xe OFFSET-0x30 写入 0x11
  • 芯片 BANK-0x103c OFFSET-0x8 写入 0x0
  • 延时一段时间
  • 芯片 BANK-0x103c OFFSET-0x8 写入 0x10
# /config/riu_w e 30 11
/config/riu_w 103c 8 00
sleep 0.01
/config/riu_w 103c 8 10BANK:0xE 16bit-offset 0x30
0x0011
# /config/riu_w 103c 8 00
BANK:0x103C 16bit-offset 0x08
0x0001
# sleep 0.01
# /config/riu_w 103c 8 10
BANK:0x103C 16bit-offset 0x08
0x0011
# 

3.2.2 建立必要的文件目录

touch /appconfigs/hosts
mkdir -p /var/run/wpa_supplicant
chmod 777 /var/run/wpa_supplicant
mkdir -p /var/run/hostapd		
chmod 777 /var/run/hostapd
mkdir -p /appconfigs/misc/wifi/ # 具体不知道干什么用
mkdir -p /var/wifi/misc/ # 保存 dnsmasq一些信息
mkdir -p /var/lib/misc/  # 一些wifi的日志和配置

3.2.3 加载外设WIFI芯片驱动

  • 告警信息:[Sstar_log]: wsm_write_mib fail !!! mibId=4132
  • 告警信息:[Sstar_log]:apollo wifi : can’t open /data/.mac.info
    [Sstar_log]:efuse data is [0x1,0x3b,0x2,0x2,0x2,0x7,0x0,0x0,0x24:0x14:0x7:0x16:0x65:0x61]
  • 告警信息:[Sstar_log]:apollo wifi : can’t open /Sstar_txpwer_dcxo_cfg.txt
  • 告警信息:[Sstar_log]: br0_netdev_open()-1116: dev_get_by_name(br0) failed2![Sstar_log]:br0_netdev_open()-1116: dev_get_by_name(br0) failed2!
# insmod /config/wifi/ssw101b_wifi_HT40_usb.ko
[Sstar_log]:Sstar_usb_module_init 0
[Sstar_log]:Sstar_init_firmware
[Sstar_log]:xxxx minstrel ht init
[Sstar_log]:SVN_VER=14606,DPLL_CLOCK=2,BUILD_TIME=[===USB-ARES_B==
[Sstar_log]:Probe called
[Sstar_log]:CONFIG_USE_DMA_ADDR_BUFFER TX_BUFFER_SIZE 800
[Sstar_log]:CONFIG_USB_AGGR_URB_TX enable cnt tx_dma_addr_buffer_end(  (null))tx_dma_addr_buffer(  (null)),0
[Sstar_log]:Sstar_usb_urb_malloc CONFIG_USE_DMA_ADDR_BUFFER max_num 4, total 131072
[Sstar_log]:CONFIG_USB_AGGR_URB_TX enable cnt tx_dma_addr_buffer_end(c42c0000)tx_dma_addr_buffer(c42e0000),8
[Sstar_log]:CONFIG_TX_NO_CONFIRM
[Sstar_log]:self->tx_hwChanId 0
[Sstar_log]:Allocated hw_priv @ c2ba50a0
[Sstar_log]:Sstarwifi USB_USE_TASTLET_TXRX enable
[Sstar_log]:Sstar_before_load_firmware++
[Sstar_log]:+++++++++++++++++1.1v++++++++++++++++++
[Sstar_log]:===================~_~====================
[Sstar_log]:Sstar_start_load_firmware++
[Sstar_log]:Sstar_start_load_firmware: used firmware.h=
[Sstar_log]:Sstar_set_firmare:fw_iccm(c96ba000)
[Sstar_log]:Sstar_set_firmare:fw_dccm(c8571000)
[Sstar_log]:Sstar_start_load_firmware: START DOWNLOAD ICCM=========
[Sstar_log]:Sstar_load_firmware_generic: addr 10000: len 20000
[Sstar_log]:Sstar_start_load_firmware: START DOWNLOAD DCCM=========
[Sstar_log]:Sstar_load_firmware_generic: addr 800000: len 8000
[Sstar_log]:Sstar_after_load_firmware++
[Sstar_log]:Sstar_after_load_firmware:0x1610102c=0x4020e
[Sstar_log]:Sstar_after_load_firmware:0x1610102c=0x1020f
[Sstar_log]:Sstar_after_load_firmware:0x16101000=0x8000e08
[Sstar_log]:set_block_size=256
[Sstar_log]:firmwareCap f58f
[Sstar_log]:firmwareCap2 888f
[Sstar_log]:wsm_caps.firmwareCap 888ff58f
[Sstar_log]:apollo wifi WSM init done.
   Input buffers: 32 x 2048 bytes
   Hardware: 7.2
   WSM firmware [=MODEM=RF=Ares_AX  2GHZ Dec 24 2019 19:59:25NOTXConfrim], ver: 8677, build: 2690, api: 1060, cap: 0x888FF58F Config[30008]  expection 900a5c0, ep0 cmd addr 901be2c NumOfStations[8] NumOfInterfaces[3]
[Sstar_log]:EFUSE(8)				[0]
[Sstar_log]:EFUSE(I)					[0]
[Sstar_log]:EFUSE(B)			[1]
[Sstar_log]:CAPABILITIES_SSTAR_PRIVATE_IE      [1]
[Sstar_log]:CAPABILITIES_NVR_IPC              [1]
[Sstar_log]:CAPABILITIES_NO_CONFIRM           [1]
[Sstar_log]:CAPABILITIES_SDIO_PATCH           [0]
[Sstar_log]:CAPABILITIES_NO_BACKOFF           [0]
[Sstar_log]:CAPABILITIES_CFO                  [0]
[Sstar_log]:CAPABILITIES_AGC                  [1]
[Sstar_log]:CAPABILITIES_TXCAL                [1]
[Sstar_log]:CAPABILITIES_MONITOR              [0]
[Sstar_log]:CAPABILITIES_CUSTOM               [1]
[Sstar_log]:CAPABILITIES_SMARTCONFIG          [0]
[Sstar_log]:CAPABILITIES_ETF                  [1]
[Sstar_log]:CAPABILITIES_LMAC_RATECTL         [1]
[Sstar_log]:CAPABILITIES_LMAC_TPC             [1]
[Sstar_log]:CAPABILITIES_LMAC_TEMPC           [1]
[Sstar_log]:CAPABILITIES_CTS_BUG              [1]
[Sstar_log]:CAPABILITIES_USB_RECOVERY_BUG     [1]
[Sstar_log]:CAPABILITIES_USE_IPC              [1]
[Sstar_log]:CAPABILITIES_OUTER_PA             [0]
[Sstar_log]:CAPABILITIES_POWER_CONSUMPTION    [0]
[Sstar_log]:CAPABILITIES_RSSI_DECIDE_TXPOWER  [0]
[Sstar_log]:CAPABILITIES_RTS_LONG_DURATION    [1]
[Sstar_log]:CAPABILITIES_TX_CFO_PPM_CORRECTION[0]
[Sstar_log]:CAPABILITIES_SHARE_CRYSTAL       [0]
[Sstar_log]:CAPABILITIES_HW_CHECKSUM          [0]
[Sstar_log]:CAPABILITIES_SINGLE_CHANNEL_MULRX [1]
[Sstar_log]:CAPABILITIES_CFO_DCXO_CORRECTION  [0]
[Sstar_log]:mdelay wait wsm_startup_done  !!
[Sstar_log]:WSM_FIRMWARE_CHECK_ID
[Sstar_log]:wsm_generic_confirm:status(2)
[Sstar_log]:<WARNING> wsm_write_mib fail !!! mibId=4132
[Sstar_log]:apollo wifi : can't open /data/.mac.info
[Sstar_log]:efuse data is [0x1,0x3b,0x2,0x2,0x2,0x7,0x0,0x0,0x24:0x14:0x7:0x16:0x65:0x61]
[Sstar_log]:apollo wifi : can't open /Sstar_txpwer_dcxo_cfg.txt
[Sstar_log]:ELOG_INIT len 64 
[Sstar_log]:[Sstar_wtd]:set wtd_probe = 1
usbcore: registered new interface driver Sstar_wlan
[Sstar_log]:[wtd] register.
# [Sstar_log]:br0_netdev_open()-1116: dev_get_by_name(br0) failed2![Sstar_log]:br0_netdev_open()-1116: dev_get_by_name(br0) failed2!

3.2.4 检测对应外设节点

检查 wlan0 是否被建立节点

mdev -s
wlan0=`ifconfig -a | grep wlan0`
trial=0
maxtrycnt=50
while [ -z "$wlan0" ] && [ $trial -le $maxtrycnt ]
do 
    sleep 0.2
    #echo currect try $trial...
    trial=$(($trial + 1 ))
    wlan0=`ifconfig -a | grep wlan0`
done
if [ $trial -le $maxtrycnt ]; then
    echo try $trial times
fi
if [ $trial -gt $maxtrycnt ];then
    echo wlan0 not found
    exit -1
fi

3.2.5 操作日志开关

echo LOG_WARN=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask
echo LOG_INIT=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask
echo LOG_EXIT=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask
echo LOG_SCAN=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask
echo LOG_LMAC=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask
echo LOG_PM=OFF > /sys/module/ssw101b_wifi_usb/Sstarfs/Sstar_printk_mask

3.3 启动AP模式

# ifconfig wlan0 up
# ifconfig wlan0
  • ctrl_interface 需要和工具hostapd_cli保持一致
# cat /config/wifi/hostapd.conf
interface=wlan0
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
driver=nl80211
ssid=ssw101bap
hw_mode=g
channel=4
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP# 
  • 启动wifi的ap模式
# hostapd -B /config/wifi/hostapd.conf
Configuration file: /config/wifi/hostapd.conf
[Sstar_log]:br0_netdev_open()-1116: dev_get_by_name(br0) failed2![Sstar_log]:br0_netdev_open()-1116: dev_get_by_name(br0) failed2!
Using interface wlan0 with hwaddr 24:14:07:16:65:61 and ssid "ssw101bap"
[Sstar_log]:Sstar_upload_beacon: change ds_params channel 4 
[Sstar_log]:Sstar_set_priv_queue_cap:[0],queue_cap[224]
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 
# 
  • 配置wifi的设备IP
ifconfig wlan0 192.168.1.1
  • 启动DHCP和DNS服务
    这里用的是dnsmasq 工具,有人会用udhcp
dnsmasq -i wlan0 --no-daemon -C /config/wifi/dnsmasq.conf & 

3.5 其他设备连接热点

  • 连接
[Sstar_log]:Sstar_alloc_link_id:mac[a4:34:d9:e8:8e:3d],link_id(1)
[Sstar_log]:ieee80211_config_ap_ssid:ssid[ssw101bap]
[Sstar_log]:Sstar_upload_beacon: change ds_params channel 4 
[Sstar_log]:Sstar_sta_add:sta(a4:34:d9:e8:8e:3d)
dnsmasq-dhcp: DHCPDISCOVER(wlan0) a4:34:d9:e8:8e:3d 
dnsmasq-dhcp: DHCPOFFER(wlan0) 192.168.1.143 a4:34:d9:e8:8e:3d 
dnsmasq-dhcp: DHCPREQUEST(wlan0) 192.168.1.143 a4:34:d9:e8:8e:3d 
dnsmasq-dhcp: DHCPACK(wlan0) 192.168.1.143 a4:34:d9:e8:8e:3d DESKTOP-LIOGIUR
  • 断开
[Sstar_log]:Sstar_sta_remove:sta(a4:34:d9:e8:8e:3d)
[Sstar_log]:ieee80211_config_ap_ssid:ssid[ssw101bap]
[Sstar_log]:Sstar_upload_beacon: change ds_params channel 4 

3.6 hostapd_cli

暂时未用到

举报

相关推荐

WIFI--AP/P2P GO的带宽能力检查

0 条评论