Package: irda-utils
Version: 0.9.16-11
Severity: normal
Tags: patch

Hello,

when setting ENABLE="true" in /etc/default/irda-utils, I got the
following error in a running session (i.e. not at boot):
=====
[EMAIL PROTECTED]:~$ sudo invoke-rc.d irda-utils start
error: "net.irda.discovery" is an unknown key
invoke-rc.d: initscript irda-utils, action "start" failed.
[EMAIL PROTECTED]:~$
=====

From what I could investigate, the problem is caused by the fact that
the irda module isn't loaded yet and thus there's no
net.irda.discovery variable for sysctl:
=====
[EMAIL PROTECTED]:~$ sysctl -a 2>/dev/null | grep irda
[EMAIL PROTECTED]:~$ sudo modprobe irda
[EMAIL PROTECTED]:~$ sysctl -a 2>/dev/null | grep irda
net.irda.lap_keepalive_time = 2000
net.irda.warn_noreply_time = 3
net.irda.max_noreply_time = 12
net.irda.max_tx_window = 7
net.irda.max_tx_data_size = 2042
net.irda.min_tx_turn_time = 10
net.irda.max_baud_rate = 16000000
net.irda.slot_timeout = 88
net.irda.discovery_timeout = 3
net.irda.discovery_slots = 6
net.irda.fast_poll_increase = 50
net.irda.debug = 0
net.irda.devname = Linux
net.irda.discovery = 0
[EMAIL PROTECTED]:~$
=====

The first attached patch moves the sysctl call after start of the
irattach daemon, where IMHO it belongs: there's no point in enabling
the discovery if the daemon is not running.

BTW, I'd also suggest two other things related to the init script:

1) implement a disable-discovery section before stopping the daemon
   (second patch)

2) modify the restard|force-reload section to call the stop and start
   commands, in order to correctly get the discover modifications
   (third patch)

Please evaluate the patches (they should be applied in order).

Thx, bye,
Gismo / Luca

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages irda-utils depends on:
ii  debconf [debconf-2.0]        1.5.5       Debian configuration management sy
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libglib1.2                   1.2.10-10.1 The GLib library of C routines
ii  makedev                      3.3.8.2-0   Creates device files in /dev
ii  module-init-tools            3.2.2-3     tools for managing Linux kernel mo

Versions of packages irda-utils recommends:
pn  ircp                          <none>     (no description available)
ii  openobex-apps                 1.3-2      Applications for OpenOBEX

-- debconf information:
* irda-utils/firopt: dongle_id=0x09 irq=3 dma=3 io=0x2f8
  irda-utils/dongle: none
* irda-utils/enable: true
* irda-utils/discovery: true
  irda-utils/ttydev: /dev/ttyS1
* irda-utils/setserial: /dev/ttyS1
* irda-utils/selectdevice: native
* irda-utils/firdev: nsc-ircc

--- /etc/init.d/irda-utils	2005-12-23 20:47:26.000000000 +0100
+++ irda-utils_gismo-1	2006-10-01 19:28:29.000000000 +0200
@@ -35,10 +35,8 @@
 fi
 if [ "$DISCOVERY" = "true" ]; then
     DISCOVERY="-s"
-    $SYSCTL -q -w net.irda.discovery=1
 else
     DISCOVERY=""
-    $SYSCTL -q -w net.irda.discovery=0
 fi
 
 
@@ -67,6 +65,12 @@
         -- $DEVICE $DONGLE $DISCOVERY
     sleep 1
 
+    if [ -n "$DISCOVERY" ]; then
+	$SYSCTL -q -w net.irda.discovery=1
+    else
+	$SYSCTL -q -w net.irda.discovery=0
+    fi
+	
     echo "115200" > /proc/sys/net/irda/max_baud_rate
     echo "."
     ;;
--- irda-utils_gismo-1	2006-10-01 19:28:29.000000000 +0200
+++ irda-utils_gismo-2	2006-10-01 19:29:12.000000000 +0200
@@ -76,6 +76,11 @@
     ;;
 stop)
     echo -n "Stopping $DESC: $NAME"
+
+    if [ -n "$DISCOVERY" ]; then
+	$SYSCTL -q -w net.irda.discovery=0
+    fi
+
     start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
     echo "."
     ;;
--- irda-utils_gismo-2	2006-10-01 19:29:12.000000000 +0200
+++ irda-utils_gismo-3	2006-10-01 19:33:37.000000000 +0200
@@ -87,12 +87,9 @@
 #reload)
 #   ;;
 restart|force-reload)
-    echo -n "Restarting $DESC: $NAME"
-    start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
+    $0 stop
     sleep 1
-    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
-        -- $DEVICE $DARG $DISCOVERY
-    echo "."
+    $0 start
     ;;
 *)
     N=/etc/init.d/$PACKAGE

Attachment: pgpUqhs3UTyNk.pgp
Description: PGP signature

Reply via email to