This file is indexed.

/etc/init.d/irda-setup is in irda-utils 0.9.18-14ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash

. /etc/default/irda-utils

test "$AUTOMATIC" = "true" || exit 0

test -d /sys/bus/pnp/devices || exit 0

cd /sys/bus/pnp/devices

IRDA=0;
STATEFILE=/var/run/irdadev;

case $1 in
    start|restart|reload|force-reload)
    for x in *; do
	FIR="false";
	SIR="false";
	FALLBACK=true;
	OPTIONS=""
	for y in `cat $x/id`; do
	    case "$y" in
		PNP0510|PNP0511)
		SIR="true";
		;;
		NSC*)
		FIR="nsc-ircc";
		;;
		IBM0071)
		FIR="nsc-ircc";
		OPTIONS="dongle_id=0x09";
		;;
		SMC*)
		FIR="smsc-ircc2";
		;;	    
		ALI5123)
		FIR="ali-ircc";
		;;
		VIA3076)
		FIR="via-ircc"
	    esac
	done

	if [ $FIR = "false" -a $SIR = "false" ]; then
		continue;
	fi
	
    # Work out resource ranges, so we know which serial port to work with
	PORTS=`grep io $x/resources | sed -e 's/io \(.*\)-.*/\1/'`
	for PORT in $PORTS; do
		case $PORT in
	    	0x3f8)
	    	PORT="/dev/ttyS0"
		break;
	    	;;
	    	0x2f8)
	    	PORT="/dev/ttyS1"
		break;
	    	;;
	    	0x3e8)
	    	PORT="/dev/ttyS2"
	    	break;
		;;
	    	0x2e8)
	    	PORT="/dev/ttyS3"
	    	break;
		;;
	    	default)
	    	PORT="UNKNOWN"
	    	;;
		esac;
	done

	if [ "$FIR" != "false" ]; then
	    # The BIOS doesn't always activate the device. Prod it
	    echo disable >$x/resources;
	    echo activate >$x/resources;

	    UART="unknown";
	    if [ "$PORT" != "UNKNOWN" ]; then
	    # We should attempt to disable the UART. However, we need to store
	    # it - there's a chance that things could still go horribly wrong
		UART=`setserial $PORT | sed 's/.*UART: \(.*\), Port.*/\1/'`
		setserial $PORT uart none
	    fi
	    modprobe $FIR $OPTIONS;
	    if [ "$?" = "0" ]; then
		echo "irda$IRDA fir" >$STATEFILE;
		let "IRDA=$IRDA+1";
		continue;
	    else
	    # Try to recover
		if [ "$UART" != "undefined" ]; then
			setserial $PORT uart $UART;
		fi
	    fi
	fi
	
	if [ "$SIR" = "true" -o "$FIR" != "false" ]; then
	    # We'll only have got here if the FIR module has failed

	    if [ "$PORT" != "UNKNOWN" ]; then
	    # The BIOS doesn't always activate the device. Prod it
		echo disable >$x/resources;
		echo activate >$x/resources;

	    # The IRQ is not always set correctly, so try to deal with that
		IRQ=`grep irq $x/resources | sed -e 's/irq \(.*\)/\1/'`
		setserial $PORT irq $IRQ;
		echo "$PORT sir" >$STATEFILE;
	    fi
	fi
    done
    ;;
    stop)
    exit 0
    ;;
esac