Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I need to use commands like iwconfig in Android, I know I have to install the wireless tools because they are not in Android by default, The problem is that I have just seen 3 chinesse tutorials that makes no sense when I translate them, and a link that downloads a directory with Android wireless tools, but I don't know what to do to get them into my device and use them.

Any help would be apreciated.

share|improve this question
add comment

migrated from stackoverflow.com Jul 13 '12 at 15:06

This question came from our site for professional and enthusiast programmers.

1 Answer

  1. Download wireless_tools.30.pre9.tar.gz. This version supports non-ASCII char in ESSID.

  2. Unpack it into mydroid/external/wireless-tools directory.

  3. Create Android.mk file with the following content:

    LOCAL_PATH:= $(call my-dir)
    ################## build iwlib ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwlib.c
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
    LOCAL_MODULE:= libiw
    LOCAL_STATIC_LIBRARIES := libcutils libc libm
    include $(BUILD_STATIC_LIBRARY)
    ################## build iwconfig #################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwconfig.c
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
    LOCAL_MODULE:= iwconfig
    LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
    #LOCAL_FORCE_STATIC_EXECUTABLE := true
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
    #LOCAL_MODULE_TAGS := eng user
    include $(BUILD_EXECUTABLE)
    ################## build iwlist ###################
    include $(CLEAR_VARS)
    LOCAL_SRC_FILES := iwlist.c iwlib.h
    LOCAL_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wpointer-arith -Wcast-qual -Winline -MMD -fPIC
    LOCAL_MODULE:= iwlist
    LOCAL_STATIC_LIBRARIES := libcutils libc libm libiw
    #LOCAL_FORCE_STATIC_EXECUTABLE := true
    LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) # install to system/xbin
    #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
    #LOCAL_MODULE_TAGS := eng user
    include $(BUILD_EXECUTABLE)
    
  4. Modify it as follows:

    • Change wireless.22.h to be wireless.h ;
    • Modify ifrename.c , add getline() function. You can get the code from external/genext2fs/genext2fs.c ; Notice that this file uses macro to pass another function to getline() .
    • Modify iwlib.h , change #include to be #include . [You might need to check the original file to know what the author means]
  5. Compile

    ~/eclair-21/external/wireless-tools$ . ../../build/envsetup.sh
    ~/eclair-21/external/wireless-tools/wireless-tools$ mm
    
  6. Copy files to the system

    ~/eclair-21/external/wireless-tools$ croot
    ~/eclair-21$ cp out/target/product/generic/system/xbin/iwconfig /nfs/rootfs/system/xbin/iwconfig
    ~/eclair-21$ cp out/target/product/generic/system/xbin/iwlist /nfs/rootfs/system/xbin/
    
  7. Test After starting Android:

    # modprobe libertas
    # modprobe libertas_sdio
    libertas_sdio: Libertas SDIO driver
    libertas_sdio: Copyright Pierre Ossman
    model=0xb
    sd8686_helper.bin sd8686.bin
    init: untracked pid 853 exited
    init: untracked pid 856 exited
    libertas: eth1: Marvell WLAN 802.11 adapter
    # iwconfig eth1                
    eth1      IEEE 802.11b/g  ESSID:"Antrose-11g"
              Mode:Managed  Frequency:2.437 GHz  Access Point: 00:15:E9:0C:87:7C
              Bit Rate:1 Mb/s   Tx-Power=13 dBm
              Retry limit:8   RTS thr=2347 B   Fragment thr=2346 B
              Encryption key:off
              Power Management:off
              Link Quality=83/100  Signal level=-60 dBm  Noise level=-93 dBm
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:1441
              Tx excessive retries:44  Invalid misc:11220   Missed beacon:0
    # iwlist scan
    eth1      Scan completed :
              Cell 01 - Address: 00:22:6B:8C:5D:3A
                        ESSID:"Antrose-11g"
                        Mode:Managed
                        Frequency:2.412 GHz (Channel 1)
                        Quality=65/100  Signal level=-78 dBm  Noise level=-96 dBm
                        Encryption key:off
                        Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                                  24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                                  12 Mb/s; 48 Mb/s
    # iwconfig eth1 essid Antrose-11g
    # iwconfig eth1                
    eth1      IEEE 802.11b/g  ESSID:"Antrose-11g"
              Mode:Managed  Frequency:2.437 GHz  Access Point: 00:15:E9:0C:87:7C
              Bit Rate:1 Mb/s   Tx-Power=13 dBm
              Retry limit:8   RTS thr=2347 B   Fragment thr=2346 B
              Encryption key:off
              Power Management:off
              Link Quality=83/100  Signal level=-60 dBm  Noise level=-93 dBm
              Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:1441
              Tx excessive retries:44  Invalid misc:11220   Missed beacon:0
    
  8. Done.

Ref: http://anemospring.blogspot.com.es/2011/03/android-wireless-tools.html

share|improve this answer
    
An answer which contains little more than a raw link to another site is not an answer. Readers shouldn't be forced to go to another site to get the information they need. That's why your previous answer just like this one was deleted. At best this is a comment. –  Al E. Jul 13 '12 at 17:29
    
1  
Thank you. Sorry I am a newbie here. I have edited the answer. –  spica Jul 13 '12 at 18:03
    
Nicely done. Now that's an answer! –  Al E. Jul 13 '12 at 18:43
    
Thank You, but, is this really gonna work in an Android device? how can I access to mydroid directory? This really helped a lot, but I still have some doubts about what to do. –  Alberto Urbina Jul 14 '12 at 8:55
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.