小林不Coding
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Installation of Linux 802.11n CSI Tool in Ubuntu 14.04.2 & Visualization of CSI signals in real-time ## 1. Introduction - This page is written for recording the correct(my) steps of installation Linux 80211n CSI Tool and some errors I've met. After installation, I furthermore tried to visualize the CSI signals in real-time. Here is a example figure. ![](https://i.imgur.com/mQy855u.png) ## 2. Environment Preparation: - Operating System: Ubuntu14.04.2 (kernel 4.15) - Wireless Network Interface Card: Intel 5300 - Wifi Router: TP-Link Archer C9 - Install dual system in Windows10 if you need: - Use `rufus.exe` to transfer the .iso file into USB - Basically follow https://www.youtube.com/watch?v=yMHOpOuyjdc&ab_channel=%E5%A2%9E%E5%BB%A3%E5%BB%BA%E6%96%87 :::danger Don't try to use a virtual machine. The wireless NIC works differently on any virtual machine and you will never get the CSI signals. ::: ## 3. Installation of CSI tool - First, install some essential packages. ```c= sudo apt-get install gcc make linux-headers-$(uname -r) git-core apt-get install linux-headers-$(uname -r) //I really typed this command again. apt-get install aptitude && aptitude install dh-autoreconf apt install libelf-dev ``` - Download the tool and Install the Modified Wireless Driver. ```c= CSITOOL_KERNEL_TAG=csitool-$(uname -r | cut -d. -F 1-2) git clone https://github.com/dhalperi/linux-80211n-csitool.git cd linux-80211n-csitool git checkout ${CSITOOL_KERNEL_TAG} make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi modules sudo make -C /lib/modules/$(uname -r)/build M=$(pwd)/drivers/net/wireless/iwlwifi INSTALL_MOD_DIR=updates modules_install sudo depmod ``` - After install the driver, install the modified firmware. ```c= cd .. git clone https://github.com/dhalperi/linux-80211n-csitool-supplementary.git for file in /lib/firmware/iwlwifi-5000-*.ucode; do sudo mv $file $file.orig; done sudo 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.ucode make -C linux-80211n-csitool-supplementary/netlink ``` - Now, you've already completed the installation. And next is to activate the driver. ```c= sudo modprobe -r iwlwifi mac80211 sudo modprobe iwlwifi connector_log=0x1 sudo killall wpa_supplicant ``` :::info You need to type those three commands every time you reboot the computer. And with this tool, you can only connect to unencrypted wifi. ::: ### 3-1. Problems I've met during installation: - The first problem I've met is that compared to [the official installation instructions](https://dhalperi.github.io/linux-80211n-csitool/installation.html), in activating the driver, there are only two commands, `sudo modprobe -r iwlwifi mac80211` and `sudo modprobe iwlwifi connector_log=0x1`. After typing the second command, I can't connect to any unencrypted wifi. Therefore I added the third command, and I successed to connect unencrypted wifi. - The second problem is that after I typed the three commands above, I tried to log CSI signals. But it turned out nothing happened. In [official installation instructions](https://dhalperi.github.io/linux-80211n-csitool/installation.html), during installing essential packages, it only contains `sudo apt-get install gcc make linux-headers-$(uname -r) git-core`. After I added those three commands below in the beginning, it worked out! Furthermore, those three commands can solve the problem, "Can't read private key" which is mentioned in [official installation instructions](https://dhalperi.github.io/linux-80211n-csitool/installation.html). ```c= apt-get install linux-headers-$(uname -r) //I really typed this command again. apt-get install aptitude && aptitude install dh-autoreconf apt install libelf-dev ``` :::info Noted that during the installation, I didn't reboot the computer. ::: ### 3-2. References 1. https://blog.krybot.com/a?ID=fa6c25bf-b8b2-4f3b-bc71-9646bd026f9a 2. https://dhalperi.github.io/linux-80211n-csitool/installation.html 3. https://blog.csdn.net/zhangpeterx/article/details/88044404 ## 4. How to use the tool - First, you need to check the IP of your gateway(router). You can use this command and it'll return the informations of the connection: ```c= route -n ``` In my situation, my gateway IP is 192.168.0.1 . - Next, open a terminal A. Type this command: ```c= sudo linux-80211n-csitool-supplementary/netlink/log_to_file csi.dat ``` - Open another terminal B. Type this command: ```c= sudo ping 192.168.0.1 -i 0.05 ``` After you typied those two command, it should start writing the CSI signals. :::info Noted that `-i 0.05` is used to control the frequency of ping. 0.05 means every 0.05 second, transmit a packet. ::: ## 5. How to visualize the signals in real-time - In my case, I use one computer and one wifi router. And my matlab version is 2014b. - First, download the visualization tool: ```c= git clone https://github.com/lubingxian/Realtime-processing-for-csitool sudo cp ./Realtime-processing-for-csitool/matlab/read_bf_socket.m ./linux-80211n-csitool-supplementary/matlab/ sudo cp ./Realtime-processing-for-csitool/netlink/log_to_server.c ./linux-80211n-csitool-supplementary/netlink/ cd linux-80211n-csitool-supplementary/netlink gcc log_to_server.c -o log_to_server ``` - Next, open Matlab. Type those command in matlab. ```c= cd ./linux-80211n-csitool-supplementary/matlab/ read_bf_socket ``` After typing the command above, it will output "waiting for connection on port 8090." - Meanwhile, open a terminal A, type this command: ```c= sudo ping 192.168.0.1 -i 0.05 ``` - Next, open another terminal B, type this command: ```c= sudo ./linux-80211n-csitool-supplementary/netlink/log_to_server 127.0.0.1 8090 ``` Now, you should see the real-time change of CSI signals in matlab. ### 5-1. Problems I've met during visualizing CSI signals: - The first problem is that after I installed the matlab, I couldn't open matlab. It stucked in opening page. And my solution is reinstall the matlab. Then it worked out. - The second is that I followed the steps of the reference in the beginning. In step 2, I can't run `read_bf_socket` in matlab. It outputs error which is "undefined function read_bfee....". And my solution is copying the `read_bf_socket.m` file to the route `./linux-80211n-csitool-supplementary/matlab/`, and run `read_bf_socket` in matlab again, it works out. :::info In the beginning of this website, you can see a example figure. There are green, red, and blue lines. Each color represents one channel. There ten different lines of each color. It means ten packets recieved recently in one channel. In the code of `read_bf_socket.m`, `line 93` decides how many packets you want to show. Also, there is an annotation at `line 98`. ::: ### 5-2. Reference 1. https://blog.csdn.net/u014645508/article/details/82887470

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully