[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100221145228.GB22165@frolo.macqel>
Date: Sun, 21 Feb 2010 15:52:28 +0100
From: Philippe De Muyter <phdm@...qel.be>
To: chas3@...rs.sourceforge.net
Cc: netdev@...r.kernel.org
Subject: udev and usb atm modems
Hi Chas,
Now that /sys/devices/virtual/atm/cxacru0/carrier is reliable, I can use
udev scripts to automate the connection to my provider.
Here they are :
$ cat /etc/udev/rules.d/99-atm.rules
KERNELS=="cxacru0", RUN="/usr/local/bin/atm"
KERNELS=="nas0", RUN="/usr/local/bin/nas"
$ cat /usr/local/bin/atm
#!/bin/sh
# for atm + pppoe
if [ $ACTION = "add" ]
then
while [ "`cat /sys/devices/virtual/atm/cxacru0/carrier`" != 1 ]
do
sleep 1
done
/sbin/modprobe br2684
/usr/sbin/br2684ctl -b -c 0 -a 0.32
/sbin/ifconfig nas0 up
else
/sbin/ifconfig nas0 down
killall -9 br2684ctl
while killall -0 br2684ctl
do
sleep 1
done
/sbin/rmmod br2684
fi
$ cat /usr/local/bin/nas
#!/bin/sh
echo `date` $ACTION $DEVPATH $SUBSYSTEM $INTERFACE >> /tmp/atm.log
if [ $ACTION = "add" ]
then
/usr/sbin/pppd persist call pppoe nas0 user user@...vider defaultroute usepeerdns
else
/sbin/killall pppd
fi
$
This works perfectly, but /usr/local/bin/atm does busy waiting for the carrier
to appear. Do you know if the atm subsystem provides a event to udev when
carrier becomes 1 ?
Philippe
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists