SSD_WIFI AP&STA Enabling Introduction


1. Overview

sta mode: take wifi as a client to connect AP/router.

ap mode: take wifi as a hotspot for other devices to connect.


2. Board Modification


2.1. Enable STA Mode

  1. Add information of AP

    / # vi appconfigs/wpa_supplicant.conf
    ctrl_interface=/tmp/wifi/run/wpa_supplicant
    update_config=1
    
    network={
        ssid="aryl iPhone"
        psk="123456789a"
    }
    
  2. Initialize wifi

    cd /config/wifi

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:pwd

    Execute the initialization script:

    Execute ssw01bInit.sh on ssd20x

    Execute sigma_wifi_init.sh on ssd21x

  3. Test wifi connection

    ./wpa_supplicant -Dnl80211 -i wlan0 -c /appconfigs/wpa_supplicant.conf -d &
    sleep 2
    udhcpc  -i wlan0 -s /etc/init.d/udhcpc.script &
    

    Check connection status:

    ./wpa_cli -i wlan0 -p /tmp/wifi/run/wpa_supplicant status
    
  4. ping

    ping -I wlan0 14.215.177.39
    
  5. DNS

    Add nameserver 8.8.8.8 in /etc/resolv.conf;

    When testing, /etc/resolv.conf is missing or not writable, and dns server can be added by default in rootfs_dispcam.mk on ssd21x. modify rootfs.mk on ssd20x.

    touch $(OUTPUTDIR)/rootfs/etc/resolv.conf
    echo "nameserver 202.96.128.86" >> $(OUTPUTDIR)/rootfs/etc/resolv.conf
    echo "nameserver 8.8.8.8" >> $(OUTPUTDIR)/rootfs/etc/resolv.conf;
    

    Import the dns support library path, which depends on the path of libdns.

    export LD_LIBRARY_PATH=$LD_LIBRARY_ifPATH:/customer/libdns
    

    There is a corresponding lib in customer/libdns by default.

    If the folder is missing, please copy "libnss_dns*","libnss_files*","libresolv*" in the corresponding compiler.

    ping -I wlan0 
    /config/wifi # ping -I wlan0
    
    PING (163.177.151.109): 56 data bytes
    64 bytes from 163.177.151.109: seq=0 ttl=55 time=8.638 ms
    64 bytes from 163.177.151.109: seq=1 ttl=55 time=11.019 ms
    64 bytes from 163.177.151.109: seq=2 ttl=55 time=8.133 ms
    64 bytes from 163.177.151.109: seq=3 ttl=55 time=8.579 ms
    

    STA mode finished verification when completed the test steps above.


2.2. Enable AP Mode

  1. Enable AP mode

    ifconfig p2p0 up
    ifconfig p2p0 192.168.1.100 netmask 255.255.255.0
    ./hostapd -B /config/wifi/hostapd.conf
    ./dnsmasq -i p2p0 --no-daemon -C /config/wifi/dnsmasq.conf &
    

    Check the device information:

    ./hostapd_cli -i p2p0 -p /var/run/hostapd all_sta &
    
  2. Search ssid by PC: ssw101bap; passwd:12345678(ssid and password can be changed in hostapd.conf)

    AP mode finished verification when completed the test steps above.

STA and AP modes finished verification when completed the test steps above.