commit ca6f833792c24d81d82ca98e9abfd5b3b3c4ff44
Author: Sérgio M. Basto <sergio(a)serjux.com>
Date: Wed Sep 20 02:03:54 2017 +0100
Updated to recent slmodem package
.gitignore | 1 +
README.fedora | 96 ++++++++++++++++++++++++++++++++++
slmodem-2.9.11-create.patch | 20 +++++++
slmodem-2.9.11-daemon.patch | 87 ++++++++++++++++++++++++++++++
slmodem.init | 114 ++++++++++++++++++++++++++++++++++++++++
slmodem.spec | 125 ++++++++++++++++++++++++++++++++++++++++++++
slmodem.sysconfig | 25 +++++++++
sources | 1 +
8 files changed, 469 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..d8c0846 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/slmodem-2.9.11-20080817.tar.gz
diff --git a/README.fedora b/README.fedora
new file mode 100644
index 0000000..506af0d
--- /dev/null
+++ b/README.fedora
@@ -0,0 +1,96 @@
+Smart Link Soft Modem for Fedora
+********************************
+
+
+Introduction
+============
+
+The slmodem package available from
http://rpm.livna.org is consisting of
+two RPM packages, the slmodem package containing the needed userspace
+daemon to control the modem-chipset and the slmodem-kmod package.
+
+slmodem-kmod provides proprietary kernel modules for certain PCI and USB
+modems as well as several integrated modem chipsets in notebooks.
+
+Most Smart Link based modems integrated into today's notebooks however
+do work without a proprietary kernel module. These chips are wired into
+the sound codecs on the mainboard and can thus be controlled via the
+alsa sound system in userspace.
+This results in a non-tainted kernel and less hassle when upgrading the
+kernel and is thus to be prefered.
+
+
+
+Hardware Support
+================
+
+
+Proprietary Kernel Module (bad!)
+--------------------------------
+
+The following SmartLink modems should be supported by the slamr
+kernel-module:
+
+ * HAMR5600 based AMR/CNR/MDC/ACR modem cards
+ * SmartPCI56/561/562/563 based PCI modem cards
+ * Southbridge based chipsets
+ - Intel ICH0,ICH2, ICH3, ICH4
+ - Via 686A, 686B, 8231, 8233
+ - SiS 630
+ - ALI 1535.
+
+The slusb kernel modul supports the following modem chipsets:
+
+ * SmartUSB56 based USB modems
+
+
+Userspace Hardware Support with ALSA (good)
+-------------------------------------------
+
+The slmodemd userspace application is also able to control the following
+modem chipsets without having to access proprietary kernel modules.
+
+ * intel8x0m (snd-intel8x0m) based chipsets
+ - ICH based AC97 Modems (MC97)
+ - SiS 630 Modems
+ - NVidia NForce Integrated Modem
+ * VIA686 (snd-via82xx-modem) based chipsets
+ * ATI IXP (snd-atiixp-modem) based chipsets
+
+
+
+Installation and Configuration
+==============================
+
+Depending on your hardware, you should first try installing slmodem and
+running the slmodemd daemon in ALSA-mode.
+
+If this does not work, install the slmodem-kmod package and configure
+the initscript to either load the slamr or the slusb kernel module.
+
+This can be achieved by editing /etc/sysconfig/slmodemd and setting the
+INTERFACE variable to either alsa, slamr or slusb accordingly.
+
+Restarting the slmodemd by calling service slmodem restart or rebooting
+will then load the correct module, initialise the device files and load
+the userspace daemon.
+
+If your modem is supported by the driver, it can be accessed by using
+/dev/ttySL0 as the modem device. This device can then be used to dial
+out with the internal softmodem.
+
+
+
+Problems
+========
+
+Please keep in mind that this is not a fedora supplied package, and thus
+you won't receive any support on any of the fedora or Red Hat
+mailinglists. If your modem does somehow not work, please take a look at
+<http://linmodems.technion.ac.il/> for more information.
+<http://www.linmodems.org/> contains a mailinglist and a mailinglist
+archive should be able to answer your questions.
+
+In case there is a bug related to the RPM-package from livna, please
+file a bug at <
http://bugzilla.livna.org>.
+
diff --git a/slmodem-2.9.11-create.patch b/slmodem-2.9.11-create.patch
new file mode 100644
index 0000000..118ba65
--- /dev/null
+++ b/slmodem-2.9.11-create.patch
@@ -0,0 +1,20 @@
+diff -up slmodem-2.9.11-20080817/modem/modem_datafile.c.create
slmodem-2.9.11-20080817/modem/modem_datafile.c
+--- slmodem-2.9.11-20080817/modem/modem_datafile.c.create 2008-03-29 13:04:16.000000000
+0100
++++ slmodem-2.9.11-20080817/modem/modem_datafile.c 2008-10-15 23:45:26.000000000 +0200
+@@ -48,6 +48,7 @@
+ #include <string.h>
+ #include <errno.h>
+ #include <fcntl.h>
++#include <sys/stat.h>
+
+ #include <modem_defs.h>
+ #include <modem_debug.h>
+@@ -111,7 +112,7 @@ int datafile_save_info(char *file_name,s
+ int ret = -1;
+ int fd;
+
+- fd = open(file_name,O_CREAT|O_WRONLY);
++ fd = open(file_name,O_CREAT|O_WRONLY, S_IRUSR | S_IWUSR);
+ if(fd < 0)
+ return -errno;
+
diff --git a/slmodem-2.9.11-daemon.patch b/slmodem-2.9.11-daemon.patch
new file mode 100644
index 0000000..04e1b7c
--- /dev/null
+++ b/slmodem-2.9.11-daemon.patch
@@ -0,0 +1,87 @@
+diff -up slmodem-2.9.11-20080817/modem/modem_cmdline.c.daemon
slmodem-2.9.11-20080817/modem/modem_cmdline.c
+--- slmodem-2.9.11-20080817/modem/modem_cmdline.c.daemon 2008-03-29 13:04:16.000000000
+0100
++++ slmodem-2.9.11-20080817/modem/modem_cmdline.c 2008-10-15 23:45:38.000000000 +0200
+@@ -74,6 +74,7 @@ unsigned int need_realtime = 1;
+ unsigned int ring_detector = 0;
+ #endif
+ unsigned int use_alsa = 0;
++unsigned int daemonize = 0;
+ unsigned int use_short_buffer = 0;
+ const char *modem_group = "uucp";
+ mode_t modem_perm = 0660;
+@@ -86,6 +87,7 @@ enum {
+ OPT_COUNTRY,
+ OPT_COUNTRYLIST,
+ OPT_ALSA,
++ OPT_DAEMON,
+ OPT_GROUP,
+ OPT_PERM,
+ #ifdef MODEM_CONFIG_RING_DETECTOR
+@@ -113,6 +115,7 @@ static struct opt {
+ {'c',"country","default modem country
name",MANDATORY,STRING,"USA"},
+ { 0 ,"countrylist","show list of supported countries"},
+ {'a',"alsa","ALSA mode (see README for howto)"},
++ {'d',"daemon","Daemon mode"},
+ {'g',"group","Modem TTY
group",MANDATORY,STRING,"uucp"},
+ {'p',"perm","Modem TTY
permission",MANDATORY,INTEGER,"0660"},
+ #ifdef MODEM_CONFIG_RING_DETECTOR
+@@ -252,6 +255,8 @@ void modem_cmdline(int argc, char *argv[
+ #endif
+ use_alsa = 1;
+ }
++ if(opt_list[OPT_DAEMON].found)
++ daemonize = 1;
+ if(opt_list[OPT_GROUP].found)
+ modem_group = opt_list[OPT_GROUP].arg_val;
+ if(opt_list[OPT_PERM].found) {
+diff -up slmodem-2.9.11-20080817/modem/modem_main.c.daemon
slmodem-2.9.11-20080817/modem/modem_main.c
+--- slmodem-2.9.11-20080817/modem/modem_main.c.daemon 2008-08-04 03:40:13.000000000
+0200
++++ slmodem-2.9.11-20080817/modem/modem_main.c 2008-10-15 23:49:00.000000000 +0200
+@@ -57,6 +57,7 @@
+ #include <signal.h>
+ #include <limits.h>
+ #include <grp.h>
++#include <syslog.h>
+
+ #ifdef SUPPORT_ALSA
+ #define ALSA_PCM_NEW_HW_PARAMS_API 1
+@@ -70,8 +71,8 @@
+ #include <modem.h>
+ #include <modem_debug.h>
+
+-#define INFO(fmt,args...) fprintf(stderr, fmt , ##args );
+-#define ERR(fmt,args...) fprintf(stderr, "error: " fmt , ##args );
++#define INFO(fmt,args...) (daemonize) ? syslog(LOG_INFO, fmt, ##args) : fprintf(stderr,
fmt , ##args );
++#define ERR(fmt,args...) (daemonize) ? syslog(LOG_ERR, "error: " fmt, ##args)
: fprintf(stderr, "error: " fmt , ##args );
+
+ #define DBG(fmt,args...) dprintf("main: " fmt, ##args)
+
+@@ -131,6 +132,7 @@ static char outbuf[4096];
+ #define INTERNAL_DELAY 40 /* internal device tx/rx delay: should be selfdetectible */
+
+ extern unsigned use_alsa;
++extern unsigned daemonize;
+ static snd_output_t *dbg_out = NULL;
+
+ static int alsa_mixer_setup(struct device_struct *dev, const char *dev_name)
+@@ -966,6 +968,11 @@ int modem_main(const char *dev_name)
+ INFO("modem `%s' created. TTY is `%s'\n",
+ m->name, m->pty_name);
+
++ // daemonize
++ if (daemonize)
++ if (!daemon(0, 0))
++ ERR("slmodemd could not daemonize");
++
+ sprintf(path_name,"/var/lib/slmodem/data.%s",basename(dev_name));
+ datafile_load_info(path_name,&m->dsp_info);
+
+@@ -984,7 +991,7 @@ int modem_main(const char *dev_name)
+ signal(SIGINT, mark_termination);
+ signal(SIGTERM, mark_termination);
+
+- INFO("Use `%s' as modem device, Ctrl+C for termination.\n",
++ INFO("Modem device: `%s'\n",
+ *link_name ? link_name : m->pty_name);
+
+ /* main loop here */
diff --git a/slmodem.init b/slmodem.init
new file mode 100644
index 0000000..5ac5307
--- /dev/null
+++ b/slmodem.init
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# slmodem This shell script takes care of starting and stopping
+# the SmartLink modem userspace daemon.
+#
+# chkconfig: 2345 50 50
+# description: slmodemd is a daemon which is needed to use the SmartLink \
+# softmodem.
+# processname: slmodemd
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+[ -x /usr/sbin/slmodemd ] || exit 0
+
+if [ -f /etc/sysconfig/slmodem ]; then
+ . /etc/sysconfig/slmodem
+fi
+
+if [ $COUNTRY ]; then
+ COUNTRYARG="-c $COUNTRY"
+fi
+
+if [ "$INTERFACE" == "alsa" ] && [ "$ALSA_DEVICE"
!= "" ]; then
+ DEVICE=$ALSA_DEVICE
+fi
+
+modules_load() {
+ case "$INTERFACE" in
+ alsa)
+ ALSA="--alsa"
+ ;;
+ slamr)
+ if [ ! -f /lib/modules/$(uname -r)/extra/slmodem/slamr.ko ]; then
+ echo "Please install the slmodem-kmod package for your kernel"
+ exit 1
+ else
+ modprobe slamr
+ [ -e /dev/slamr ] || mknod /dev/slamr c 242 0
+ DEVICE=/dev/slamr
+ fi
+ ;;
+ slusb)
+ if [ ! -f /lib/modules/$(uname -r)/extra/slmodem/slusb.ko ]; then
+ echo "Please install the slmodem-kmod package for your kernel"
+ exit 1
+ else
+ modprobe slusb
+ [ -e /dev/slusb ] || mknod /dev/slusb c 243 0
+ DEVICE=/dev/slusb
+ fi
+ ;;
+ *)
+ echo "Please edit /etc/sysconfig/slmodem"
+ echo_failure
+ echo
+ exit 1
+ ;;
+ esac
+}
+
+modules_unload() {
+ case "$INTERFACE" in
+ slamr)
+ rmmod slamr > /dev/null
+ [ -c /dev/slamr ] && rm -f /dev/slamr > /dev/null
+ ;;
+ slusb)
+ rmmod slusb > /dev/null
+ [ -c /dev/slusb ] && rm -f /dev/slusb > /dev/null
+ ;;
+ *)
+ ;;
+ esac
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ # Start daemon.
+ echo -n $"Starting SmartLink modem daemon: "
+ modules_load
+ daemon /usr/sbin/slmodemd ${ALSA} ${COUNTRYARG} ${ARGS} --daemon ${DEVICE}
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/slmodem
+ ;;
+ stop)
+ # Stop daemon.
+ echo -n $"Shutting SmartLink modem daemon: "
+ killproc slmodemd
+ RETVAL=$?
+ modules_unload
+ echo
+ [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slmodem
+ ;;
+ status)
+ status slmodemd
+ RETVAL=$?
+ ;;
+ restart|reload)
+ $0 stop
+ $0 start
+ ;;
+ condrestart)
+ [ -f /var/lock/subsys/slmodem ] && restart || :
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|reload}"
+ RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
diff --git a/slmodem.spec b/slmodem.spec
new file mode 100644
index 0000000..adf0ba7
--- /dev/null
+++ b/slmodem.spec
@@ -0,0 +1,125 @@
+%define filever 2.9.11-20080817
+%define relver 2.9.11
+%define datetag 20080817
+
+Summary: Userspace application for smartLink softmodems
+Name: slmodem
+Version: %{relver}
+Release: 5.%{datetag}%{?dist}
+Group: System Environment/Daemons
+License: BSD w/binary object
+# Outdated
+# URL:
http://www.smlink.com/content.aspx?id=132
+URL:
http://linmodems.technion.ac.il/packages/smartlink/
+Source0:
http://linmodems.technion.ac.il/packages/smartlink/slmodem-%{filever}.tar.gz
+Source1: slmodem.init
+Source2: slmodem.sysconfig
+Source3: README.fedora
+Patch0: slmodem-2.9.11-daemon.patch
+Patch1: slmodem-2.9.11-create.patch
+BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
+BuildRequires: alsa-lib-devel
+ExclusiveArch: i386
+Provides: slmodem-alsa = %{version}, slmodem-kmod-common = %{version}
+Requires(post): /sbin/chkconfig
+Requires(post): /sbin/service
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+
+
+%description
+This package contains the userspace application to control several
+SmartLink based modems.
+
+More information about installation and configuration of the slmodem
+package can be found at %{_docdir}/%{name}-%{version}/README.fedora
+after installation.
+
+
+%prep
+%setup -q -n slmodem-%{filever}
+%patch0 -p1 -b .daemon
+%patch1 -p1 -b .create
+
+
+%build
+pushd modem
+make %{?_smp_mflags} SUPPORT_ALSA=1 EXTRA_CFLAGS="$RPM_OPT_FLAGS"
+popd
+
+
+%install
+rm -rf %{buildroot}
+install -D -m 755 modem/slmodemd %{buildroot}%{_sbindir}/slmodemd
+install -d -m 755 %{buildroot}%{_localstatedir}/lib/slmodem
+
+install -D -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/slmodem
+install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/slmodem
+
+cp %{SOURCE3} .
+
+
+%post
+/sbin/chkconfig --add slmodem
+
+
+%preun
+if [ $1 = 0 ]; then
+ /sbin/service slmodem stop >/dev/null 2>&1
+ /sbin/chkconfig --del slmodem
+fi
+
+
+%postun
+if [ "$1" -ge "1" ]; then
+ /sbin/service slmodem condrestart >/dev/null 2>&1
+fi
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr (-,root,root)
+%doc README.fedora README Changes COPYING Documentation/Smartlink.txt
+%{_sbindir}/slmodemd
+%{_sysconfdir}/init.d/slmodem
+%config(noreplace) %{_sysconfdir}/sysconfig/slmodem
+%{_localstatedir}/lib/slmodem/
+
+
+%changelog
+* Sat Sep 08 2007 Andreas Thienemann <andreas(a)bawue.net> 2.9.11-4.20070813
+- Updated to recent slmodem package
+
+* Wed Feb 07 2007 Andreas Thienemann <andreas(a)bawue.net> 2.9.11-3.20070204
+- Updated to recent slmodem package
+- Added README.fedora, explaining some configuration and hardware support details
+
+* Fri Apr 28 2006 Andreas Thienemann <andreas(a)bawue.net> 2.9.11-2
+- Modified .spec to coexist with slmodem and kmod-slmodem.
+- Updated description
+- Changed name of initscripts
+
+* Wed Mar 29 2006 Andreas Thienemann <andreas(a)bawue.net> 2.9.11-1
+- Updated to 2.9.11 snapshot.
+
+* Thu Mar 09 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
+- switch to new release field
+- drop Epoch
+
+* Tue Feb 28 2006 Andreas Bierfert <andreas.bierfert[AT]lowlatency.de>
+- add dist
+
+* Tue Jul 10 2005 Andreas Thienemann <andreas(a)bawue.net> 2.9.9d-0.lvn.2
+- Only builds on x86
+
+* Tue Jun 28 2005 Andreas Thienemann <andreas(a)bawue.net> 2.9.9d-0.lvn.1
+- Repackaged for
rpm.livna.org
+- Added daemonize patch, cleaned up init file
+- Added %%pre and %%post scriptlets
+
+* Tue Jun 28 2005 Andreas Thienemann <andreas(a)bawue.net> 2.9.9d-1
+- Initial package
+
diff --git a/slmodem.sysconfig b/slmodem.sysconfig
new file mode 100644
index 0000000..163e1a8
--- /dev/null
+++ b/slmodem.sysconfig
@@ -0,0 +1,25 @@
+# Country you are in
+# Possible values can be gotten from calling slmodemd --countrylist
+# e.g. COUNTRY=USA or COUNTRY=GERMANY
+COUNTRY=
+
+#
+# Interface the userspace daemon should use to communicate with the modem
+# alsa: For SmartLink Modems, supported by the alsa sound system.
+# slamr: For PCI and Integrated SmartLink Modems
+# slusb: For USB based SmartLink Modems
+#
+INTERFACE=
+
+#
+# If you are using the alsa sound system to drive the modem and you need too
+# specify a special alsa device, as the slmodem daemon does not autodetect
+# the correct sound device, please specify it here as "hw:0,6" or similar
+# value.
+# If you do not use the alsa interface, this value is being ignored.
+ALSA_DEVICE=
+
+#
+# Any other arguments passed to the slmodem daemon
+#
+ARGS=
diff --git a/sources b/sources
index e69de29..775d613 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+37da7d0fe98f1a51adbbc8b81b0981a4 slmodem-2.9.11-20080817.tar.gz