MDM-WIFI(QCA9377,QCA6174)

一:wlan的配置文件其目录
apps_proc\mdm-init中wlan_sdio 中的makefile有如下内容

etcdir = ${sysconfdir}
dist_etc_DATA = cld-hostapd-wlan0.sh
dist_etc_DATA += cld-hostapd-wlan1.sh

misc_ddir = ${userfsdatadir}/misc/wifi
dist_misc_d_DATA = hostapd.conf
dist_misc_d_DATA += hostapd-wlan1.conf
dist_misc_d_DATA += sta_mode_hostapd.conf
dist_misc_d_DATA += wpa_supplicant.conf

init_ddir = ${sysconfdir}/init.d
dist_init_d_SCRIPTS = wlan

firmware_ddir = ${base_libdir}/firmware/wlan/qca_cld
dist_firmware_d_DATA = WCNSS_qcom_cfg.ini

cld-hostapd-wlan0.sh  cld-hostapd-wlan1.sh  hostapd.conf  hostapd-wlan1.conf  Makefile.am  sta_mode_hostapd.conf  WCNSS_qcom_cfg.ini  wlan  wpa_supplicant.conf
上面的文件在/data/mobileap_cfg.xml中的配置文件中需要使用
  <EnableIPV4>1</EnableIPV4>
  <EnableIPV6>1</EnableIPV6>
  <GatewayURL>mw43.home</GatewayURL>
  <WlanMode>AP</WlanMode>
  <WlanRestartDelay>1</WlanRestartDelay>
  <MobileAPSTABridgeEnable>0</MobileAPSTABridgeEnable>
  <HostAPDCfg>/data/misc/wifi/hostapd.conf</HostAPDCfg>
  <HostAPDEntropy>/data/misc/wifi/entropy_file</HostAPDEntropy>
  <STAModeHostAPDCfg>/data/misc/wifi/sta_mode_hostapd.conf</STAModeHostAPDCfg>
  <APIPAddr>192.168.1.1</APIPAddr>
  <SubNetMask>255.255.255.0</SubNetMask>
  <EnableDHCPServer>1</EnableDHCPServer>


二:hci-qcomm-init

在不使用BT功能的时候,正常是不需要hci-qcomm-init模块按照高通的文档,而此时ftmdaemon需要使用此lib
IMAGE_INSTALL += "hci-qcomm-init"
故上面的文件还不能屏蔽
/bin # ./ftmdaemon
./ftmdaemon: error while loading shared libraries: libbtnv.so.0: cannot open shared object file: No such file or directory
/bin #
/bin #

三:WLAN的启动
0:驱动
MDM平台默认的硬件接口为:SDIO,其主要芯片为:QCA9377,QCA6174,这些WIFI芯片属于网卡芯片,有主CPU进行控制,驱动也运行在host cpu上面。
MDM针对此芯片(QCA9377,QCA6174)提供的驱动为:wlan.ko,
IMAGE_INSTALL += "qcacld-hl"
其编译的.bb文件为:apps_proc\poky\meta-qti-bsp\recipes-connectivity\wlan中的qcacld-hl_git.bb
/usr/lib/modules/3.18.44/extra # ls -al
total 4228
drwxr-xr-x    2 root     root           456 Dec  9 09:30 .
drwxr-xr-x    4 root     root          1176 Jan  1  1970 ..
-rw-r--r--    1 root     root         13028 Nov 19 09:18 shortcut-fe-cm.ko
-rw-r--r--    1 root     root         32016 Nov 19 09:18 shortcut-fe-ipv6.ko
-rw-r--r--    1 root     root         31760 Nov 19 09:18 shortcut-fe.ko
-rw-r--r--    1 root     root       4243916 Nov 19 09:18 wlan.ko
/usr/lib/modules/3.18.44/extra #

/lib/firmware/wlan/qca_cld # ls -al
total 32
drwxr-xr-x    2 root     root           384 Dec  9 09:31 .
drwxr-xr-x    3 root     root           224 Nov 19 09:17 ..
-rw-r--r--    1 root     root         10234 Nov 19 09:18 WCNSS_cfg.dat
-rw-r--r--    1 root     root         13992 Nov 19 09:17 WCNSS_qcom_cfg.ini
-rw-rw-rw-    1 root     root            62 Dec  9 09:31 wlan_mac.bin
其中wlan_mac.bin用来存储MAC地址,WCNSS_qcom_cfg.ini其中是WLAN的配置文件,其比较重要,可以结合驱动和说明文档进行分析。
~ # ifconfig  wlan0
wlan0     Link encap:Ethernet  HWaddr 00:03:7F:24:8B:E7  
          inet addr:169.254.1.1  Bcast:255.255.255.255  Mask:0.0.0.0
          inet6 addr: fe80::203:7fff:fe24:8be7/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:249 errors:0 dropped:0 overruns:0 frame:0
          TX packets:636 errors:0 dropped:10 overruns:0 carrier:0
          collisions:0 txqueuelen:3000 
          RX bytes:22078 (21.5 KiB)  TX bytes:56862 (55.5 KiB)
