/[baselayout]/trunk/net.Linux/iwconfig.sh
Gentoo

Contents of /trunk/net.Linux/iwconfig.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2806 - (show annotations) (download) (as text)
Tue Jul 31 18:23:56 2007 UTC (7 years, 7 months ago) by uberlord
File MIME type: text/x-sh
File size: 17650 byte(s)
Remove baselayout-1 stuff
1 # Copyright 2004-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # Many thanks to all the people in the Gentoo forums for their ideas and
4 # motivation for me to make this and keep on improving it
5
6 _config_vars="$_config_vars ssid mode associate_timeout sleep_scan preferred_aps blacklist_aps"
7
8 iwconfig_depend() {
9 program /sbin/iwconfig
10 after plug
11 before interface
12 provide wireless
13 }
14
15 iwconfig_get_wep_status() {
16 local mode= status="disabled"
17
18 # No easy way of doing this grep in bash regex :/
19 if LC_ALL=C iwconfig "${IFACE}" | grep -qE "^ +Encryption key:[*0-9,A-F]" ; then
20 status="enabled"
21 mode=$(LC_ALL=C iwconfig "${IFACE}" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p')
22 [ -n "${mode}" ] && mode=" - ${mode}"
23 fi
24
25 echo "(WEP ${status}${mode})"
26 }
27
28 _get_ssid() {
29 local i=5 ssid=
30
31 while [ ${i} -gt 0 ] ; do
32 ssid=$(iwgetid --raw "${IFACE}")
33 if [ -n "${ssid}" ] ; then
34 echo "${ssid}"
35 return 0
36 fi
37 sleep 1
38 i=$((${i} + 1))
39 done
40
41 return 1
42 }
43
44 _get_ap_mac_address() {
45 local mac="$(iwgetid --raw --ap "${IFACE}")"
46 case "${mac}" in
47 "00:00:00:00:00:00") return 1 ;;
48 "44:44:44:44:44:44") return 1 ;;
49 "FF:00:00:00:00:00") return 1 ;;
50 "FF:FF:FF:FF:FF:FF") return 1 ;;
51 *) echo "${mac}" ;;
52 esac
53 }
54
55 iwconfig_get_mode() {
56 LC_ALL=C iwgetid --mode "${IFACE}" | \
57 sed -n -e 's/^.*Mode:\(.*\)/\1/p' | \
58 tr '[:upper:]' '[:lower:]'
59 }
60
61 iwconfig_set_mode() {
62 local mode="$1"
63 [ "${mode}" = "$(iwconfig_get_mode)" ] && return 0
64
65 # Devicescape stack requires the interface to be down
66 _down
67 iwconfig "${IFACE}" mode "${mode}" || return 1
68 _up
69 }
70
71 iwconfig_get_type() {
72 LC_ALL=C iwconfig "${IFACE}" | sed -n -e 's/^'"$1"' *\([^ ]* [^ ]*\).*/\1/p'
73 }
74
75 iwconfig_report() {
76 local mac= m="connected to"
77 local ssid="$(_get_ssid)"
78 local wep_status="$(iwconfig_get_wep_status)"
79 local channel="$(iwgetid --raw --channel "${iface}")"
80 [ -n "${channel}" ] && channel="on channel ${channel} "
81 local mode="$(iwconfig_get_mode)"
82 if [ "${mode}" = "master" ]; then
83 m="configured as"
84 else
85 mac="$(_get_ap_mac_address)"
86 [ -n "${mac}" ] && mac=" at ${mac}"
87 fi
88
89 eindent
90 einfo "${IFACE} ${m} SSID \"${SSID}\"${mac}"
91 einfo "in ${mode} mode ${channel}${wep_status}"
92 eoutdent
93 }
94
95 iwconfig_get_wep_key() {
96 local mac="$1" key=
97 [ -n "${mac}" ] && mac="$(echo "${mac}" | sed -e 's/://g')"
98 eval key=\$mac_key_${mac}
99 [ -z "${key}" ] && eval key=\$key_${SSIDVAR}
100 if [ -z "${key}" ] ; then
101 echo "off"
102 else
103 set -- ${key}
104 local x= e=false
105 for x in "$@" ; do
106 if [ "${x}" = "enc" ] ; then
107 e=true
108 break
109 fi
110 done
111 ${e} || key="${key} enc open"
112 echo "${key}"
113 fi
114 }
115
116 iwconfig_user_config() {
117 local conf= var=${SSIDVAR}
118 [ -z "${var}" ] && var=${IFVAR}
119
120 eval "$(_get_array "iwconfig_${var}")"
121 for conf in "$@" ; do
122 if ! eval iwconfig "${IFACE}" "${conf}" ; then
123 ewarn "${IFACE} does not support the following configuration commands"
124 ewarn " ${conf}"
125 fi
126 done
127
128 eval "$(_get_array "iwpriv_${var}")"
129 for conf in "$@" ; do
130 if ! eval iwpriv "${IFACE}" "${conf}" ; then
131 ewarn "${IFACE} does not support the following private ioctls"
132 ewarn " ${conf}"
133 fi
134 done
135 }
136
137 iwconfig_setup_specific() {
138 local mode="$1" channel=
139 if [ -z "${SSID}" ]; then
140 eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode"
141 eerror "adjust the ssid_${IFVAR} setting in /etc/conf.d/net"
142 return 1
143 fi
144 SSIDVAR=$(_shell_var "${SSID}")
145 local key=$(iwconfig_get_wep_key)
146
147 iwconfig_set_mode "${mode}"
148
149 # Now set the key
150 if ! eval iwconfig "${IFACE}" key "${key}" ; then
151 if [ "${key}" != "off" ]; then
152 ewarn "${IFACE} does not support setting keys"
153 ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
154 fi
155 fi
156
157 # Then set the SSID
158 if ! iwconfig "${IFACE}" essid "${SSID}" ; then
159 eerror "${IFACE} does not support setting SSID to \"${SSID}\""
160 return 1
161 fi
162
163 eval channel=\$channel_${SSIDVAR}
164 [ -z "${channel}" ] && eval channel=\$channel_${IFVAR}
165 # We default the channel to 3
166 if ! iwconfig "${IFACE}" channel "${channel:-3}" ; then
167 ewarn "${IFACE} does not support setting the channel to \"${channel:-3}\""
168 return 1
169 fi
170
171 # Finally apply the user Config
172 iwconfig_user_config
173
174 iwconfig_report
175 return 0
176 }
177
178 iwconfig_wait_for_association() {
179 local timeout= i=0
180 eval timeout=\$associate_timeout_${IFVAR}
181 timeout=${timeout:-10}
182
183 [ ${timeout} -eq 0 ] \
184 && vewarn "WARNING: infinite timeout set for association on ${IFACE}"
185
186 while true; do
187 # Use sysfs if we can
188 if [ -e /sys/class/net/"${IFACE}"/carrier ] ; then
189 if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ] ; then
190 # Double check we have an ssid. This is mainly for buggy
191 # prism54 drivers that always set their carrier on :/
192 [ -n "$(iwgetid --raw "${IFACE}")" ] && return 0
193 fi
194 else
195 local atest=
196 eval atest=\$associate_test_${IFVAR}
197 atest=${atest:-mac}
198 if [ "${atest}" = "mac" -o "${atest}" = "all" ] ; then
199 [ -n "$(_get_ap_mac_address)" ] && return 0
200 fi
201 if [ "${atest}" = "quality" -o "${atest}" = "all" ] ; then
202 [ "$(sed -n -e 's/^.*'"${IFACE}"': *[0-9]* *\([0-9]*\).*/\1/p' \
203 /proc/net/wireless)" != "0" ] && return 0
204 fi
205 fi
206
207 sleep 1
208 [ ${timeout} -eq 0 ] && continue
209 i=$((${i} + 1))
210 [ ${i} -ge ${timeout} ] && return 1
211 done
212 return 1
213 }
214
215 iwconfig_associate() {
216 local mode="${1:-managed}" mac="$2" wep_required="$3" freq="$4" chan="$5"
217 local w="(WEP Disabled)" key=
218
219 iwconfig_set_mode "${mode}"
220
221 if [ "${SSID}" = "any" ]; then
222 iwconfig "${IFACE}" ap any 2>/dev/null
223 unset SSIDVAR
224 else
225 SSIDVAR=$(_shell_var "${SSID}")
226 key="$(iwconfig_get_wep_key "${mac}")"
227 if [ "${wep_required}" = "on" -a "${key}" = "off" ] ; then
228 ewarn "WEP key is not set for \"${SSID}\" - not connecting"
229 return 1
230 fi
231 if [ "${wep_required}" = "off" -a "${key}" != "off" ] ; then
232 key="off"
233 ewarn "\"${SSID}\" is not WEP enabled - ignoring setting"
234 fi
235
236 if ! eval iwconfig "${IFACE}" key "${key}" ; then
237 if [ "${key}" != "off" ] ; then
238 ewarn "${IFACE} does not support setting keys"
239 ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
240 return 1
241 fi
242 fi
243 [ "${key}" != "off" ] && w="$(iwconfig_get_wep_status "${iface}")"
244 fi
245
246 if ! iwconfig "${IFACE}" essid "${SSID}" ; then
247 if [ "${SSID}" != "any" ] ; then
248 ewarn "${IFACE} does not support setting SSID to \"${SSID}\""
249 fi
250 fi
251
252 # Only use channel or frequency
253 if [ -n "${chan}" ] ; then
254 iwconfig "${IFACE}" channel "${chan}"
255 elif [ -n "${freq}" ] ; then
256 iwconfig "${IFACE}" freq "${freq}"
257 fi
258 [ -n "${mac}" ] && iwconfig "${IFACE}" ap "${mac}"
259
260 # Finally apply the user Config
261 iwconfig_user_config
262
263 ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
264
265 if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>/dev/null ; then
266 veinfo "Running preassociate function"
267 veindent
268 ( preassociate )
269 local e=$?
270 veoutdent
271 if [ ${e} -eq 0 ] ; then
272 veend 1 "preassociate \"${SSID}\" on ${IFACE} failed"
273 return 1
274 fi
275 fi
276
277 if ! iwconfig_wait_for_association ; then
278 eend 1
279 return 1
280 fi
281 eend 0
282
283 if [ "${SSID}" = "any" ]; then
284 SSID="$(_get_ssid)"
285 iwconfig_associate
286 return $?
287 fi
288
289 iwconfig_report
290
291 if type postassociate >/dev/null 2>/dev/null ; then
292 veinfo "Running postassociate function"
293 veindent
294 ( postassociate )
295 veoutdent
296 fi
297
298 return 0
299 }
300
301 iwconfig_scan() {
302 local x= i=0 scan=
303 einfo "Scanning for access points"
304 eindent
305
306 # Sleep if required
307 eval x=\$sleep_scan_${IFVAR}
308 [ -n "${x}" ] && sleep "${x}"
309
310 while [ ${i} -lt 3 ] ; do
311 local scan="${scan}${scan:+ }$(LC_ALL=C iwlist "${IFACE}" scan 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")"
312 # If this is the first pass and txpower as off and we have no results
313 # then we need to wait for at least 2 seconds whilst the interface
314 # does an initial scan.
315 if [ "${i}" = "0" -a "${txpowerwasoff}" = "0" ] ; then
316 case "${scan}" in
317 "'${IFACE} "*"No scan results"*)
318 sleep 2
319 txpowerwasoff=1
320 continue
321 ;;
322 esac
323 fi
324 i=$((${i} + 1))
325 done
326
327 if [ -z "${scan}" ] ; then
328 ewarn "${iface} does not support scanning"
329 eoutdent
330 eval x=\$adhoc_ssid_${IFVAR}
331 [ -n "${x}" ] && return 0
332 if [ -n "${preferred_aps}" ] ; then
333 [ "${associate_order}" = "forcepreferred" ] || \
334 [ "${associate_order}" = "forcepreferredonly" ] && return 0
335 fi
336 eerror "You either need to set a preferred_aps list in /etc/conf.d/wireless"
337 eerror " preferred_aps=\"SSID1 SSID2\""
338 eerror " and set associate_order_${IFVAR}=\"forcepreferred\""
339 eerror " or set associate_order_${IFVAR}=\"forcepreferredonly\""
340 eerror "or hardcode the SSID to \"any\" and let the driver find an Access Point"
341 eerror " ssid_${IFVAR}=\"any\""
342 eerror "or configure defaulting to Ad-Hoc when Managed fails"
343 eerror " adhoc_ssid_${IFVAR}=\"WLAN\""
344 eerror "or hardcode the SSID against the interface (not recommended)"
345 eerror " ssid_${IFVAR}=\"SSID\""
346 return 1
347 fi
348
349 local OIFS=$IFS
350 APS=-1
351 eval set -- ${scan}
352 for line in "$@" ; do
353 case "${line}" in
354 *Address:*)
355 APS=$((${APS} + 1))
356 eval MAC_${APS}=\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\"
357 eval QUALITY_${APS}=0
358 ;;
359 *ESSID:*)
360 x=${line#*\"}
361 x=${x%*\"}
362 eval SSID_${APS}=\$x
363 ;;
364 *Mode:*)
365 x="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]')"
366 if [ "${x}" = "master" ] ; then
367 eval MODE_${APS}=\"managed\"
368 else
369 eval MODE_${APS}=\$x
370 fi
371 ;;
372 *'Encryption key:'*)
373 x=${line#*:}
374 eval ENC_${APS}=\$x
375 ;;
376 #*Frequency:*)
377 # freq[i]="${line#*:}"
378 # x="${freq[i]#* }"
379 # freq[i]="${freq[i]%% *}${x:0:1}"
380 # ;;
381 *Channel:*)
382 x=${line#*:}
383 x=${x%% *}
384 eval CHAN_${APS}=\$x
385 ;;
386 *Quality*)
387 x=${line#*:}
388 x=${x%/*}
389 x="$(echo "${x}" | sed -e 's/[^[:digit:]]//g')"
390 x=${x:-0}
391 eval QUALITY_${APS}=\$x
392 ;;
393 esac
394 done
395
396 if [ -z "${MAC_0}" ]; then
397 ewarn "no access points found"
398 eoutdent
399 return 1
400 fi
401
402 # Sort based on quality
403 local i=0 k=1 a= b= x= t=
404 while [ ${i} -lt ${APS} ] ; do
405 k=$((${i} + 1))
406 while [ ${k} -le ${APS} ] ; do
407 eval a=\$QUALITY_${i}
408 [ -z "${a}" ] && break
409 eval b=\$QUALITY_${k}
410 if [ -n "${b}" -a "${a}" -lt "${b}" ] ; then
411 for x in MAC SSID CHAN QUALITY ENC ; do
412 eval t=\$${x}_${i}
413 eval ${x}_${i}=\$${x}_${k}
414 eval ${x}_${k}=\$t
415 done
416 fi
417 k=$((${k} + 1))
418 done
419 i=$((${i} + 1))
420 done
421
422 # Strip any duplicates
423 local i=0 k=1 a= b=
424 while [ ${i} -lt ${APS} ] ; do
425 k=$((${i} + 1))
426 while [ ${k} -le ${APS} ] ; do
427 eval a=\$MAC_${i}
428 eval b=\$MAC_${k}
429 if [ "${a}" = "${b}" ] ; then
430 eval a=\$QUALITY_${i}
431 eval b=\$QUALITY_${k}
432 local u=${k}
433 # We need to split this into two tests, otherwise bash errors
434 [ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
435 unset MAC_${u} SSID_${u} CHAN_${u} QUALITY_${u} ENC_${u}
436 fi
437 k=$((${k} + 1))
438 done
439 i=$((${i} + 1))
440 done
441
442 local i=0 e= m= s=
443
444 while [ ${i} -le ${APS} ] ; do
445 eval x=\$MAC_${i}
446 if [ -z "${x}" ] ; then
447 i=$((${i} + 1))
448 continue
449 fi
450
451 eval m=\$MODE_${i}
452 eval s=\$SSID_${i}
453 eval q=\$QUALITY_${i}
454 eval e=\$ENC_${i}
455 if [ -n "${e}" -a "${e}" != "off" ] ; then
456 e=", encrypted"
457 else
458 e=""
459 fi
460 if [ -z "${s}" ] ; then
461 einfo "Found ${x}, ${m}${e}"
462 else
463 einfo "Found \"${s}\" at ${x}, ${m}${e}"
464 fi
465
466 x="$(echo "${x}" | sed -e 's/://g')"
467 eval x=\$mac_ssid_${x}
468 if [ -n "${x}" ] ; then
469 eval SSID_${i}=\$x
470 s=${x}
471 eindent
472 einfo "mapping to \"${x}\""
473 eoutdent
474 fi
475
476 eval "$(_get_array "blacklist_aps")"
477 for x in "$@" ; do
478 if [ "${x}" = "${s}" ] ; then
479 ewarn "${s} has been blacklisted - not connecting"
480 unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i}
481 fi
482 done
483 i=$((${i} + 1))
484 done
485 eoutdent
486 }
487
488 iwconfig_force_preferred() {
489 [ -z "${preferred_aps}" ] && return 1
490
491 ewarn "Trying to force preferred in case they are hidden"
492 eval "(_get_array "preferred_aps")"
493 local ssid=
494 for ssid in "$@"; do
495 local found_AP=false i=0 e=
496 while [ ${i} -le ${APS} ] ; do
497 eval e=\$SSID_${i}
498 if [ "${e}" = "${ssid}" ] ; then
499 found_AP=true
500 break
501 fi
502 i=$((${i} + 1))
503 done
504 if ! ${found_AP} ; then
505 SSID=${e}
506 iwconfig_associate && return 0
507 fi
508 done
509
510 ewarn "Failed to associate with any preferred access points on ${IFACE}"
511 return 1
512 }
513
514 iwconfig_connect_preferred() {
515 local ssid= i= mode= mac= enc= freq= chan=
516
517 eval "$(_get_array preferred_aps)"
518 for ssid in "$@"; do
519 i=0
520 while [ ${i} -le ${APS} ] ; do
521 eval e=\$SSID_${i}
522 if [ "${e}" = "${ssid}" ] ; then
523 SSID=${e}
524 eval mode=\$MODE_${i}
525 eval mac=\$MAC_${i}
526 eval enc=\$ENC_${i}
527 eval freq=\$FREQ_${i}
528 eval chan=\$CHAN_${i}
529 iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
530 "${chan}" && return 0
531 fi
532 i=$((${i} + 1))
533 done
534 done
535
536 return 1
537 }
538
539 iwconfig_connect_not_preferred() {
540 local ssid= i=0 mode= mac= enc= freq= chan= pref=false
541
542 while [ ${i} -le ${APS} ] ; do
543 eval e=\$SSID_${i}
544 if [ -n "${e}" ] ; then
545 eval "$(_get_array preferred_aps)"
546 for ssid in "$@" ; do
547 if [ "${e}" = "${ssid}" ] ; then
548 pref=true
549 break
550 fi
551 done
552
553 if ! ${pref} ; then
554 SSID=${e}
555 eval mode=\$MODE_${i}
556 eval mac=\$MAC_${i}
557 eval enc=\$ENC_${i}
558 eval freq=\$FREQ_${i}
559 eval chan=\$CHAN_${i}
560 iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
561 "${chan}" && return 0
562 fi
563 fi
564 i=$((${i} + 1))
565 done
566
567 return 1
568 }
569
570 iwconfig_defaults() {
571 local x=
572 for x in txpower rate rts frag ; do
573 iwconfig "${IFACE}" "${x}" auto 2>/dev/null
574 done
575
576 # Release the AP forced
577 # Must do ap and then ssid otherwise scanning borks
578 iwconfig "${IFACE}" ap off 2>/dev/null
579 iwconfig "${IFACE}" essid off 2>/dev/null
580 }
581
582 iwconfig_configure() {
583 local x= APS=
584 eval SSID=\$ssid_${IFVAR}
585
586 # Support old variable
587 [ -z "${SSID}" ] && eval SSID=\$essid_${IFVAR}
588
589 # Setup ad-hoc mode?
590 eval x=\$mode_${IFVAR}
591 x=${x:-managed}
592 if [ "${x}" = "ad-hoc" -o "${x}" = "master" ] ; then
593 iwconfig_setup_specific "${x}"
594 return $?
595 fi
596
597 if [ "${x}" != "managed" -a "${x}" != "auto" ] ; then
598 eerror "Only managed, ad-hoc, master and auto modes are supported"
599 return 1
600 fi
601
602 # Has an SSID been forced?
603 if [ -n "${SSID}" ]; then
604 iwconfig_set_mode "${x}"
605 iwconfig_associate && return 0
606 [ "${SSID}" = "any" ] && iwconfig_force_preferred && return 0
607
608 eval SSID=\$adhoc_ssid_${IFVAR}
609 if [ -n "${SSID}" ]; then
610 iwconfig_setup_specific ad-hoc
611 return $?
612 fi
613 return 1
614 fi
615
616 eval x=\$preferred_aps_${IFVAR}
617 [ -n "${x}" ] && preferred_aps=${x}
618
619 eval x=\$blacklist_aps_${IFVAR}
620 [ -n "${x}" ] && blacklist_aps=${x}
621
622 eval x=\$associate_order_${IFVAR}
623 [ -n "${x}" ] && associate_order=${x}
624 associate_order=${associate_order:-any}
625
626 if [ "${associate_order}" = "forcepreferredonly" ]; then
627 iwconfig_force_preferred && return 0
628 else
629 iwconfig_scan || return 1
630 iwconfig_connect_preferred && return 0
631 [ "${associate_order}" = "forcepreferred" ] || \
632 [ "${associate_order}" = "forceany" ] && \
633 iwconfig_force_preferred && return 0
634 [ "${associate_order}" = "any" ] || \
635 [ "${associate_order}" = "forceany" ] && \
636 iwconfig_connect_not_preferred && return 0
637 fi
638
639 e="associate with"
640 [ -z "${MAC_0}" ] && e="find"
641 [ "${preferred_aps}" = "force" ] || \
642 [ "${preferred_aps}" = "forceonly" ] && \
643 e="force"
644 e="Couldn't ${e} any access points on ${IFACE}"
645
646 eval SSID=\$adhoc_ssid_${IFVAR}
647 if [ -n "${SSID}" ]; then
648 ewarn "${e}"
649 iwconfig_setup_specific ad-hoc
650 return $?
651 fi
652
653 eerror "${e}"
654 return 1
655 }
656
657 iwconfig_pre_start() {
658 # We don't configure wireless if we're being called from
659 # the background
660 ${IN_BACKGROUND} && return 0
661
662 save_options "SSID" ""
663 _exists || return 0
664
665 if ! _is_wireless ; then
666 veinfo "Wireless extensions not found for ${IFACE}"
667 return 0
668 fi
669
670 # Warn about old file - we want to punt it really
671 if [ -e /etc/conf.d/wireless ] ; then
672 ewarn "/etc/conf.d/wireless is deprecated"
673 ewarn "Please put all settings into /etc/conf.d/net"
674 . /etc/conf.d/wireless
675 fi
676
677 # Store the fact that tx-power was off so we default to a longer
678 # wait if our scan returns nothing
679 LC_ALL=C iwconfig "${IFACE}" | sed -e '1d' | grep -q "Tx-Power=off"
680 local txpowerwasoff=$?
681
682 iwconfig_defaults
683 iwconfig_user_config
684
685 # Set the base metric to be 2000
686 metric=2000
687
688 # Check for rf_kill - only ipw supports this at present, but other
689 # cards may in the future.
690 if [ -e /sys/class/net/"${IFACE}"/device/rf_kill ] ; then
691 if [ $(cat /sys/class/net/"${IFACE}"/device/rf_kill) != "0" ] ; then
692 eerror "Wireless radio has been killed for interface ${IFACE}"
693 return 1
694 fi
695 fi
696
697 einfo "Configuring wireless network for ${IFACE}"
698
699 # Are we a proper IEEE device?
700 # Most devices reutrn IEEE 802.11b/g - but intel cards return IEEE
701 # in lower case and RA cards return RAPCI or similar
702 # which really sucks :(
703 # For the time being, we will test prism54 not loading firmware
704 # which reports NOT READY!
705 x="$(iwconfig_get_type)"
706 if [ "${x}" = "NOT READY!" ]; then
707 eerror "Looks like there was a probem loading the firmware for ${IFACE}"
708 return 1
709 fi
710
711 if iwconfig_configure ; then
712 save_options "SSID" "${SSID}"
713 return 0
714 fi
715
716 eerror "Failed to configure wireless for ${IFACE}"
717 iwconfig_defaults
718 iwconfig "${IFACE}" txpower off 2>/dev/null
719 unset SSID SSIDVAR
720 _down
721 return 1
722 }
723
724 iwconfig_post_stop() {
725 ${IN_BACKGROUND} && return 0
726 _exists || return 0
727 iwconfig_defaults
728 iwconfig "${IFACE}" txpower off 2>/dev/null
729 }
730
731 # vim: set ts=4

  ViewVC Help
Powered by ViewVC 1.1.20