summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Briesenick <sbriesen@gentoo.org>2008-03-22 18:34:11 +0000
committerStefan Briesenick <sbriesen@gentoo.org>2008-03-22 18:34:11 +0000
commitbbb61bc9bbf680f60b52d97bdc094f7b61bb3df5 (patch)
treea34339805df37e82d49863cc9ab3823f211a689a
parentversion bump (diff)
downloadgentoo-2-bbb61bc9bbf680f60b52d97bdc094f7b61bb3df5.tar.gz
gentoo-2-bbb61bc9bbf680f60b52d97bdc094f7b61bb3df5.tar.bz2
gentoo-2-bbb61bc9bbf680f60b52d97bdc094f7b61bb3df5.zip
revbump. complete new and shiny init-scripts + udev hotplugging.
(Portage version: 2.1.4.4)
-rw-r--r--net-wireless/irda-utils/ChangeLog11
-rw-r--r--net-wireless/irda-utils/files/irda-setup.sh68
-rw-r--r--net-wireless/irda-utils/files/irda-usb.rules1
-rw-r--r--net-wireless/irda-utils/files/irda-usb.sh70
-rw-r--r--net-wireless/irda-utils/files/irda-utils-0.9.18-smcinit.diff14
-rw-r--r--net-wireless/irda-utils/files/irda.confd27
-rw-r--r--net-wireless/irda-utils/files/irda.initd71
-rw-r--r--net-wireless/irda-utils/files/irda.modsd46
-rw-r--r--net-wireless/irda-utils/files/irda.rules18
-rw-r--r--net-wireless/irda-utils/irda-utils-0.9.18-r2.ebuild (renamed from net-wireless/irda-utils/irda-utils-0.9.18-r1.ebuild)34
10 files changed, 329 insertions, 31 deletions
diff --git a/net-wireless/irda-utils/ChangeLog b/net-wireless/irda-utils/ChangeLog
index 3b30de08e942..49c02ca498ff 100644
--- a/net-wireless/irda-utils/ChangeLog
+++ b/net-wireless/irda-utils/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for net-wireless/irda-utils
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/ChangeLog,v 1.24 2008/03/06 21:15:00 sbriesen Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/ChangeLog,v 1.25 2008/03/22 18:34:10 sbriesen Exp $
+
+*irda-utils-0.9.18-r2 (22 Mar 2008)
+
+ 22 Mar 2008; Stefan Briesenick <sbriesen@gentoo.org>
+ +files/irda-utils-0.9.18-smcinit.diff, +files/irda.confd,
+ +files/irda.initd, +files/irda.modsd, +files/irda.rules,
+ +files/irda-setup.sh, -files/irda-usb.rules, files/irda-usb.sh,
+ -irda-utils-0.9.18-r1.ebuild, +irda-utils-0.9.18-r2.ebuild:
+ revbump. complete new and shiny init-scripts + udev hotplugging.
*irda-utils-0.9.18-r1 (06 Mar 2008)
diff --git a/net-wireless/irda-utils/files/irda-setup.sh b/net-wireless/irda-utils/files/irda-setup.sh
new file mode 100644
index 000000000000..ff3e57f9a25d
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda-setup.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# irda-setup
+#
+# Initialize IrDA devices. Based on an Ubuntu init-script,
+# but adapted to be called directly from udev.
+#
+# params: sir/fir <module> <options>
+
+MODE="${1}"
+shift
+
+SYSFS="/sys"
+RESOURCES="${SYSFS}${DEVPATH}/resources"
+
+# Work out resource ranges, so we know which serial port to work with
+PORTS=$(/bin/sed -n 's/io \(.*\)-.*/\1/p' "${RESOURCES}")
+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
+
+# Handle FIR dongles
+if [ "${MODE}" = "fir" ]; then
+ # The BIOS doesn't always activate the device. Prod it
+ echo disable > "${RESOURCES}"
+ echo activate > "${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=$(/bin/setserial ${PORT} | /bin/sed 's/.*UART: \(.*\), Port.*/\1/')
+ /bin/setserial ${PORT} uart none
+ fi
+
+ # Load FIR module
+ /sbin/modprobe -sq "${@}" && exit 0 # OK
+
+ # Try to recover
+ [ "${UART}" != "undefined" ] && /bin/setserial ${PORT} uart ${UART}
+fi
+
+# We'll only have got here if we have SIR or the FIR module has failed
+if [ "${PORT}" != "UNKNOWN" ]; then
+ # The BIOS doesn't always activate the device. Prod it
+ echo disable > "${RESOURCES}"
+ echo activate > "${RESOURCES}"
+
+ # The IRQ is not always set correctly, so try to deal with that
+ /bin/setserial ${PORT} $(/bin/grep -h '^irq ' "${RESOURCES}")
+fi
+
+exit 0 # never fail
diff --git a/net-wireless/irda-utils/files/irda-usb.rules b/net-wireless/irda-utils/files/irda-usb.rules
deleted file mode 100644
index 067e12010c2a..000000000000
--- a/net-wireless/irda-utils/files/irda-usb.rules
+++ /dev/null
@@ -1 +0,0 @@
-KERNEL=="irda[0-9]*", RUN+="/lib/udev/irda-usb.sh"
diff --git a/net-wireless/irda-utils/files/irda-usb.sh b/net-wireless/irda-utils/files/irda-usb.sh
index fdbc4cf46737..d0250eab891f 100644
--- a/net-wireless/irda-utils/files/irda-usb.sh
+++ b/net-wireless/irda-utils/files/irda-usb.sh
@@ -1,26 +1,62 @@
-#!/bin/bash
+#!/bin/sh
+#
+# irda-usb
+#
+# Hotplug IrDA-USB devices. Only USB devices are handled!
+# To initialize normal SIR/FIR dongles, please use /etc/init.d/irda
-# Find out where sysfs is mounted. Exit if not available
-SYSFS=$(/bin/sed -n "s:^[^ ]* \([^ ]\+\) sysfs .*:\1:p" /proc/mounts)
-if [[ -z "${SYSFS}" ]]; then
- echo "sysfs is required"
- exit 1
-fi
+SYSFS="/sys"
+
+checkusb() {
+ # quick check, but not always available
+ [ "${PHYSDEVBUS}" = "usb" ] && return 0
+
+ # alternative check via modalias
+ /bin/grep -q '^usb:' "${SYSFS}${DEVPATH}/device/modalias" 2>/dev/null
+}
+
+checkconfig() {
+ . /etc/conf.d/irda
+
+ if [ "${DISCOVERY}" = "yes" ]; then
+ DISCOVERY="-s"
+ else
+ DISCOVERY=""
+ fi
+
+ NET_IRDA_OPTS=""
+
+ # Set maximum baud rate for IrDA
+ if [ -n "${MAX_BAUD_RATE}" ]; then
+ NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.max_baud_rate=${MAX_BAUD_RATE}"
+ fi
+
+ # Disable discovery (enabling is done automatically by irattach)
+ if [ -z "${DISCOVERY}" ]; then
+ NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.discovery=0"
+ fi
+}
case "${ACTION}" in
add)
- MODALIAS="${SYSFS}${DEVPATH}/device/modalias"
- if [[ -f "${MODALIAS}" ]]; then
- case $(<"${MODALIAS}") in
- usb:*)
- # attach USB-IrDA interface
- /usr/sbin/irattach ${INTERFACE} -s
- ;;
- esac
- fi
+ # We handle USB only
+ checkusb || exit 0
+
+ # Load config
+ checkconfig
+
+ # Load IrDA modules
+ /sbin/modprobe -sqa ircomm-tty ${LOAD_MODULES}
+
+ # Set IrDA options
+ [ -n "${NET_IRDA_OPTS}" ] && /sbin/sysctl -e -q -w ${NET_IRDA_OPTS}
+
+ # Finally, attach IrDA device
+ /usr/sbin/irattach ${INTERFACE} ${DISCOVERY}
;;
+
remove)
- # unconditionally kill irattach instance
+ # Unconditionally kill irattach instance
/usr/bin/pkill -f "^/usr/sbin/irattach ${INTERFACE} ?"
;;
esac
diff --git a/net-wireless/irda-utils/files/irda-utils-0.9.18-smcinit.diff b/net-wireless/irda-utils/files/irda-utils-0.9.18-smcinit.diff
new file mode 100644
index 000000000000..dd06efec02a8
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda-utils-0.9.18-smcinit.diff
@@ -0,0 +1,14 @@
+--- smcinit/smcinit.c.orig 2006-07-11 08:16:06.000000000 +0200
++++ smcinit/smcinit.c 2008-03-22 05:49:38.000000000 +0100
+@@ -292,9 +292,9 @@
+ }
+
+ twobyte = pci_read_word(dev, DID);
+- if ((twobyte != 0x24cc) & (twobyte != 0x248c)) {
++ if ((twobyte != 0x244c) & (twobyte != 0x24cc) & (twobyte != 0x248c)) {
+ fprintf(stderr,
+- "%s IO hub device %x not 82801CAM (0x248c or 0x24cc)\n",
++ "%s IO hub device %x not 82801BAM/82801CAM (0x24cc or 0x244c or 0x248c)\n",
+ PROGNAME, twobyte);
+ return 1;
+ }
diff --git a/net-wireless/irda-utils/files/irda.confd b/net-wireless/irda-utils/files/irda.confd
new file mode 100644
index 000000000000..abe483e70724
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda.confd
@@ -0,0 +1,27 @@
+# Set your startup settings for irattach, the IrDA-daemon, here.
+# please also look at /etc/modprobe.d/irda
+
+# Set discovery mode which usually is a good idea for finding other devices.
+# If set 'yes' or 'no' irattach and sysctl are used to enable and disable
+# discovery mode. By default discover mode is disabled.
+DISCOVERY="yes"
+
+# Set IRDA device to access (e.g. /dev/ttyS1 or irda0). In case of irda0,
+# the proper module for FIR-mode has to be set in /etc/modprobe.d/irda.
+DEVICE="/dev/ttyS1"
+
+# Set dongle type, e.g. none, tekram, esi, actisys, actisys+, ep7211, girbil,
+# litelink, airport, old_belkin, mcp2120, act200l, ma600). You do not need
+# a dongle for FIR mode. See "man 8 irattach" for more information.
+DONGLE="none"
+
+# Set the serial device to quiet with setserial. This is only useful on some
+# machines in FIR-mode, so most people should leave it blank.
+#SETSERIAL="/dev/ttyS1"
+
+# Sets the maximum baud rate for the IrDA serial port.
+# Some devices (e.g. Nokia mobile phones) need this.
+#MAX_BAUD_RATE="115200"
+
+# Load extra modules
+#LOAD_MODULES="irlan irnet"
diff --git a/net-wireless/irda-utils/files/irda.initd b/net-wireless/irda-utils/files/irda.initd
new file mode 100644
index 000000000000..8cbf0664c998
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda.initd
@@ -0,0 +1,71 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/files/irda.initd,v 1.1 2008/03/22 18:34:11 sbriesen Exp $
+
+# Hint: We don't use start-stop-daemon, because pidfile is the same
+# for every irattach instance. So it isn't reliable if we have more
+# than one IrDA device (i.e. with IrDA-USB).
+
+depend() {
+ use serial
+}
+
+checkconfig() {
+ if [ -z "${DEVICE}" ]; then
+ DEVICE="/dev/ttyS1"
+ fi
+
+ if [ -z "${DONGLE}" -o "${DONGLE}" = "none" ]; then
+ DONGLE=""
+ else
+ DONGLE="-d ${DONGLE}"
+ fi
+
+ if [ "${DISCOVERY}" = "yes" ]; then
+ DISCOVERY="-s"
+ else
+ DISCOVERY=""
+ fi
+
+ NET_IRDA_OPTS=""
+
+ # Set maximum baud rate for IrDA
+ if [ -n "${MAX_BAUD_RATE}" ]; then
+ NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.max_baud_rate=${MAX_BAUD_RATE}"
+ fi
+
+ # Disable discovery (enabling is done automatically by irattach)
+ if [ -z "${DISCOVERY}" ]; then
+ NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.discovery=0"
+ fi
+
+ # Ensure that SIR driver is loaded (needed for pmac_zilog)
+ case "${DEVICE}" in
+ /dev/ttyS*) LOAD_MODULES="${LOAD_MODULES} irtty-sir";;
+ esac
+}
+
+start() {
+ checkconfig
+ ebegin "Starting IrDA"
+
+ # Needed for some machines in FIR-mode
+ [ -n "${SETSERIAL}" ] && /bin/setserial ${SETSERIAL} uart none port 0x0 irq 0
+
+ # Load IrDA modules
+ /sbin/modprobe -sqa ircomm-tty ${LOAD_MODULES}
+
+ # Set IrDA options
+ [ -n "${NET_IRDA_OPTS}" ] && /sbin/sysctl -e -q -w ${NET_IRDA_OPTS}
+
+ # Finally, attach IrDA device
+ /usr/sbin/irattach ${DEVICE} ${DONGLE} ${DISCOVERY}
+ eend ${?}
+}
+
+stop() {
+ ebegin "Shutting down IrDA"
+ /usr/bin/pkill -f "^/usr/sbin/irattach ${DEVICE} ?"
+ eend ${?} || return 0 # never fail
+}
diff --git a/net-wireless/irda-utils/files/irda.modsd b/net-wireless/irda-utils/files/irda.modsd
new file mode 100644
index 000000000000..1641a8bbeec4
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda.modsd
@@ -0,0 +1,46 @@
+# IrDA module configuration
+# please also look at /etc/conf.d/irda
+
+# IrDA over a normal serial port, or a serial port compatible IrDA port
+alias tty-ldisc-11 irtty
+
+# IrCOMM/IrLPT support (virtual serial/parallel over IrDA)
+alias char-major-161 ircomm-tty # Official allocation of IrCOMM
+
+# IrLAN support (Ethernet over IrDA)
+alias irlan0 irlan
+
+# IrNET support (Synchronous PPP over IrDA)
+alias char-major-10-187 irnet # Official allocation of IrNET
+
+# Serial Dongles
+# These values are hard-coded in irattach (not instance order)
+alias irda-dongle-0 tekram # Tekram IrMate IR-210B
+alias irda-dongle-1 esi # ESI JetEye
+alias irda-dongle-2 actisys # Actisys IR-220L
+alias irda-dongle-3 actisys # Actisys IR-220L+
+alias irda-dongle-4 girbil # Greenwich GIrBIL
+alias irda-dongle-5 litelink # Parallax LiteLink (+ modern ESI)
+alias irda-dongle-6 airport # Adaptec Airport 1000 and 2000
+alias irda-dongle-7 old_belkin # Old Belkin (9600 baud only)
+alias irda-dongle-8 ep7211 # ???
+alias irda-dongle-9 mcp2120 # Crystal compatible chipset
+
+# To use the NSC driver on a Thinkpad laptop
+#alias irda0 nsc-ircc
+#options nsc-ircc dongle_id=0x09
+
+# To use the NSC driver on a HP OB6000 laptop
+#alias irda0 nsc-ircc
+#options nsc-ircc dongle_id=0x08
+
+# SMC driver
+#alias irda0 smsc-ircc2
+#options smsc-ircc2 ircc_dma=1 ircc_irq=10 ircc_fir=0x0130 ircc_sir=0x02f8
+
+# Some laptops (Toshiba Satellites and others with SMCS LPC47N227) require
+# running smcinit to initialize the irda device prior to use. If your device
+# is one of them, uncomment the required SMC-IRCC initializer.
+#install smsc-ircc2 /usr/sbin/smcinit && /sbin/modprobe -i smsc-ircc2
+#install smsc-ircc2 /usr/sbin/tosh1800-smcinit && /sbin/modprobe -i smsc-ircc2
+#install smsc-ircc2 /usr/sbin/tosh2450-smcinit && /sbin/modprobe -i smsc-ircc2
diff --git a/net-wireless/irda-utils/files/irda.rules b/net-wireless/irda-utils/files/irda.rules
new file mode 100644
index 000000000000..387fc1a58fc7
--- /dev/null
+++ b/net-wireless/irda-utils/files/irda.rules
@@ -0,0 +1,18 @@
+# IrDA-PNP (autodetect and setup some known SIR/FIR devices)
+# you need to run /etc/init./irda to activate your device
+
+ACTION!="add", GOTO="irda_pnp_end"
+SUBSYSTEM!="pnp", GOTO="irda_pnp_end"
+
+ATTR{id}=="PNP0510", RUN+="/lib/udev/irda-setup sir"
+ATTR{id}=="PNP0511", RUN+="/lib/udev/irda-setup sir"
+ATTR{id}=="NSC*", RUN+="/lib/udev/irda-setup fir nsc-ircc"
+ATTR{id}=="IBM0071", RUN+="/lib/udev/irda-setup fir nsc-ircc dongle_id=0x09"
+ATTR{id}=="SMC*", RUN+="/lib/udev/irda-setup fir smsc-ircc2"
+ATTR{id}=="ALI5123", RUN+="/lib/udev/irda-setup fir ali-ircc"
+ATTR{id}=="VIA3076", RUN+="/lib/udev/irda-setup fir via-ircc"
+
+LABEL="irda_pnp_end"
+
+# IrDA-USB (start irattach automatically)
+KERNEL=="irda[0-9]*", SUBSYSTEM=="net", RUN+="/lib/udev/irda-usb"
diff --git a/net-wireless/irda-utils/irda-utils-0.9.18-r1.ebuild b/net-wireless/irda-utils/irda-utils-0.9.18-r2.ebuild
index f035623e8d8b..dc69ac87eb8c 100644
--- a/net-wireless/irda-utils/irda-utils-0.9.18-r1.ebuild
+++ b/net-wireless/irda-utils/irda-utils-0.9.18-r2.ebuild
@@ -1,10 +1,10 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/irda-utils-0.9.18-r1.ebuild,v 1.1 2008/03/06 21:15:00 sbriesen Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/irda-utils-0.9.18-r2.ebuild,v 1.1 2008/03/22 18:34:10 sbriesen Exp $
inherit eutils toolchain-funcs flag-o-matic
-DESCRIPTION="IrDA utilities for infrared communication"
+DESCRIPTION="IrDA management and handling utilities"
HOMEPAGE="http://irda.sourceforge.net"
SRC_URI="mirror://sourceforge/irda/${P}.tar.gz"
@@ -14,7 +14,10 @@ KEYWORDS="~amd64 ~arm ~ppc ~sh ~x86"
IUSE=""
RDEPEND="=dev-libs/glib-2*
- >=sys-apps/pciutils-2.2.7-r1"
+ >=sys-apps/pciutils-2.2.7-r1
+ sys-process/procps
+ sys-apps/setserial
+ sys-apps/grep"
DEPEND="${RDEPEND}
!app-laptop/smcinit
dev-util/pkgconfig"
@@ -24,8 +27,9 @@ src_unpack() {
cd "${S}"
epatch "${FILESDIR}/irda-utils-rh1.patch"
- epatch "${FILESDIR}/irda-utils-0.9.18-makefile.diff"
- epatch "${FILESDIR}/irda-utils-0.9.18-io.h.diff"
+ epatch "${FILESDIR}/${P}-makefile.diff"
+ epatch "${FILESDIR}/${P}-smcinit.diff"
+ epatch "${FILESDIR}/${P}-io.h.diff"
# fix crosscompile, respect CFLAGS (Bug 200295)
sed -i -e "/^CC/s:gcc:$(tc-getCC):" \
@@ -37,6 +41,9 @@ src_unpack() {
# fix compile when pciutils is compiled with USE=zlib (Bug 200295)
sed -i -e "s:-lpci:$(pkg-config --libs libpci):g" smcinit/Makefile
+ # disable etc subdir in Makefile
+ sed -i -e "s:^\(DIRS.*=.* \)etc \(.*\):\1\2:g" Makefile
+
append-flags "-fno-strict-aliasing"
}
@@ -50,8 +57,7 @@ src_install () {
dodir /usr/sbin
emake install RPM_OPT_FLAGS="${CFLAGS}" ROOT="${D}" \
- MANDIR="${D}/usr/share/man" \
- || die "emake install failed"
+ MANDIR="${D}usr/share/man" || die "emake install failed"
newdoc ethereal/README README.wireshark
newdoc irattach/README README.irattach
@@ -67,13 +73,17 @@ src_install () {
newdoc irdadump/ChangeLog ChangeLog.irdadump
newdoc smcinit/ChangeLog ChangeLog.smcinit
dohtml smcinit/RobMiller-irda.html
- dodoc README etc/modules.conf.irda
+ dodoc README
+
+ newconfd "${FILESDIR}/irda.confd" irda
+ newinitd "${FILESDIR}/irda.initd" irda
- newconfd "${FILESDIR}/irda.conf" irda
- newinitd "${FILESDIR}/irda.rc" irda
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}/irda.modsd" irda
insinto /etc/udev/rules.d
- newins "${FILESDIR}/irda-usb.rules" 53-irda-usb.rules
+ newins "${FILESDIR}/irda.rules" 53-irda.rules
exeinto /lib/udev
- doexe "${FILESDIR}/irda-usb.sh"
+ newexe "${FILESDIR}/irda-setup.sh" irda-setup
+ newexe "${FILESDIR}/irda-usb.sh" irda-usb
}