android移植Linux Wireless Extension Tools以及使用說明

  1. Wireless tools for Linux是一個Linux命令行工具包,用來設置支持Linux Wireless Extension的無線設備。Wireless tools for Linux 和 Linux Wireless Extension 由 Jean Tourrilhes在維護,由Hewlett-Packard(HP惠普)贊助。大多數基於Linux內核的操作系統都包含Wireless tools。在許多GNU/Linux 發行版中,都缺省安裝這個工具包,即使是沒有自動安裝,也能很容易地找到其二進制代碼安裝包。

    Wireless Extension (WE)是一組通用的API,能在用戶空間對通用Wireless LANs進行配置和統計。它的好處在於僅通過一組單一的工具就能對各種各樣的Wireless LANs進行管理,不過它們是什麼類型,只要其驅動支持Wireless Extension就行;另一個好處就是不用重啓驅動或Linux就能改變這些參數。Wireless Tools (WT)就是用來操作Wireless Extensions的工具集,它們使用字符界面,雖然粗糙,但支持所有Wireless Extension。

    雖然還有很多其他管理Wireless Extensions的工具,但Wireless Tools是參考實現,它包括以下工具:
    iwconfig:設置基本無線參數iwlist:掃描、列出頻率,比特率,密鑰等
    iwspy:獲取每個節點鏈接的質量(只能查閱與之相連的節點)
    iwpriv:操作Wireless Extensions 特定驅動
    ifrename: 基於各種靜態標準命名接口
     
  2. Wireless tools在android環境下的編譯
       下載原始工程:  https://github.com/kriswebdev/android_wireless_tools
        用以下內容替換Android.mk(以下內容只編譯了大多數的tool binary,有幾個沒有加入編譯, 需要的添加對應的部分就可以了~),然後mma編譯即可, 編譯出來的binary在system/xbin目錄
    LOCAL_PATH:= $(call my-dir)
    
    ################## build iwconfig #################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwconfig.c iwlib.c
    LOCAL_MODULE:= iwconfig
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    
    ################## build iwlist ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwlist.c iwlib.c
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= iwlist
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    ################## build iwpriv ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwpriv.c iwlib.c
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= iwpriv
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    ################## build iwspy ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwspy.c iwlib.c
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= iwspy
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    ################## build iwgetid ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwgetid.c iwlib.c
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= iwgetid
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    ################## build iwevent ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwevent.c iwlib.c
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= iwevent
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    ################## build macaddr ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := macaddr.c iwlib.c
    LOCAL_MODULE_TAGS := optional
    LOCAL_MODULE:= macaddr
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC -Wno-implicit-function-declaration -Wno-self-assign
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    include $(BUILD_EXECUTABLE)
    

     

  3. 工具使用(具體細節可以通過help查找用法)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章