diff -udrNP openct-0.6.11.ubuntu.orig/debian/changelog openct-0.6.11/debian/changelog --- openct-0.6.11.ubuntu.orig/debian/changelog 2007-10-11 16:07:17.000000000 +0200 +++ openct-0.6.11/debian/changelog 2007-10-11 16:06:36.000000000 +0200 @@ -1,3 +1,14 @@ +openct (0.6.11-3gutsy1) gutsy; urgency=low + + * fix openct_udev script for ubuntu: ubuntu does not have /proc/bus/usb + (only an empty directory), so we need to use /dev/bus/usb instead. + the proper fix is to ask udev "what is the device name for this event" + and use the path udev tells us. This is implemented in openct 0.6.14 + and well tested, so all we need to do is to back-port the openct_usb.in + file and we are done. + + -- Andreas Jellinghaus Thu, 11 Oct 2007 16:06:32 +0200 + openct (0.6.11-3) unstable; urgency=low * debian/openct.postinst: Only create the group and call diff -udrNP openct-0.6.11.ubuntu.orig/etc/openct_usb.in openct-0.6.11/etc/openct_usb.in --- openct-0.6.11.ubuntu.orig/etc/openct_usb.in 2006-09-13 00:28:49.000000000 +0200 +++ openct-0.6.11/etc/openct_usb.in 2007-08-27 10:38:16.000000000 +0200 @@ -1,28 +1,43 @@ #!/bin/sh -test "$ACTION" = "add" || exit 0 -test -n "$DEVICE" -o -n "$DEVNAME" || exit 0 -test -e /var/run/openct/status || exit 0 +[ -n "$DEVPATH" ] || exit 0 +[ "$ACTION" = "add" ] || exit 0 +[ -e /var/run/openct/status ] || exit 0 -# race condition in the kernel, $DEVICE might not exist now -sleep 1 +# try to get the device node from the parent device +if [ -z "$DEVNAME" ]; then + DEVNAME=/dev/$(udevinfo --query=name --path=$(dirname $DEVPATH)) +fi +# if udev supplied a device node directly from the usb-device, we use it, +# because it is guaranteed to exist at the time we run +if [ -n "$DEVNAME" -a -e "$DEVNAME" ]; then + DEVICE="$DEVNAME" +fi -if [ -n "$DEVICE" ] -then - # if you see two ifdhandlers for one device, then you can - # either comment out the next line here ... - SBINDIR/openct-control attach usb:$PRODUCT usb $DEVICE - exit 0 +[ -n "$DEVICE" ] || exit 0 + +if [ -z "$PRODUCT" -a -n "$MODALIAS" ]; then + PRODUCT=$(echo $MODALIAS | sed -e 's/usb:v\(....\)p\(....\)d\(....\).*/\1\/\2\/\3/g' |tr A-F a-f) fi -if [ -n "$DEVNAME" ] -then - V="`cat /sys/$DEVPATH/device/idVendor |sed -e "s/^0*//"`" - P="`cat /sys/$DEVPATH/device/idProduct|sed -e "s/^0*//"`" - D="`cat /sys/$DEVPATH/device/bcdDevice |sed -e "s/^0*//"`" +if [ -z "$PRODUCT" ]; then + V=$(cat /sys$(dirname $DEVPATH)/idVendor | sed -e 's/^0*//') + P=$(cat /sys$(dirname $DEVPATH)/idProduct | sed -e 's/^0*//') + D=$(cat /sys$(dirname $DEVPATH)/bcdDevice | sed -e 's/^0*//') PRODUCT="$V/$P/$D" - # or the following line. both should disable that effect. - SBINDIR/openct-control attach usb:$PRODUCT usb $DEVNAME - exit 0 fi + +[ -n "$PRODUCT" ] || exit 0 + +# we may neeed to wait for the device node, when usbfs is used +for A in "0 1 2 3 4 5 6 7 8 9"; do + if [ -e "$DEVICE" ]; then + SBINDIR/openct-control attach usb:$PRODUCT usb $DEVICE + exit 0 + fi + sleep 0.1 +done + +echo "$0 waited for $DEVICE but it did not appear." | logger -p daemon.error +exit 0