The UCI configuration¶
Inside /etc/config/qmp you can find some options related to wireless interfaes
These are the default parameters sharing all wireless interfaces
config 'qmp' 'wireless' option 'driver' 'mac80211' option 'country' 'UZ' option 'bssid' '02:CA:FF:EE:BA:BE'
driver can be `mac80211` for athXk, and `madwifi` for madwifi
And these are the config parameters for each wifi interface.
config 'wireless' option 'channel' '44' option 'mode' 'adhoc' option 'name' 'qmp' option 'mac' '00:80:48:6b:25:b5' config 'wireless' option 'channel' '10' option 'mode' 'ap' option 'name' 'qmp.cat-AP' option 'mac' '00:80:48:6b:25:b6'
To apply this configuration to device, you must execute this commands:
. /etc/qmp/qmp_wireless.sh qmp_configure_wifi
This function takes the parameters from UCI and using the templates from: /etc/qmp/templates creates the openwrt wireless config
Templates are named like that: wireless.mac80211.adhoc wireless.madwifi.ap
Separed by dots, second name is the driver to use and third one is the mode.
These templates looks like this:
config wifi-device #QMP_DEVICE option type mac80211 option macaddr #QMP_MAC option channel #QMP_CHANNEL option diversity 0 # 0:off, 1:on option txantenna 0 # 0:auto, 1:main, 2:aux option rxantenna 0 # 0:auto, 1:main, 2:aux option country #QMP_COUNTRY option outdoor 1 # option txpower 1 config wifi-iface option device #QMP_DEVICE option mode adhoc option ssid #QMP_SSID option bssid #QMP_BSSID option encryption none
As you can see, the special words starting with #QMP will be replaced by UCI parameters.
So you can play a little with templates. For example, there is a template named: `wireless.mac80211.adhoc-n`
But the function qmp_wireless_config requires a complete configuration from UCI. So there is another function to generate the UCI config.
To execute this function:
. /etc/qmp/qmp_wireless.sh qmp_configure_wifi_initial
This generates de UCI qmp configuration, but not allways from zero. You can have some parameters configured and the function will configure the rest for you.
For example, you can have a configuration like this:
config 'wireless' option 'channel' '132' option 'mode' 'adhoc'
And after execute qmp_configure_wifi_initial you will have the rest of needed parameters
config 'wireless' option 'channel' '132' option 'mode' 'adhoc' option 'name' 'qmp' option 'mac' '00:80:48:6b:25:b5'
So, if you want to use the first device for meshing and the second one for access point, you can build the openwrt image with this kind of configuration:
config 'wireless' option 'mode' 'adhoc' config 'wireless' option 'mode' 'ap'
And after the first startup qmp_configure_wifi_initial will be executed putting the rest of parameters.
The default configuration is read from file: /etc/qmp/templates/wireless.default.config looks like that:
driver mac80211 country UZ bssid 02:CA:FF:EE:BA:BE channel 44 mode adhoc name qmp.cat
Also if the `mac` option is specified, the function will find this device that has this mac-address and use it. If not, it will use the first one free
This file is executed during first boot. It uses qmp_configure_wifi_initial and qmp_configure_wifi to leave wireless system ready.
If you want to reconfigure wireless system after first boot, you have to remove a control file named `/qmp_configured`
This script also executes the networking autoconfiguration (bmx6, olsr6...)