From ecd75227c6c3ebef19835e070255bb92d0b4727d Mon Sep 17 00:00:00 2001 From: Stefan Schweizer Date: Sat, 9 Apr 2005 14:35:00 +0000 Subject: Merge some changes thanks to sbriesen (Portage version: 1.585-cvs) --- net-dialup/capi4k-utils/files/capi-isdn | 18 ++++++++++ net-dialup/capi4k-utils/files/capi.confd | 11 ++++--- net-dialup/capi4k-utils/files/capi.hotplug | 32 +++++++++--------- net-dialup/capi4k-utils/files/capi.initd | 53 ++++++++++++++++++++---------- 4 files changed, 77 insertions(+), 37 deletions(-) create mode 100644 net-dialup/capi4k-utils/files/capi-isdn (limited to 'net-dialup/capi4k-utils/files') diff --git a/net-dialup/capi4k-utils/files/capi-isdn b/net-dialup/capi4k-utils/files/capi-isdn new file mode 100644 index 000000000000..97f298b9f291 --- /dev/null +++ b/net-dialup/capi4k-utils/files/capi-isdn @@ -0,0 +1,18 @@ +# +# ISDN connection using CAPI interface +# +plugin capiplugin.so +sync +protocol hdlc +/dev/null + +# Plugin passwordfd enables us to pipe the password to pppd, thus we +# don't have to put it into pap-secrets and chap-secrets. +# +plugin passwordfd.so + +noauth + +# this is recommended +noccp +noipx diff --git a/net-dialup/capi4k-utils/files/capi.confd b/net-dialup/capi4k-utils/files/capi.confd index 31dc5c9dfb11..4d0074247b2f 100644 --- a/net-dialup/capi4k-utils/files/capi.confd +++ b/net-dialup/capi4k-utils/files/capi.confd @@ -1,13 +1,16 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.confd,v 1.2 2005/03/29 22:16:07 genstef Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.confd,v 1.3 2005/04/09 14:35:00 genstef Exp $ # do you want to use USB hotplug? # if disabled, you have to configure your device in /etc/capi.conf -CAPI_HOTPLUG_USB=1 +CAPI_HOTPLUG_USB="yes" # should via hotplug added cards generate a beep? -CAPI_HOTPLUG_BEEP=1 +CAPI_HOTPLUG_BEEP="yes" # should CAPIDRV be loaded? -CAPI_LOAD_CAPIDRV=1 +CAPI_LOAD_CAPIDRV="yes" + +# deactivate cards on stop (USB-Cards have to be re-plugged then)? +CAPI_UNLOAD_CARDS="yes" diff --git a/net-dialup/capi4k-utils/files/capi.hotplug b/net-dialup/capi4k-utils/files/capi.hotplug index d532d63446aa..d4d33fef0cb7 100644 --- a/net-dialup/capi4k-utils/files/capi.hotplug +++ b/net-dialup/capi4k-utils/files/capi.hotplug @@ -1,11 +1,11 @@ #!/bin/bash # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.hotplug,v 1.3 2005/03/30 20:03:15 genstef Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.hotplug,v 1.4 2005/04/09 14:35:00 genstef Exp $ . /etc/conf.d/capi -[ "$CAPI_HOTPLUG_USB" = "0" ] && exit 0 +[ "$CAPI_HOTPLUG_USB" = "yes" ] || exit 0 # syslog output syslog() { # @@ -13,11 +13,11 @@ syslog() { # } beep_ok() { - [ "$CAPI_HOTPLUG_BEEP" = "0" ] || echo -en "\033[10;1200]\a\033[10;262]" > /dev/console + [ "$CAPI_HOTPLUG_BEEP" = "yes" ] && echo -en "\033[10;1200]\a\033[10;262]" > /dev/console } beep_error() { - [ "$CAPI_HOTPLUG_BEEP" = "0" ] || echo -en "\033[10;300]\a\033[10;262]" > /dev/console + [ "$CAPI_HOTPLUG_BEEP" = "yes" ] && echo -en "\033[10;300]\a\033[10;262]" > /dev/console } # driver lookup @@ -31,7 +31,7 @@ avmusb() { # local CARD NAME STATUS TYPE VER DEV FIRMWARE while read CARD NAME STATUS TYPE VER DEV; do # AVM cardinfo if [ "${STATUS}" = "detected" -a ${DEV} -eq ${2} ]; then - syslog "loading firmware ${3} into controller ${CARD} (${NAME})" + syslog "loading firmware '${3}' into controller ${CARD} (${NAME})" /usr/sbin/avmcapictrl load "/lib/firmware/${3}" "${CARD}" break fi @@ -93,44 +93,44 @@ esac case "$ACTION" in add) - /bin/ln 2>/dev/null -s "$$" "$LOCK" || exit 0 + /bin/ln 2>/dev/null -s "$$" "${LOCK}" || exit 0 # loading capi if ! ( [ -f /proc/capi/capi20 ] || /sbin/modprobe -sq capi ); then syslog "could not load CAPI!" - beep_error; /bin/rm -f "$LOCK"; exit 1 + beep_error; /bin/rm -f "${LOCK}"; exit 1 fi # loading driver - if ! /sbin/modprobe -sq $DRIVER; then + if ! /sbin/modprobe -sq ${DRIVER}; then syslog "could not load driver ${DRIVER}!" - beep_error; /bin/rm -f "$LOCK"; exit 1 + beep_error; /bin/rm -f "${LOCK}"; exit 1 fi # loading firmware - if [ -n "$LOADER" -a -n "$FIRMWARE" ]; then + if [ -n "${LOADER}" -a -n "${FIRMWARE}" ]; then CNT=0 # wait for udev - while [ ! -e /dev/capi20 -a $CNT -lt 10 ]; do - sleep 1; : $((CNT++)) + while [ ! -e /dev/capi20 -a $CNT -lt 20 ]; do + sleep 0.5; : $((CNT++)) done if [ -f "/lib/firmware/${FIRMWARE}" ]; then $LOADER $DRIVER $USBDEV $FIRMWARE else syslog "firmware ${FIRMWARE} not found!" - beep_error; /bin/rm -f "$LOCK"; exit 1 + beep_error; /bin/rm -f "${LOCK}"; exit 1 fi fi # loading capidrv (should be loaded *after* card driver) - if ! ( [ -f /proc/capi/capidrv -o "$CAPI_LOAD_CAPIDRV" = "0" ] || /sbin/modprobe -sq capidrv ); then + if ! ( [ -f /proc/capi/capidrv -o "$CAPI_LOAD_CAPIDRV" != "yes" ] || /sbin/modprobe -sq capidrv ); then syslog "could not load CAPIDRV!" fi - beep_ok; /bin/rm -f "$LOCK" + beep_ok; /bin/rm -f "${LOCK}" ;; remove) - /sbin/modprobe -sqr $DRIVER + /sbin/modprobe -sqr ${DRIVER} ;; esac exit 0 diff --git a/net-dialup/capi4k-utils/files/capi.initd b/net-dialup/capi4k-utils/files/capi.initd index a201560fdede..005c03f4cbbc 100644 --- a/net-dialup/capi4k-utils/files/capi.initd +++ b/net-dialup/capi4k-utils/files/capi.initd @@ -1,12 +1,12 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd,v 1.4 2005/03/30 20:03:15 genstef Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd,v 1.5 2005/04/09 14:35:00 genstef Exp $ -opts="start stop info" +opts="info showconfig" depend() { - after coldplug isapnp + after coldplug hotplug isapnp pcmcia } start() { @@ -21,40 +21,59 @@ start() { eend $? || return 1 local CNT=0 # wait for udev - while [ ! -e /dev/capi20 -a $CNT -lt 10 ]; do - sleep 1; : $((CNT++)) + while [ ! -e /dev/capi20 -a $CNT -lt 20 ]; do + sleep 0.5; : $((CNT++)) done ebegin "Starting CAPI" - if /usr/sbin/capiinit 2>/dev/null activate ; then - [ -f /proc/capi/capidrv -o "$CAPI_LOAD_CAPIDRV" = "0" ] || /sbin/modprobe -s capidrv - eindent - while read INFO; do einfo "$INFO"; done < /proc/capi/controller - eoutdent + [ -f /proc/capi/capidrv -o "$CAPI_LOAD_CAPIDRV" != "yes" ] || /sbin/modprobe -s capidrv + # eindent -> waiting for new baselayout :-/ + local INFO + while read INFO; do einfo " ${INFO}"; done < /proc/capi/controller + # eoutdent fi - eend $? } stop() { - local DRIVERS=$(/usr/bin/cut 2>/dev/null -f1 -d' ' /proc/capi/driver) + local DRV RET FCNT=0 DRIVERS=$(/bin/cut 2>/dev/null -f1 -d' ' /proc/capi/driver) - ebegin "Stopping CAPI" + # if some CAPI applications are still running, kill 'em + if /bin/fuser 2>/dev/null -s /dev/capi20; then + ebegin "Stopping CAPI applications" + /bin/fuser -ks /dev/capi20; RET=$? + while [ $RET -eq 0 -a $FCNT -lt 10 ]; do + echo -n "."; sleep 0.5; FCNT=$(($FCNT + 1)) + /bin/fuser -s /dev/capi20; RET=$? + done + [ $RET -eq 0 ] && eend 1 || eend 0 + fi - /sbin/modprobe -sqr capidrv - /usr/sbin/capiinit 2>/dev/null stop + ebegin "Stopping CAPI" + [ "$CAPI_LOAD_CAPIDRV" = "yes" ] && /sbin/modprobe -sqr capidrv + [ "$CAPI_UNLOAD_CARDS" = "yes" ] && /usr/sbin/capiinit 2>/dev/null stop for DRV in $DRIVERS; do /sbin/modprobe -sqr $DRV; done /sbin/modprobe -sqr capi - eend 0 } info() { if [ -e /proc/capi/controller ]; then - while read INFO; do einfo "$INFO"; done < /proc/capi/controller + local INFO + while read INFO; do einfo "${INFO}"; done < /proc/capi/controller else eerror "ERROR: CAPI not loaded" return 1 fi } + +showconfig() { + local TEXT INFO + if TEXT=$(/usr/sbin/capiinit 2>&1 show); then + echo "$TEXT" | while read INFO; do einfo "${INFO}"; done + return 0 + fi + echo "$TEXT" | while read INFO; do eerror "${INFO}"; done + return 1 +} -- cgit v1.2.3-65-gdbad