[Pkg-bluetooth-maintainers] Migrating from hotplug (sarge) to udev (etch)

Rainer Dorsch rdorsch at web.de
Sun Oct 8 09:57:21 UTC 2006


Hello,

after upgrading from sarge to etch, my bluetooth network was broken. Not a big 
surprise, it used hotplug and hotplug is gone in etch.

In sarge, I had an USB bluetooth dongle integrated in the sarge hotplug system 
by adding a hotplug script, which basically detects that the dongle was 
attached and restarts bluez-utils which then starts pand.

Has anybody an example how I would do something like this in the etch udev 
environment?

Many thanks,
Rainer

This is for reference the (old) hotplug script:

rd at topsi:~$ cat /etc/hotplug.d/usb/epox-bluetooth.hotplug
#!/bin/sh

# Hotplug script for the Epox BT-DG02A bluetooth dongle for Debian Linux 3.1
#
# The dongle reports several attachments. Therefore we filter for the VERSION.
# pand is started with /etc/init.d/bluez-utils, we restart bluez-utils when a
# dongle is plugged in. On a coldplug (usb dongle is in the system on boot),
# this hotplug script fails (called by rcS.d/S40hotplug), but the regular
# bluez-utils start script rc2.d/S25bluez-utils starts pand in this case

# The direct start-stop-daemon calls are legacy code and should be
# removed if this setup is solid.

pidfile=/var/run/pand.pid
DAEMON=/usr/bin/pand

CHARS=`echo $DEVPATH| wc -c`
VERSION=`echo $DEVPATH|cut -c $((CHARS-3))-$CHARS`

(date
echo $DEVPATH
echo $PRODUCT
echo $TYPE
echo $ACTION
echo $CHARS
echo $VERSION) >> /tmp/epox.log


case `echo $PRODUCT|cut -d / -f 1-2` in
        # a12/1/525 and a12/1/828 have been seen for the Epox BT DB02A
        a12/1) break ;;
        *) exit ;;
esac
case $TYPE in
        224/1/1) break ;;
        *) exit ;;
esac
case $ACTION in
        add)
            if [ ! -z VERSION ]; then
              if [ $VERSION = 1.0 ]; then
                # restart bluez-utils because it might not started up 
correctly
                sleep 2 # required for some reason
                echo Restart bluez-utils >> /tmp/epox.log
                /etc/init.d/bluez-utils restart >> /tmp/epox.log 
2>/tmp/epox.err
#                start-stop-daemon --start --exec $DAEMON -- --nodetach --role 
PANU --search --encrypt --pidfile $pidfile >> /tmp/pand.log
              fi
            fi
            ;;
        remove)
            ifdown bnep0
#            start-stop-daemon --stop --exec $DAEMON --pidfile $pidfile
            /etc/init.d/bluez-utils stop
            ;;
esac
rd at topsi:~$ 



-- 
Rainer Dorsch
Alzentalstr. 28
D-71083 Herrenberg
07032-919495
jabber: rdorsch at jabber.org
GPG Fingerprint: 5966 C54C 2B3C 42CC 1F4F  8F59 E3A8 C538 7519 141E
Full GPG key: http://pgp.mit.edu/



More information about the Pkg-bluetooth-maintainers mailing list