Projecte

General

Perfil

Wireless autoconf » Historial » Revisió 14

Revisió 13 (Pau Escrich, 13-06-2011 18:27) → Revisió 14/15 (Pau Escrich, 13-06-2011 18:27)

h1. Wireless autoconf 

 h2. The UCI configuration 

 This is the wireless configuration for file: /etc/config/qmp 

 These are the default parameters sharing all wireless interfaces 
 <pre> 
 config 'qmp' 'wireless' 
 	 option 'driver' 'mac80211' 
 	 option 'country' 'UZ' 
 	 option 'bssid' '02:CA:FF:EE:BA:BE' 
 </pre> 
 
 driver can be `mac80211` for athXk, and `madwifi` for madwifi 

 And these are the config parameters for each wifi interface. 
 <pre> 
  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' 

 </pre> 

 h2. qmp_wireless_config 

 To apply this configuration to device, you must execute this commands:  
 <pre> 
 . /etc/qmp/qmp_wireless.sh 
 qmp_configure_wifi 
 </pre> 
 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: 

 <pre> 
 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 
 </pre> 
 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. 

 h2. qmp_wireless_config_initial 

 To execute this function: 
 <pre> 
 . /etc/qmp/qmp_wireless.sh 
 qmp_configure_wifi_initial 
 </pre> 

 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: 
 <pre> 
 config 'wireless' 
 	 option 'channel' '132' 
 	 option 'mode' 'adhoc' 
 </pre> 

 And after execute qmp_configure_wifi_initial you will have the rest of needed parameters  
 <pre> 
 config 'wireless' 
 	 option 'channel' '132' 
 	 option 'mode' 'adhoc' 
         option 'name' 'qmp' 
 	 option 'mac' '00:80:48:6b:25:b5' 
 </pre> 

 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: 

 <pre> 
 config 'wireless' 
 	 option 'mode' 'adhoc' 

 config 'wireless' 
 	 option 'mode' 'ap' 
 </pre> 

 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: 
 <pre> 
 driver mac80211 
 country UZ 
 bssid 02:CA:FF:EE:BA:BE 
 channel 44 
 mode adhoc 
 name qmp.cat 
 </pre> 

 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 

 h2. /etc/init.d/qmp_autoconf 

 
 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...)