summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <dragonheart@gentoo.org>2004-06-20 07:28:56 +0000
committerDaniel Black <dragonheart@gentoo.org>2004-06-20 07:28:56 +0000
commitbdb5cbd01f4e0058d7f8e1f1de52e8d623b4ec02 (patch)
tree7a1f9d0ba66807b88b08c00017e9b997470922c6 /net-dialup
parentInitial commit bug# 54044. Thanks Tim Cera <timcera@earthlink.net> for the eb... (diff)
downloadgentoo-2-bdb5cbd01f4e0058d7f8e1f1de52e8d623b4ec02.tar.gz
gentoo-2-bdb5cbd01f4e0058d7f8e1f1de52e8d623b4ec02.tar.bz2
gentoo-2-bdb5cbd01f4e0058d7f8e1f1de52e8d623b4ec02.zip
Version bump. not fully tested however I'm stuck. Thanks to dsd@gentoo.org forthe udev patch and the members of bug #47947
Diffstat (limited to 'net-dialup')
-rw-r--r--net-dialup/slmodem/ChangeLog11
-rw-r--r--net-dialup/slmodem/files/digest-slmodem-2.9.81
-rw-r--r--net-dialup/slmodem/files/slmodem-2.9.8-makefile-fixup.patch113
-rw-r--r--net-dialup/slmodem/files/slmodem-2.9.8-udev.patch279
-rw-r--r--net-dialup/slmodem/files/slmodem-2.9.init28
-rw-r--r--net-dialup/slmodem/slmodem-2.9.8.ebuild156
6 files changed, 584 insertions, 4 deletions
diff --git a/net-dialup/slmodem/ChangeLog b/net-dialup/slmodem/ChangeLog
index e6da2051ed9d..568499b9074f 100644
--- a/net-dialup/slmodem/ChangeLog
+++ b/net-dialup/slmodem/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for net-dialup/slmodem
# Copyright 2000-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/ChangeLog,v 1.11 2004/06/08 05:37:52 dragonheart Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/ChangeLog,v 1.12 2004/06/20 07:28:56 dragonheart Exp $
+
+*slmodem-2.9.8 (20 Jun 2004)
+
+ 20 Jun 2004; Daniel Black <dragonheart@gentoo.org>
+ +files/slmodem-2.9.8-makefile-fixup.patch, +files/slmodem-2.9.8-udev.patch,
+ files/slmodem-2.9.init, +slmodem-2.9.8.ebuild:
+ Version bump. not fully tested however I'm stuck. Thanks to dsd@gentoo.org for
+ the udev patch and the members of bug #47947 for other improvement ideas and
+ patches
08 Jun 2004; Daniel Black <dragonheart@gentoo.org> files/slmodem-2.9.conf,
files/slmodem-2.9.devfs, files/slmodem-2.9.init, +slmodem-2.9.7-r2.ebuild:
diff --git a/net-dialup/slmodem/files/digest-slmodem-2.9.8 b/net-dialup/slmodem/files/digest-slmodem-2.9.8
new file mode 100644
index 000000000000..cfd4c745e8f2
--- /dev/null
+++ b/net-dialup/slmodem/files/digest-slmodem-2.9.8
@@ -0,0 +1 @@
+MD5 3ff4154b50e13cdb443896d71926a8c3 slmodem-2.9.8.tar.gz 708213
diff --git a/net-dialup/slmodem/files/slmodem-2.9.8-makefile-fixup.patch b/net-dialup/slmodem/files/slmodem-2.9.8-makefile-fixup.patch
new file mode 100644
index 000000000000..b8f78598971e
--- /dev/null
+++ b/net-dialup/slmodem/files/slmodem-2.9.8-makefile-fixup.patch
@@ -0,0 +1,113 @@
+diff -ru slmodem-2.9.8.orig/Makefile slmodem-2.9.8/Makefile
+--- slmodem-2.9.8.orig/Makefile 2004-02-03 02:13:43.000000000 +0930
++++ slmodem-2.9.8/Makefile 2004-06-20 14:53:10.478602760 +0930
+@@ -13,7 +13,9 @@
+ #
+ ###########################################################################
+
+-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
++KERNEL_VER:=$(shell uname -r)
++KERNEL_DIR:=/lib/modules/$(KERNEL_VER)/build
++DESTDIR = ${D}
+
+ # tools
+ INSTALL:=install
+@@ -25,6 +27,7 @@
+
+ install: all install-drivers
+ $(INSTALL) -D -m 755 modem/slmodemd ${DESTDIR}/usr/sbin/slmodemd
++ $(INSTALL) -D -m 755 modem/modem_test ${DESTDIR}/usr/sbin/modem_test
+ $(RM) -rf ${DESTDIR}/var/lib/slmodem
+ $(INSTALL) -d -D -m 755 ${DESTDIR}/var/lib/slmodem
+
+diff -ru slmodem-2.9.8.orig/drivers/Makefile slmodem-2.9.8/drivers/Makefile
+--- slmodem-2.9.8.orig/drivers/Makefile 2003-12-22 06:45:54.000000000 +0930
++++ slmodem-2.9.8/drivers/Makefile 2004-06-20 14:53:38.799297360 +0930
+@@ -15,8 +15,11 @@
+
+ #KBUILD_VERBOSE=1
+ #export KBUILD_VERBOSE
++DESTDIR = ${D}
+
+-KERNEL_DIR:=/lib/modules/$(shell uname -r)/build
++
++KERNEL_VER:=$(shell uname -r)
++KERNEL_DIR:=/lib/modules/$(KERNEL_VER)/build
+
+ EXTRA_CFLAGS = -I$(obj) -I$(obj)/../modem
+
+@@ -28,18 +31,18 @@
+ ifndef KERNELRELEASE
+ ifndef KERNEL_VER
+
+-all install uninstall: kernel-ver
+- $(MAKE) $@ KERNEL_VER=$(shell ./kernel-ver)
++all install uninstall:
++ $(MAKE) $@ KERNEL_VER=$(shell uname -r)
+
+-install: install-devices
+-uninstall: remove-devices
++#install: install-devices
++#uninstall: remove-devices
+
+-kernel-ver::
+- $(CC) -I$(KERNEL_DIR)/include -o $@ $@.c
++#kernel-ver::
++# $(CC) -I$(KERNEL_DIR)/include -o $@ $@.c
+
+ dep:
+ clean:
+- $(RM) kernel-ver $(obj-m) $(obj-m:.o=.ko) *st7554.o amrmo_init.o sysdep_amr.o *.mod.* .*.cmd *~
++ $(RM) $(obj-m) $(obj-m:.o=.ko) *st7554.o amrmo_init.o sysdep_amr.o *.mod.* .*.cmd *~
+
+ install-devices:
+ mkdir -p ${DESTDIR}/dev
+@@ -60,7 +63,7 @@
+ obj:=.
+ module-dir:=${DESTDIR}/lib/modules/$(KERNEL_VER)/misc
+
+-CFLAGS:= -Wall -pipe -O3 -fomit-frame-pointer -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DMODVERSIONS --include $(KERNEL_DIR)/include/linux/modversions.h -I$(KERNEL_DIR)/include
++CFLAGS:= ${CFLAGS} -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -DMODVERSIONS --include $(KERNEL_DIR)/include/linux/modversions.h -I$(KERNEL_DIR)/include
+
+ all: $(obj-m)
+
+@@ -72,10 +75,10 @@
+ install: uninstall-old
+ install -D -m 644 slamr.o $(module-dir)/slamr.o
+ install -D -m 644 slusb.o $(module-dir)/slusb.o
+- cp /etc/modules.conf /etc/modules.conf.slamr && \
+- echo 'alias char-major-212 slamr' >> /etc/modules.conf && \
+- echo 'alias char-major-213 slusb' >> /etc/modules.conf
+- /sbin/depmod -a
++# cp /etc/modules.conf /etc/modules.conf.slamr && \
++# echo 'alias char-major-212 slamr' >> /etc/modules.conf && \
++# echo 'alias char-major-213 slusb' >> /etc/modules.conf
++# /sbin/depmod -a
+ uninstall:
+ /sbin/modprobe -r slamr slusb
+ cp /etc/modules.conf /etc/modules.conf.slamr && \
+@@ -102,7 +105,7 @@
+ install:
+ install -D -m 644 slamr.ko $(module-dir)/slamr.ko
+ install -D -m 644 slusb.ko $(module-dir)/slusb.ko
+- /sbin/depmod -a
++# /sbin/depmod -a
+ uninstall:
+ modprobe -r slamr ; echo -n
+ modprobe -r slusb ; echo -n
+diff -ru slmodem-2.9.8.orig/modem/Makefile slmodem-2.9.8/modem/Makefile
+--- slmodem-2.9.8.orig/modem/Makefile 2003-11-20 22:20:47.000000000 +0930
++++ slmodem-2.9.8/modem/Makefile 2004-06-20 14:51:29.458960080 +0930
+@@ -13,10 +13,10 @@
+ #
+ ###########################################################################
+
+-CC:= gcc
++CC:= ${CC}
+ RM:= rm -f
+
+-CFLAGS:= -Wall -g -O -I. -DCONFIG_DEBUG_MODEM
++CFLAGS:= ${CFLAGS} -I. -DCONFIG_DEBUG_MODEM
+
+
+ modem-objs:= \
diff --git a/net-dialup/slmodem/files/slmodem-2.9.8-udev.patch b/net-dialup/slmodem/files/slmodem-2.9.8-udev.patch
new file mode 100644
index 000000000000..6b7112a73487
--- /dev/null
+++ b/net-dialup/slmodem/files/slmodem-2.9.8-udev.patch
@@ -0,0 +1,279 @@
+Add sysfs support to slmodem drivers.
+- Daniel Drake <dsd@gentoo.org>
+
+diff -urNp slmodem-2.9.8/drivers/amrmo_init.c slmodem-dsd/drivers/amrmo_init.c
+--- slmodem-2.9.8/drivers/amrmo_init.c 2004-04-22 16:55:35.000000000 +0100
++++ slmodem-dsd/drivers/amrmo_init.c 2004-06-18 20:48:12.604672976 +0100
+@@ -54,6 +54,7 @@
+ #include <linux/fs.h>
+ #include <asm/uaccess.h>
+ #include <linux/devfs_fs_kernel.h>
++#include <linux/device.h>
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ #define OLD_KERNEL 1
+@@ -270,7 +271,7 @@ MODULE_DEVICE_TABLE (pci, amrmo_pci_tbl)
+
+
+ static struct amrmo_struct *amrmo_table[MAXNUM] = {};
+-
++static struct class_simple *amrmo_class;
+
+ /*
+ * debug stuff
+@@ -613,6 +614,7 @@ static int __init amrmo_pci_probe(struct
+ }
+ #endif
+ #else
++ class_simple_device_add(amrmo_class, MKDEV(AMRMO_MAJOR, i), NULL, "slamr%d", i);
+ devfs_mk_cdev(MKDEV(AMRMO_MAJOR,i), S_IFCHR|S_IRUSR|S_IWUSR, "slamr%d", i);
+ #endif
+ return 0;
+@@ -644,6 +646,7 @@ static void __exit amrmo_pci_remove(stru
+ }
+ #endif
+ #else
++ class_simple_device_remove(MKDEV(AMRMO_MAJOR, amrmo->num));
+ devfs_remove("slamr%d", amrmo->num);
+ #endif
+ amrmo_table[amrmo->num] = NULL;
+@@ -720,23 +723,39 @@ static int __init amrmo_init(void)
+ }
+ #endif
+ }
++ }
++
++ /* must create class_simple before the bus gets probed */
++#ifndef OLD_KERNEL
++ amrmo_class = class_simple_create(THIS_MODULE, "slamr");
++ if (IS_ERR(amrmo_class)) {
++ int err = PTR_ERR(amrmo_class);
++ printk(KERN_INFO "slamr: failure creating simple class, error %d\n", err);
++ return err;
+ }
++#endif
+
+ if (!pci_register_driver(&amrmo_pci_driver)) {
+ pci_unregister_driver(&amrmo_pci_driver);
+- return -ENODEV;
++ class_simple_destroy(amrmo_class);
++ return -ENODEV;
+ }
+
+ if(register_chrdev(AMRMO_MAJOR, "slamr", &amrmo_fops) < 0) {
+ pci_unregister_driver(&amrmo_pci_driver);
++ class_simple_destroy(amrmo_class);
+ return -ENOMEM;
+ }
++
+ return 0;
+ }
+
+ static void __exit amrmo_exit(void)
+ {
+ AMRMO_DBG("slamr: exit...\n");
++#ifndef OLD_KERNEL
++ class_simple_destroy(amrmo_class);
++#endif
+ unregister_chrdev(AMRMO_MAJOR,"slamr");
+ pci_unregister_driver(&amrmo_pci_driver);
+ }
+diff -urNp slmodem-2.9.8/drivers/old_st7554.c slmodem-dsd/drivers/old_st7554.c
+--- slmodem-2.9.8/drivers/old_st7554.c 2004-06-14 15:19:26.000000000 +0100
++++ slmodem-dsd/drivers/old_st7554.c 2004-06-18 20:47:02.738294280 +0100
+@@ -55,6 +55,7 @@
+ #include <linux/poll.h>
+ #include <linux/usb.h>
+ #include <linux/devfs_fs_kernel.h>
++#include <linux/device.h>
+
+ #include <modem_defs.h>
+
+@@ -73,6 +74,10 @@
+
+ #define MY_MAJOR 213
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++#define OLD_KERNEL 1
++#endif
++
+ static int debug = 0;
+ MODULE_PARM(debug,"i");
+ MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
+@@ -201,6 +206,7 @@ struct st7554_state {
+
+
+ static struct st7554_state *st7554_table[MAX_MODEMS];
++static struct class_simple *st7554_class;
+
+ static DECLARE_MUTEX(open_sem);
+
+@@ -1299,6 +1305,10 @@ static void *st7554_probe(struct usb_dev
+ mo_free(s); mi_free(s);
+ goto error1;
+ }
++
++#ifndef OLD_KERNEL
++ class_simple_device_add(st7554_class, MKDEV(MY_MAJOR, s->minor), NULL, "slusb%d", i);
++#endif
+ #ifdef CONFIG_DEVFS_FS
+ {
+ char buf[8];
+@@ -1333,6 +1343,10 @@ static void st7554_disconnect(struct usb
+ s->file->private_data = NULL;
+ s->file = NULL;
+ }
++
++#ifndef OLD_KERNEL
++ class_simple_device_remove(MKDEV(MY_MAJOR, s->minor));
++#endif
+ #ifdef CONFIG_DEVFS_FS
+ {
+ char buf[8];
+@@ -1343,6 +1357,7 @@ static void st7554_disconnect(struct usb
+ devfs_unregister (handle);
+ }
+ #endif
++
+ st7554_stop(s);
+ st7554_release(s);
+ s->usbdev = NULL;
+@@ -1362,15 +1377,29 @@ static int __init st7554_modem_init(void
+ {
+ int ret;
+ USB_INFO ("ST7554 USB Modem.\n");
++
++ /* must create class_simple before the bus gets probed */
++#ifndef OLD_KERNEL
++ st7554_class = class_simple_create(THIS_MODULE, "slusb");
++ if (IS_ERR(st7554_class)) {
++ ret = PTR_ERR(st7554_class);
++ USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret);
++ return PTR_ERR(st7554_class);
++ }
++#endif
++
+ ret = usb_register(&st7554_usb_driver);
+ if ( ret ) {
+ USB_ERR ("st7554_modem_init: cannot register usb device.\n");
++ class_simple_destroy(st7554_class);
+ return ret;
+ }
+ if(register_chrdev(MY_MAJOR, "slusb", &st7554_fops) < 0) {
++ class_simple_destroy(st7554_class);
+ usb_deregister(&st7554_usb_driver);
+ return -ENOMEM;
+ }
++
+ return 0;
+ }
+
+@@ -1378,6 +1407,9 @@ static int __init st7554_modem_init(void
+ static void __exit st7554_modem_exit(void)
+ {
+ USB_DBG ("st7554: exit...\n");
++#ifndef OLD_KERNEL
++ class_simple_destroy(st7554_class);
++#endif
+ unregister_chrdev(MY_MAJOR,"slusb");
+ usb_deregister(&st7554_usb_driver);
+ }
+diff -urNp slmodem-2.9.8/drivers/st7554.c slmodem-dsd/drivers/st7554.c
+--- slmodem-2.9.8/drivers/st7554.c 2004-06-01 19:28:00.000000000 +0100
++++ slmodem-dsd/drivers/st7554.c 2004-06-18 20:46:41.255560152 +0100
+@@ -55,6 +55,7 @@
+ #include <linux/poll.h>
+ #include <linux/usb.h>
+ #include <linux/devfs_fs_kernel.h>
++#include <linux/device.h>
+
+ #include <modem_defs.h>
+
+@@ -67,6 +68,10 @@
+ #define DEBUG_URB_PRINT 0
+ #define USB_DBG_URB(fmt...) // USB_DBG(fmt)
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
++#define OLD_KERNEL 1
++#endif
++
+ static int debug = 0;
+ MODULE_PARM(debug,"i");
+ MODULE_PARM_DESC(debug,"Debug level: 0-3 (default=0)");
+@@ -205,6 +210,7 @@ struct st7554_state {
+
+
+ static struct st7554_state *st7554_table[MAX_MODEMS] = {};
++static struct class_simple *st7554_class;
+
+ static DECLARE_MUTEX(open_sem);
+
+@@ -1275,6 +1281,9 @@ static int st7554_probe(struct usb_inter
+ }
+
+ usb_set_intfdata(interface, s );
++#ifndef OLD_KERNEL
++ class_simple_device_add(st7554_class, MKDEV(213, i), NULL, "slusb%d", i);
++#endif
+ devfs_mk_cdev(MKDEV(213,i),S_IFCHR|S_IRUSR|S_IWUSR,"slusb%d",i);
+
+ USB_INFO(KERN_INFO "slusb: slusb%d is found.\n", s->minor);
+@@ -1298,11 +1307,14 @@ static void st7554_disconnect(struct usb
+ struct st7554_state *s = usb_get_intfdata(interface);
+ usb_set_intfdata(interface, NULL );
+ USB_DBG("st7554 disconnect...\n");
+- if (!s || !s->usbdev) {
+- USB_DBG("st7554 disconnect: no dev.\n");
+- return;
+- }
++ if (!s || !s->usbdev) {
++ USB_DBG("st7554 disconnect: no dev.\n");
++ return;
++ }
+
++#ifndef OLD_KERNEL
++ class_simple_device_remove(MKDEV(213, s->minor));
++#endif
+ devfs_remove("slusb%d",s->minor);
+
+ st7554_stop(s);
+@@ -1335,15 +1347,29 @@ static int __init st7554_modem_init(void
+ {
+ int ret;
+ USB_INFO ("ST7554 USB Modem.\n");
++
++ /* must create class_simple before the bus gets probed */
++#ifndef OLD_KERNEL
++ st7554_class = class_simple_create(THIS_MODULE, "slusb");
++ if (IS_ERR(st7554_class)) {
++ ret = PTR_ERR(st7554_class);
++ USB_ERR("st7554_modem_init: failed to create sysfs class, error %d\n", ret);
++ return ret;
++ }
++#endif
++
+ ret = usb_register(&st7554_usb_driver);
+ if ( ret ) {
+ USB_ERR ("st7554_modem_init: cannot register usb device.\n");
++ class_simple_destroy(st7554_class);
+ return ret;
+ }
+ if(register_chrdev(213, "slusb", &st7554_fops) < 0) {
+ usb_deregister(&st7554_usb_driver);
++ class_simple_destroy(st7554_class);
+ return -ENOMEM;
+ }
++
+ return 0;
+ }
+
+@@ -1351,6 +1377,9 @@ static int __init st7554_modem_init(void
+ static void __exit st7554_modem_exit(void)
+ {
+ USB_DBG ("st7554: exit...\n");
++#ifndef OLD_KERNEL
++ class_simple_destroy(st7554_class);
++#endif
+ unregister_chrdev(213,"slusb");
+ usb_deregister(&st7554_usb_driver);
+ }
diff --git a/net-dialup/slmodem/files/slmodem-2.9.init b/net-dialup/slmodem/files/slmodem-2.9.init
index 1dbf188eb38c..80a51e27c13f 100644
--- a/net-dialup/slmodem/files/slmodem-2.9.init
+++ b/net-dialup/slmodem/files/slmodem-2.9.init
@@ -1,10 +1,10 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/files/slmodem-2.9.init,v 1.3 2004/06/08 05:38:04 dragonheart Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/files/slmodem-2.9.init,v 1.4 2004/06/20 07:28:56 dragonheart Exp $
depend() {
- need logger
+ need logger
}
@@ -17,7 +17,29 @@ checkconfig() {
start() {
ebegin "Starting slmodemd for ${DEV}"
- modprobe ${MODULE}
+
+ modprobe ${MODULE};
+ if [ "$?" -gt 0 ]
+ then
+ eerror "Missing ${MODULE}. Please set up /etc/conf.d/slmodem"
+ eend 1;
+ fi
+
+ #sleep as per http://bugs.gentoo.org/show_bug.cgi?id=47947#c59
+ local COUNT=0
+ while [ ! -c ${DEV} -a ${COUNT} -lt 4 ];
+ do
+ sleep 0.25
+ einfo "Waiting for driver initialisation"
+ COUNT=`expr ${COUNT} + 1`
+ done
+
+ if [ ! -c ${DEV} ];
+ then
+ eerror "Module - ${MODULE} failed to initialise device ${DEVICE}"
+ eend 1
+ fi
+
start-stop-daemon --start --background --nicelevel=${NICE} --make-pidfile \
--pidfile /var/run/slmodemd.pid --startas /usr/sbin/slmodemd \
-- -country=${COUNTRY} -g=${GROUP} ${DEV}
diff --git a/net-dialup/slmodem/slmodem-2.9.8.ebuild b/net-dialup/slmodem/slmodem-2.9.8.ebuild
new file mode 100644
index 000000000000..06b6a5bc4e5e
--- /dev/null
+++ b/net-dialup/slmodem/slmodem-2.9.8.ebuild
@@ -0,0 +1,156 @@
+# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/slmodem-2.9.8.ebuild,v 1.1 2004/06/20 07:28:56 dragonheart Exp $
+
+inherit kmod
+
+DESCRIPTION="Driver for Smart Link modem"
+HOMEPAGE="http://www.smlink.com/"
+SRC_URI="ftp://ftp.smlink.com/linux/unsupported/${P}.tar.gz"
+LICENSE="Smart-Link"
+SLOT="0"
+KEYWORDS="-*"
+IUSE="${IUSE} alsa"
+
+DEPEND="virtual/glibc
+ alsa? ( media-libs/alsa-lib )
+ sys-kernel/config-kernel"
+
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P}"
+
+KMOD_SOURCES="${P}.tar.gz"
+
+src_unpack() {
+ kmod_src_unpack
+ cd ${S}
+ epatch ${FILESDIR}/${P}-makefile-fixup.patch
+ epatch ${FILESDIR}/${P}-udev.patch
+}
+
+src_compile() {
+
+ [ -d /lib/modules/${KERNEL_VER/linux-/}/build ] || die "Build kernel ${KERNEL_VER} first"
+
+ unset ARCH
+
+
+ mkdir ${S}/workdir
+
+ emake MODVERDIR=${T}/.tmp_versions O=${S}/workdir \
+ KERNEL_VER=${KERNEL_VER/linux-/} \
+ drivers || die "Failed to compile driver"
+
+ cd modem;
+ if use alsa;
+ then
+ emake SUPPORT_ALSA=1 MODVERDIR=${T}/.tmp_versions O=${S}/workdir \
+ KERNEL_VER=${KERNEL_VER/linux-/} \
+ || die 'Alsa support failed, try USE="-alsa"'
+ else
+ emake MODVERDIR=${T}/.tmp_versions O=${S}/workdir \
+ KERNEL_VER=${KERNEL_VER/linux-/} \
+ || die "Could not compile"
+ fi
+}
+
+src_test() {
+ cd modem
+ emake modem_test
+ ./modem_test || die "failed modem test"
+
+}
+
+src_install() {
+ unset ARCH
+ emake DESTDIR=${D} KERNEL_VER=${KERNEL_VER/linux-/} install-drivers \
+ || die "driver install failed"
+
+ dosbin modem/slmodemd
+ dodir /var/lib/slmodem
+ fowners root:dialout /var/lib/slmodem
+
+ dodoc COPYING Changes README README.1st
+
+ # Install /etc/{devfs,modules,init,conf}.d/slmodem files
+ insinto /etc/conf.d/; newins ${FILESDIR}/${PN}-2.9.conf ${PN}
+ insopts -m0755; insinto /etc/init.d/; newins ${FILESDIR}/${PN}-2.9.init ${PN}
+
+ # Make some devices if we aren't using devfs
+ # If we are using devfs, restart it
+ if [ -e ${ROOT}/dev/.devfsd ] ; then
+ # devfs
+ insinto /etc/devfs.d/; newins ${FILESDIR}/${PN}-2.9.devfs ${PN}
+ insinto /etc/modules.d/; newins ${FILESDIR}/${PN}-2.9.modules ${PN}
+ elif [ -e ${ROOT}/dev/.udev ] ; then
+ # udev
+ # FIX Symlink
+ dodir /etc/udev/rules.d/
+ echo 'KERNEL="slamr", NAME="slamr0", SYMLINK="modem"' > \
+ ${D}/etc/udev/rules.d/55-${PN}.rules
+ dodir /etc/udev/permissions.d
+ echo 'slamr*:root:dialout:0660' > \
+ ${D}/etc/udev/permissions.d/55-${PN}.permissions
+ else
+ # simple raw devs
+ dodir /dev
+ cd ${D}/dev
+ ebegin "Creating /dev/slamr* devices"
+ local C="0"
+ while [ "${C}" -lt "4" ]
+ do
+ if [ ! -c ${ROOT}/dev/slamr${C} ]
+ then
+ mknod ${D}/dev/slamr${C} c 212 ${C}
+ # doco suggests that the slmodemd creates these
+ # ln -s slamr${C} ttySL${C}
+ fi
+ if [ ! -c ${ROOT}/dev/slamr${C} ]
+ then
+ mknod ${D}/dev/slusb${C} c 213 ${C}
+ #TODO usb or slamr (AMR/CNR/PCI) version for symlinks???
+ # ln -s sl${C} ttySL${C}
+ fi
+
+ C="`expr $C + 1`"
+ done
+ eend 0
+ ln -s ttySL0 modem
+ fi
+
+}
+
+pkg_postinst() {
+ kmod_pkg_postinst
+
+ #depmod -a
+
+ # Make some devices if we aren't using devfs
+ # If we are using devfs, restart it
+ if [ -e ${ROOT}/dev/.devfsd ]
+ then
+ ebegin "Restarting devfsd to reread devfs rules"
+ killall -HUP devfsd
+ eend 0
+ einfo "modules-update to complete configuration."
+
+ elif [ -e ${ROOT}/dev/.udev ]
+ then
+ ebegin "Restarting udev to reread udev rules"
+ udevstart
+ eend 0
+ fi
+
+ echo
+
+ einfo "You must edit /etc/conf.d/${PN} for your configuration"
+
+ if use alsa;
+ then
+ einfo
+ einfo "If you need to use snd-intel8x0m from the kernel"
+ einfo "compile it as a module and edit /etc/module.d/alsa"
+ einfo 'to: "alias snd-card-(number) snd-intel8x0m"'
+ fi
+}