[wifi] capture: fix channel setting on Linux

On Linux, at least with the rt2500pci driver, the interface must be down
to set the mode, but up (and in managed mode) to set the channel.
This commit is contained in:
Matteo Cypriani 2011-08-07 22:12:19 +02:00
parent 5fd3e62717
commit a1f0a747a8
1 changed files with 8 additions and 6 deletions

View File

@ -79,24 +79,26 @@ check_dependencies()
# argument
iface_set_channel()
{
iface_down
echo -n "Setting interface $IFACE on channel $1... "
echo "Setting interface $IFACE on channel $1..."
case $OS in
Linux)
iwconfig $IFACE mode managed channel $1
iface_down
iwconfig $IFACE mode managed
iface_up
iwconfig $IFACE channel $1
;;
NetBSD)
iface_down
ifconfig $IFACE media autoselect chan $1
iface_up
;;
*)
error "Your OS is not supported."
;;
esac \
&& echo "OK." \
&& echo "Channel set." \
|| error "Cannot set the channel!"
iface_up
iface_monitor
}