1:运行模式
运行模式在<WlanMode>AP</WlanMode>中配置,其可以配置的参数如下:

typedef enum {
  QCMAP_MSGR_WLAN_MODE_ENUM_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum.  Do not change or use*/
  QCMAP_MSGR_WLAN_MODE_AP_V01 = 0x01, /**<  WLAN is in AP mode  */
  QCMAP_MSGR_WLAN_MODE_AP_AP_V01 = 0x02, /**<  WLAN is in AP/AP Mode  */
  QCMAP_MSGR_WLAN_MODE_AP_STA_V01 = 0x03, /**<  WLAN is in AP/STA Mode  */
  QCMAP_MSGR_WLAN_MODE_AP_AP_AP_V01 = 0x04, /**<  WLAN is in AP/AP/AP Mode  */
  QCMAP_MSGR_WLAN_MODE_AP_AP_STA_V01 = 0x05, /**<  WLAN is in AP/AP/STA Mode  */
  QCMAP_MSGR_WLAN_MODE_STA_ONLY_V01 = 0x06, /**<  WLAN is in STA only Mode  */
  QCMAP_MSGR_WLAN_MODE_AP_AP_AP_AP_V01 = 0x07, /**<  WLAN is in AP-AP-AP-AP Mode  */
  QCMAP_MSGR_WLAN_MODE_AP_STA_BRIDGE_V01 = 0x08, /**<  WLAN is in AP/STA Bridge Mode Only used for GetWLANStatus  */
  QCMAP_MSGR_WLAN_MODE_AP_AP_STA_BRIDGE_V01 = 0x09, /**<  WLAN is in AP/AP/STA Bridge Mode Only used for GetWLANStatus  */
  QCMAP_MSGR_WLAN_MODE_STA_ONLY_BRIDGE_V01 = 0x0A, /**<  WLAN is in STA Bridge Mode Only used for GetWLANStatus  */
  QCMAP_MSGR_WLAN_MODE_ENUM_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum.  Do not change or use*/
}qcmap_msgr_wlan_mode_enum_v01;

2:启动与关闭
驱动加载之后,枚举出来wlan0,之后直接对wlan0接口进行操作,或者通过调用QCMAP_ConnectionManager提供的服务来启动,
这一部分可以参考: QCMAP_CLI的代码,加入自己的处理逻辑。
~ # QCMAP_CLI 

Please select an option to test from the items listed below.

1. MobileAP Configuration                                    
2. LAN Configuration                                         
3. NAT/ALG/VPN Configuration                                 
4. WLAN Configuration                                        
5. Firewall Configuration                                    
6. Backhaul Configuration                                    
7. Tetehring Configuration                                   
8. Media Service Configuration                               
Option > 
其中定义的接口如下:
class QCMAP_WLAN
{
  private:
    static bool flag;
    static QCMAP_WLAN *object;
    QCMAP_WLAN();


  public:
    static QCMAP_WLAN* Get_Instance(boolean obj_create=false);

    ~QCMAP_WLAN();

    /*----------------------MobileAP WLAN Execution-----------------------*/

    //ALL VARIABLES HERE//
    qcmap_cm_wlan_conf_t wlan_cfg;
    /* Which mode is wifi brought up in */
    qcmap_cm_debug_conf_t debug_config;
    qcmap_msgr_wlan_mode_enum_v01 wifi_mode;
    qcmap_msgr_access_profile_v01 prev_guest_1_profile;
    qcmap_msgr_access_profile_v01 prev_guest_2_profile;
    qcmap_msgr_access_profile_v01 prev_guest_3_profile;
    boolean activate_wlan_in_progress;
    /* eth device number for first AP iface */
    static bool  priv_client_restart_wlan;

    /* Variable to Store the STAOnlyMode enabled state */
    boolean is_sta_only_mode_enabled;

    qcmap_msgr_wlan_status_ind_msg_v01 current_wlan_status;

    boolean AssociateWLANtoBridge(int wlan_index);

    boolean ReadWLANConfigFromXML();

