cfg80211 - wiphy - 1

收錄在 Ameba 的一百篇

--

cfg80211 是 Linux 上 用來設定 wifi 的 API, 用來取代原本的 wireless extension.

整個架構如下:




而 struct wiphy 是 wireless hardware description

我們先寫一個最基本的如下, 看是否能跑 - github


static struct cfg80211_ops my_cfg80211_ops = {
};


執行後會有 warn on
可以發現, wiphy_register() 會做一些設定的檢查.

至少要設定的有


(1) interface_modes
     我們先只設定一個 station mode

(2) bands
      只設定 2.4G band, 且故意 channels 寫 1~11



bit rates 這邊單位是 100Kbps



加上相關 code 之後, 執行 insmod 完, 用 iw list 可以發現有新增加的 phy#

且 bitrates / frequencies (channels) 即為所設定


Wiphy phy2
max # scan SSIDs: 0
max scan IEs length: 0 bytes
max # sched scan SSIDs: 0
max # match sets: 0
max # scan plans: 1
max scan plan interval: -1
max scan plan iterations: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Available Antennas: TX 0 RX 0
Supported interface modes:
* managed
Band 1:
Bitrates (non-HT):
* 1.0 Mbps
* 2.0 Mbps
* 5.5 Mbps
* 11.0 Mbps
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
Frequencies:
* 2412 MHz [1] (20.0 dBm)
* 2417 MHz [2] (20.0 dBm)
* 2422 MHz [3] (20.0 dBm)
* 2427 MHz [4] (20.0 dBm)
* 2432 MHz [5] (20.0 dBm)
* 2437 MHz [6] (20.0 dBm)
* 2442 MHz [7] (20.0 dBm)
* 2447 MHz [8] (20.0 dBm)
* 2452 MHz [9] (20.0 dBm)
* 2457 MHz [10] (20.0 dBm)
* 2462 MHz [11] (20.0 dBm)
Supported commands:
software interface modes (can always be added):
interface combinations are not supported
Device supports scan flush.


留言

熱門文章