[
In English ] - [
UEagleAtmUdev ]
These are the steps to configure udev with ueagle-atm, so that the connection starts automatically when the modem is plugged in (or at boot).
These commands must be executed as root.
This has been tested on Ubuntu Dapper, with the kernel provided at
http://people.ubuntu.com/~bcollins/kernels-daily/, and with Ubuntu Edgy, with the official 2.6.17-11 kernel (both 386 and generic flavour), and with pppoa connection, but they should work also on other distributions that use udev.
Blacklist the eagle-usb module
To prevent the old eagle-usb module to be loaded, add this line
# replaced by ueagle-atm
blacklist eagle-usb
to /etc/modprobe.d/blacklist.
Have the connection work manually
When the modem is plugged in, the ueagle-atm module should load automatically, and the modem should syncronize, without you typing any command. Check that the following line shows up in the kernel log:
[ueagle-atm] modem operational
Then, follow instructions in
UeagleAtmDoc to start your connection, and note the needed commands. You will need them later.
When the connection is started, continue with the following steps.
Create the connection script
Create a file named /etc/udev/scripts/ueagle-atm, and copy the following lines
#!/bin/sh
(
if ! test -f /sys/bus/usb/devices/$1/stat_human_status; then exit; fi
while ! grep -q "Modem is operational" /sys/bus/usb/devices/$1/stat_human_status ; do sleep 1 ; done ;
while ! test -w /dev/log ; do sleep 1 ; done ;
# insert here the commands needed to start the connection
## pppoa
# pppd file /etc/ppp/peers/ueagle-atm
)&
Make this script exectuable (chmod a+rx).
The script waits for /dev/log (the pipe created by syslog) to be writable before starting the connection. This is to avoid a lockup when the machine boots with the modem connected: if the modem syncronizes before the root filesystem is mounted rw and syslog is started, pppd will block trying to send messages to syslog.
Create the udev rule
copy the following command to a terminal and run it, it will create the /etc/udev/rules.d/91-ueagle-atm.rules file, which will run the script when a modem supported by the driver is inserted.
for alias in `modinfo -F alias ueagle-atm`; do
echo SYSFS{modalias}==\"$alias\", RUN+=\"/etc/udev/scripts/ueagle-atm %k\";
Restart udev
Force udev to re-read its configuration:
udevcontrol reload_rules
Now you can test the script by unplugging e re-plugging your modem. The connection should start automatically after the modem syncronizes.