    static boolean ReadWLANConfigPathsFromXML(qcmap_cm_wlan_paths_conf_t *wlan_paths);

    static boolean GetsetWLANConfigFromXML( qcmap_wlan_config_enum conf,
                                            qcmap_action_type action,
                                            uint32 *value );

    inline boolean IsWlanModeUpdated()
                        {return (this->wifi_mode != this->wlan_cfg.wlan_mode); }

    static boolean EnableWLAN( qmi_error_type_v01 *qmi_err_num,
                                     boolean enable_wlan_onbootup = false,
                                     boolean privileged_client    = false );

    boolean EnableWLANModule(char *,boolean bootup);

    /* Bring down Linux LAN. */
    static boolean DisableWLAN( qmi_error_type_v01 *qmi_err_num,
                                      boolean privileged_client    = false );
    inline boolean IsSSRInProgress(void)
                                  {return QCMAP_WLAN::priv_client_restart_wlan;}

    boolean DisableWLANModule(void);
    /* Set WLAN Mode. */
    static boolean SetWLANConfig
                           ( qcmap_msgr_wlan_mode_enum_v01 wlan_mode,
                             qcmap_msgr_guest_profile_config_v01*  guest_ap_access_profile,
                             qcmap_msgr_station_mode_config_v01 *station_config,
                             qmi_error_type_v01 *qmi_err_num );

    /* Get Configured LAN Mode */
    static boolean GetWLANConfig
                          ( qcmap_msgr_wlan_mode_enum_v01 *wlan_mode,
                            qcmap_msgr_guest_profile_config_v01 *guest_access_profile,
                            qcmap_msgr_station_mode_config_v01 *station_config,
                            qmi_error_type_v01 *qmi_err_num );

    /* Actiavte WLAN Request. */
    static boolean ActivateWLAN(qmi_error_type_v01 *qmi_err_num);

    /* Restart WLAN Request. */
    static boolean RestartWLAN(void);


    /* Get the Current LAN Status. */
    static boolean GetWLANStatus( qcmap_msgr_wlan_mode_enum_v01 *wlan_mode,
                                  qmi_error_type_v01 *qmi_err_num );

    /* Activate HostapdConfig Request.*/
    static boolean ActivateHostapdConfig
                       ( qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type,
                         qcmap_msgr_activate_hostapd_action_enum_v01 action_type,
                         qmi_error_type_v01 *qmi_err_num );

    boolean ActivateHostapdActionStart
                               ( qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type,
                                 int ap_pid,
                                 int guest_ap_pid,
                                 int guest_ap2_pid,
                                 int guest_ap3_pid,
                                 int active_ap_num,
                                 qmi_error_type_v01 *qmi_err_num );

    boolean ActivateHostapdActionStop
                               ( qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type,
                                 int ap_pid,
                                 int guest_ap_pid,
                                 int guest_ap2_pid,
                                 int guest_ap3_pid,
                                 qmi_error_type_v01 *qmi_err_num);

    boolean ActivateHostapdActionRestart
                               ( qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type,
                                 int ap_pid,
                                 int guest_ap_pid,
                                 int guest_ap2_pid,
                                 int guest_ap3_pid,
                                 int active_ap_num,
                                 qmi_error_type_v01 *qmi_err_num);

    /* Checks if hostapd is running. */
    boolean IsHostapdRunning(int iface);

    /* Checks if wpa_supplicant is running. */
    boolean IsSupplicantRunning(void);

    /* Kills the appropriate instance of hostapd_cli*/
    void StopHostapdCli(qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type);

    /* Starts the appropriate instance of hostapd_cli*/
    void StartHostapdCli(qcmap_msgr_activate_hostapd_ap_enum_v01 ap_type);

    /* Configure, start and stop the Linux HostAPD server. */
    boolean StopHostAPD(void);
    boolean StartHostAPD(int intf,int wlan_dev_index);

    boolean IsGuestProfile1Updated();
    boolean IsGuestProfile2Updated();
    void UpdateAccessProfileRules();
    void InstallGuestAPAccessRules(int ap_dev_num);
    void DeleteGuestAPAccessRules();
    boolean IsHostapdkilled(int omit_pid1, int omit_pid2, int omit_pid3);

    /*Get count of APs active*/
    int GetActiveAPCount(qcmap_msgr_wlan_mode_enum_v01 wifi_mode);

    /* Updates the IPACM_cfg file */
    boolean SetIPAWLANMode(int ap_dev_num,int mode);

    /* Enable STA Only Mode.
       Putting it in WLAN Class so that we dont have to create any additional objects */
    static boolean EnableSTAOnlyMode(qmi_error_type_v01 *qmi_err_num);
    static boolean DisableSTAOnlyMode(qmi_error_type_v01 *qmi_err_num);
    /* Send WLAN Status IND */
    void SendWLANStatusIND(void);
};
#endif


3:hostapd的关闭与启动
1238 root       0:00 [VosWDThread]
 1239 root       0:01 [VosMCThread]
 1274 root       0:00 hostapd -B /data/misc/wifi/hostapd.conf -P /data/hostapd_ssid1.pid -e /data/misc/wifi/entropy_file
 1406 root       0:03 [kworker/0:3]
 1417 root       0:00 hostapd_cli -i wlan0 -p /var/run/hostapd -B -a /usr/bin/QCMAP_StaInterface
 1785 root       0:00 {sh} /bin/busybox /bin/sh -
 1788 root       0:00 {telnetd} /bin/busybox /sbin/telnetd
 1789 root       0:00 {sh} /bin/busybox /bin/sh
 1799 root       0:00 {sleep} /bin/busybox /bin/sleep 15
 1801 root       0:00 {ps} /bin/busybox /bin/ps
~ # 

4: WPS

启动WPS
~ # hostapd_cli -i wlan0 wps_get_status
PBC Status: Disabled
Last WPS result: Success
Peer Address: 5c:1c:b9:4d:3e:03

查看链接的station
~ # hostapd_cli -i wlan0 all_sta
5c:1c:b9:4d:3e:03
flags=[AUTH][ASSOC][AUTHORIZED]
aid=0
capability=0x0
listen_interval=0
supported_rates=
timeout_next=NULLFUNC POLL
dot11RSNAStatsSTAAddress=5c:1c:b9:4d:3e:03
dot11RSNAStatsVersion=1
dot11RSNAStatsSelectedPairwiseCipher=00-0f-ac-4
dot11RSNAStatsTKIPLocalMICFailures=0
dot11RSNAStatsTKIPRemoteMICFailures=0
hostapdWPAPTKState=11
hostapdWPAPTKGroupState=0
wpsUuid=39ffa78d-f5c4-5dff-bea8-a4a5a0d45740
wpsPrimaryDeviceType=10-0050F204-5
wpsDeviceName=PD1730G
wpsManufacturer=vivo
wpsModelName=vivo Z3x
wpsModelNumber=vivo Z3x
wpsSerialNumber=6b1c6835
rx_packets=0
tx_packets=0
rx_bytes=0
tx_bytes=0
connected_time=11
~ # 

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Atheros AR8131 网卡驱动下载地址:(包括windows 驱动 和 Linux驱动) http://partner.atheros.com/Drivers.aspx Atheros AR9285无线网卡驱动,由开源项目MadWifi支持 在sourceforge搜索MadWifi可以找到: http://sourceforge.net/projects/madwifi/ 最新的Atheros无线网卡驱动主页: http://madwifi-project.org/ 对于新版本linux kernel 2.6.25之后(现在都是这个以上的内核),要用新的current版本。 http://snapshots.madwifi-project.org/madwifi-0.9.4-current.tar.gz In case you use kernel 2.6.25 or newer, you need to get this snapshot of the madwifi-0.9.4 branch instead of the v0.9.4 release! That snapshot is basically v0.9.4 plus compilation fixes for recent kernels. Atheros无线网卡驱动介绍: http://wireless.kernel.org/en/users/Drivers/Atheros AR9285无线网卡驱动 http://wireless.kernel.org/en/users/Drivers/ath9k Any distribution shipping a kernel >= 2.6.27 will have ath9k present but the ath9k driver on 2.6.32 is the oldest one recommended, anything older than that is completely unsupported. Below is a list of the minimal distribution requirements to either use ath9k from 2.6.27 or from compat-wireless, which lets you install newer drivers on older kernels. Ubuntu Intrepid (8.10) Fedora Core 10 openSUSE 11.1 Mandriva Linux 2009.0 (formally known as Mandrake Linux) ARCH Linux Gentoo Linux Red Flag Linux 7.0 (based on Fedora 10) RHEL5 2.6.18 kernel being tested When it went in ath9k was announced to have been merged into Linux-2.6.27-rc3 by Linus on Tue, 12 Aug 2008 19:33:16 -0700 (PDT), and consisted of 58.8% of the entire rc3 patch. Early distributions which picked it up OpenWrt became the first distribution to pick up ath9k and contribute to it.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

家有工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值