802.11 tool release installation guide

来源:互联网 发布:找不到导航软件怎么办 编辑:程序博客网 时间:2024/05/21 07:47

Installation Guide

Many people said they did not successfully get the logged CSI data. Here I summarize some common problems and provide tested solutions.

prerequisite:

Hardware:

  • (1)Intel 5300 WiFi NIC card.
  • (2)Intel PC with PCIe socket.
  • (3)WiFi hostspots with no password

Software:

  • ubuntu 14.04 with kernel version 3.13 or 3.16.

I have test the above hardware and software and successfully obtain CSI data. Some scholars said they successfully retrieved CSI on 2.6.36 ![][1] and 3.5.7 ![][2]. I didn’t verify it yet. Some people may trying to implement this CSI tool on other platform like raspberry pi. Well, I have to say this will not work. This CSI tool can only expose CSI on PCIe bus. Raspberry pi or other embedded systems that do not has PCIe bus will not run this code successfully. While boards like hammingboard or HT83, which has PCIe bus, can run this tool. Some scholars have verify it on hammngboard ![][3].

step 1: Install the modified driver

After you install the ubuntu, please “sudo update”. Then follow the instruction here. Do not run the commands in the tips.
I have extracted the neccessary steps in the following:

1.  Prerequisitessudo apt-get install gcc make linux-headers-$(uname -r) git-core2. Build and Install the Modified Wireless DriverCSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d . -f 1-2)git clone https://github.com/dhalperi/linux-80211n-csitool.gitcd linux-80211n-csitoolgit checkout ${CSITOOL_KERNEL_TAG}make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi modulessudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi INSTALL_MOD_DIR=updates modules_installsudo depmodcd ..3. Install the Modified Firmwaregit clone https://github.com/dhalperi/linux-80211n-csitool-supplementary.gitfor file in /lib/firmware/iwlwifi-5000-*.ucode; do sudo mv $file $file.orig; donesudo cp linux-80211n-csitool-supplementary/firmware/iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/sudo ln -s iwlwifi-5000-2.ucode.sigcomm2010 /lib/firmware/iwlwifi-5000-2.ucode4. Build the Userspace Logging Toolmake -C linux-80211n-csitool-supplementary/netlink

step 2: Test the driver

Following the instruction here. For convenience, I have wrote a script. Run like this, “./run.sh YouWiFiName”.

#!/bin/bashsudo /etc/init.d/networking stopecho "stop networking"sleep 1sudo modprobe -r iwlwifi mac80211sleep 1sudo modprobe iwlwifi connector_log=0x1sleep 1echo "set hotspot essid $1"sudo iwconfig wlan0 essid $1sleep 1echo "connecting to the wifi, please wait"sudo dhclient wlan0echo "successfully connected to the wifi hotspot"

Noted that the first command “sudo /etc/init.d/networking stop” may not work on 3.13 if you have “sudo update”. It will output “Job failed …”. Ignore this output.

step 3: log the CSI data

run the following code

./log_to_file csi.dat

Problem 1: Can not connect to the AP

You can check it by running the iwconfig. Normally, you can see wlan0 in the output. But sometimes, by some uncertain reason, wlan0 is gone. This is because the wlan0 may be software blocked. Check it by running “rfkill list” and unblock the wifi by running “rfkill unblock wifi”.

Problem 2: CSI.dat is empty when ping

The cause for this one is that you driver is corrupt, you have to reinstall.
I think two clues can help you to check whether the driver is successfully installed.

  • In the second step in step 1, “2. Build and Install the Modified Wireless Driver”. When you run the last command, you should see “can’t access private key”. This can indicate that the driver is successfully installed.
  • After you run my “run.sh” bash scripte. Run the command “dmesg | grep -5 -i iwlwifi | grep connector_log”. Search the output to see whether there is one line that says “unknown parameter “connector_log=0x1” is ignored”. If there is no such line, then it will be ok, otherwise, the driver is corrupted. Reinstall the driver.

I have write a check script:

#!/usr/bin/sudo /bin/bashb=`iwconfig | grep -i wlan0 | wc -l`echo "$b"if [ $b == '1' ]then    echo "wifi is opened"elif [ $b == '0' ]then    echo "wifi is soft blocked"    exit 0fisleep 1b=`iwconfig | grep -i Not-Associated | wc -l`echo "$b"if [ $b == '1' ]then    echo "You have not connected to the wifi ap"    exit 0elif [ $b == '0' ]then    echo "You have connected to the wifi AP"fisleep 1a=`dmesg | grep -5 -i iwlwifi | grep connector_log | wc -l`if [ a == '1' ]then     echo "driver is not OK!!! please reinstall"else    echo "driver is OK! Congratuation."fi

##Problem 3: Could not setup monitor or inject mode
The default script to setup monitor or inject mode is not ok. If you run it on, the console may output “Device or resource busy”. I have altered the sequence of some commands and successfully get the csi data.

For the transmitter:

#!/usr/bin/sudo /bin/bashecho "start configure---------------------"modprobe -r iwlwifi mac80211 cfg80211modprobe iwlwifi debug=0x40000sleep 1ifconfig wlan0 2>/dev/null 1>/dev/nullwhile [ $? -ne 0 ]do            ifconfig wlan0 2>/dev/null 1>/dev/nulldoneecho "setting injection mode ok"sleep 1iw dev wlan0 interface add mon0 type monitorifconfig mon0 upecho "setting injection mon0"sleep 1iw mon0 set channel $1 $2echo "configuration is over-------------------------"

For the receiver:

#!/usr/bin/sudo /bin/bashsleep 1modprobe -r iwlwifi mac80211 cfg80211modprobe iwlwifi connector_log=0x1echo "step 1---------------"# Setup monitor mode, loop until it worksiwconfig wlan0 mode monitor 2>/dev/null 1>/dev/nullwhile [ $? -ne 0 ]do    iwconfig wlan0 mode monitor 2>/dev/null 1>/dev/nulldonesleep 1echo "monitor mode successfully set"ifconfig wlan0 upsleep 1echo "open wlan0"iw wlan0 set channel $1 $2sleep 1echo "setting wlan channel parameters"echo "successfully--------------------------"

Remember to install the driver for this follow the instruction here.

Some other problems are addressed here

[1]: J. Liu, Y. Wang, Y. Chen, J. Yang, X. Chen, and J. Cheng. Tracking vital signs during sleep leveraging off-the-shelf wifi. In Proceedings of the 16th ACM International Symposium on Mobile Ad Hoc Networking and Computing (MobiHoc), 2015.
[2]: S. Kumar, S. Gil, D. Katabi, and D. Rus. Accurate indoor localization with zero start-up cost. In Proceedings of the 20th Annual International Conference on Mobile Computing and Networking (MobiCom), 2014.
[3]: BodyScan: Enabling Radio-based Sensing on Wearable Devices for Contactless Activity and Vital Sign Monitoring. Mobisys 2016.

2 0