WHC Wi-Fi Fat Host Driver Porting

Driver Porting

FullMAC is currently tested and validated on Linux kernels 5.4 and 5.10. If you encounter compilation issues on other kernel versions, please contact us.

Note

SPI initiates data transfer immediately after CS pin is pulled low and CLK is detected. Corner cases may occur during bus busy states. Testing shows adding a 7μs delay between CS low and host CLK push ensures safe data transmission. However, older SPI drivers without spi_delay support may require direct code modification.

Prerequisites

Install dependencies on Linux:

sudo apt-get install build-essential
sudo apt install dhcpcd hostapd dhcpd
  1. Interface Activation

    • Linux PC: Skip this step

    • Raspberry Pi:

    Configure SDIO via dtoverlay.

    For Raspberry Pi 4:

    sudo dtoverlay sdio poll_once=off
    

    For Raspberry Pi 5:

    sudo dtoverlay sdio
    
  2. In directory /component/wifi/whc/whc_host_linux, run the following cmd. nan and p2p is an optional parameter and should be added only when Wi-Fi NAN and Wi-Fi P2P needs to be enabled.

    ./fullmac_setup.sh sdio [nan] [p2p]
    
  3. Select 1 or 2 based on the host operation mode

    choose target host mode:
    1) Fat host with cfg80211
    2) Slim host without cfg80211
    choose target host mode:
    
  4. Copy whc_host_linux to Linux kernel source tree

  5. Open new terminal and compile

    cd {driver_path}/whc_host_linux
    make
    
  1. Driver Loading

    Module Path: /whc_host_linux/sdio/fullmac_sdio.ko

    sudo su
    cp sdio/fullmac_sdio.ko /lib/modules/$(uname -r)/
    depmod -a
    modprobe fullmac_sdio
    

    After successful loading, run ifconfig to verify Wi-Fi devices.

    Sample Output:

    • Station mode MAC prefix: 00:e0:4c

    • SoftAP mode MAC prefix: 00:e1:4c

    ../../../_images/ifconfig_sta_softap.png

Functional Verification And Demo

  • Driver Loading Verification

    After successful modprobe loading, execute ifconfig to view Wi-Fi device information.

    Example Output:

    • Station mode: Device MAC address prefix is 00:e0:4c

    • SoftAP mode: Device MAC address prefix is 00:e1:4c

    ../../../_images/ifconfig_sta_softap.png
  • Stop NetworkManager and DHCP services to avoid conflicts

    Ubuntu System Note: When connecting via command line, you stop NetworkManager and DHCP services to avoid conflicts

    sudo systemctl stop NetworkManager dhcpcd.service
    sudo systemctl disable NetworkManager
    
  • Create configuration file ``/etc/wpa_supplicant/wpa_supplicant.conf``

    ctrl_interface=/var/run/wpa_supplicant
    network={
        ssid="HUAWEI-JX2UX5_HiLink_5G"
        psk="12345678"
    }
    
  • Start WPA connection

    wpa_supplicant -D nl80211 -i wlanX -c /etc/wpa_supplicant/wpa_supplicant.conf -dd > /var/wifi_log
    

    Note

    wlanX is the name of the wireless interface device, execute ifconfig -a` in the terminal to retrieve its information

  • Obtain IP address

    dhcpcd wlanX
    
  • Configuring SoftAP

    1. Create configuration file /etc/hostapd/hostapd.conf

    driver=nl80211
    logger_syslog=-1
    logger_syslog_level=2
    hw_mode=g
    channel=6
    ssid=aaa_test
    wpa=2
    wpa_passphrase=12345678
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=CCMP
    
    1. Create DHCP configuration file /etc/udhcpd_wlanX.conf

    start 192.168.43.20
    end 192.168.43.254
    interface wlanX
    opt dns 192.168.43.1
    option subnet 255.255.255.0
    opt router 192.168.43.1
    
    1. Start SoftAP

    hostapd /etc/hostapd/hostapd.conf -i wlanX
    
    1. Set AP IP address

    ifconfig wlanX 192.168.43.1 netmask 255.255.255.0
    
    1. Start DHCP service

    udhcpd -f /etc/udhcpd_wlanX.conf
    

Note

wlanX is the name of the wireless interface device, execute ifconfig -a in the terminal to retrieve its information

CUST_PATH Guide

In Fat Host mode,if custom communication between Host and Device is required beyond standard Wi-Fi/BT/Socket programming,the CUST_PATH can be utilized.