diff options
author | Sergey A. Osokin <osa@FreeBSD.org> | 2004-11-01 15:46:00 +0000 |
---|---|---|
committer | Sergey A. Osokin <osa@FreeBSD.org> | 2004-11-01 15:46:00 +0000 |
commit | a87f30e9d02c3a4040b8889077cbb18c5b661170 (patch) | |
tree | deab7a5ca26199613ebfb43917af1e3c6f90f7d3 /comms | |
parent | fe36df60a93e0bee189cffa2d91227edc604e633 (diff) | |
download | ports-a87f30e9d02c3a4040b8889077cbb18c5b661170.tar.gz ports-a87f30e9d02c3a4040b8889077cbb18c5b661170.zip |
Notes
Diffstat (limited to 'comms')
-rw-r--r-- | comms/ltmdm/Makefile | 12 | ||||
-rw-r--r-- | comms/ltmdm/files/ltmdm.sh | 121 | ||||
-rw-r--r-- | comms/ltmdm/files/patch-sys-dev-ltmdm-ltmdmsio.c | 53 |
3 files changed, 123 insertions, 63 deletions
diff --git a/comms/ltmdm/Makefile b/comms/ltmdm/Makefile index f28b4d4cea02..d6838abfa13c 100644 --- a/comms/ltmdm/Makefile +++ b/comms/ltmdm/Makefile @@ -7,7 +7,7 @@ PORTNAME= ltmdm PORTVERSION= 1.4 -PORTREVISION= 12 +PORTREVISION= 13 CATEGORIES= comms MASTER_SITES= http://www.dons.net.au/~darius/ \ http://soupnazi.org/FreeBSD/ports/distfiles/ @@ -20,6 +20,7 @@ ONLY_FOR_ARCHS= i386 BUILD_WRKSRC= ${WRKSRC}/sys/modules/ltmdm NO_WRKSUBDIR= yes +USE_RC_SUBR= yes LTMDM_DEV_MAJOR ?= 228 LTMDM_OBJ_VERSION ?= 600 @@ -32,6 +33,8 @@ MAKE_ARGS+= LTMDM_OBJ_VERSION=${LTMDM_OBJ_VERSION} PORTDOCS= README.TXT README-en.TXT INSTALL.TXT INSTALL-en.TXT +RC_SCRIPTS_SUB=PREFIX=${PREFIX} RC_SUBR=${RC_SUBR} MAJOR=${LTMDM_DEV_MAJOR} + pre-fetch: .if !exists(${SRC_BASE}/sys/Makefile) @${ECHO} "*************************************************"; \ @@ -47,9 +50,12 @@ pre-fetch: @${ECHO} "*************************************************"; .endif -do-install: - @${SED} "s:%%PREFIX%%:${PREFIX}:;s:%%MAJOR%%:${LTMDM_DEV_MAJOR}:" \ +post-extract: + @ [ -f ${WRKSRC}/ltmdm.sh ] && ${RM} -f ${WRKSRC}/ltmdm.sh + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ < ${FILESDIR}/ltmdm.sh > ${WRKSRC}/ltmdm.sh + +do-install: @${MKDIR} ${DATADIR} @${INSTALL_DATA} ${WRKSRC}/sys/modules/ltmdm/ltmdm.ko ${DATADIR} @${INSTALL_SCRIPT} ${WRKSRC}/ltmdm.sh ${PREFIX}/etc/rc.d/ diff --git a/comms/ltmdm/files/ltmdm.sh b/comms/ltmdm/files/ltmdm.sh index bea704345b76..7614df9692ad 100644 --- a/comms/ltmdm/files/ltmdm.sh +++ b/comms/ltmdm/files/ltmdm.sh @@ -1,40 +1,85 @@ #!/bin/sh +# $FreeBSD$ -PREFIX=%%PREFIX%% -MAJOR=%%MAJOR%% - -if mount -p | awk '{print $3}'| grep -q devfs ; then - HAVEDEVFS=YES -else - HAVEDEVFS=NO -fi - -case "$1" in - stop) - if [ "${HAVEDEVFS}" = "NO" ]; then - rm -f /dev/cual0 /dev/cuail0 /dev/cuall0 /dev/ttyl0 /dev/ttyil0 /dev/ttyll0 - fi - kldstat -n ltmdm 2>/dev/null >/dev/null && kldunload ltmdm - ;; - start|restart) - $0 stop - sleep 1 - if [ "${HAVEDEVFS}" = "NO" ]; then - umask 7 - mknod /dev/cual0 c ${MAJOR} 128 uucp:dialer - mknod /dev/cuail0 c ${MAJOR} 160 uucp:dialer - mknod /dev/cuall0 c ${MAJOR} 192 uucp:dialer - umask 77 - mknod /dev/ttyl0 c ${MAJOR} 0 root:wheel - mknod /dev/ttyil0 c ${MAJOR} 32 root:wheel - mknod /dev/ttyll0 c ${MAJOR} 64 root:wheel - fi - - kldload ${PREFIX}/share/ltmdm/ltmdm.ko - - # by default ignore incoming calls - echo "ats0=0">/dev/cual0 - - echo -n ' ltmdm' - ;; -esac +# PROVIDE: ltmdm +# REQUIRE: DAEMON +# BEFORE: LOGIN +# KEYWORD: FreeBSD shutdown + +# Define these ltmdm_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/ltmdm +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +ltmdm_enable=${ltmdm_enable-"NO"} + +. %%RC_SUBR%% + +name="ltmdm" +rcvar=`set_rcvar` +start_cmd="ltmdm_start" +stop_cmd="ltmdm_stop" +MAJOR="%%MAJOR%%" + +load_rc_config $name + +ltmdm_devfs_check() +{ + # Check devfs status, return + # 0 - if devfs present + # 1 - if devfs do not present + if mount -p | awk '{print $3}'| grep -q devfs ; then + return 0 + else + return 1 + fi +} + +ltmdm_start() +{ + echo "Enabling ltmdm." + + # Check devfs status, if devfs do not presented + # create cua* and tty* devices + if ! ltmdm_devfs_check ; then + umask 7 + mknod /dev/cual0 c ${MAJOR} 128 uucp:dialer + mknod /dev/cuail0 c ${MAJOR} 160 uucp:dialer + mknod /dev/cuall0 c ${MAJOR} 192 uucp:dialer + umask 77 + mknod /dev/ttyl0 c ${MAJOR} 0 root:wheel + mknod /dev/ttyil0 c ${MAJOR} 32 root:wheel + mknod /dev/ttyll0 c ${MAJOR} 64 root:wheel + fi + + # Load ltmdm kernel module if needed + if ! kldstat -v | grep -q ltmdm\$; then + if kldload %%PREFIX%%/share/ltmdm/ltmdm.ko; then + info 'ltmdm module loaded.' + else + err 1 'ltmdm module failed to load.' + fi + fi + + # Ignore incoming calls + echo "ats0=0">/dev/cual0 +} + +ltmdm_stop() +{ + echo "Disabling ltmdm." + + # Check devfs status, if devfs do not presented + # remove cua* and tty* devices + if ! ltmdm_devfs_check ; then + rm -f /dev/cual0 /dev/cuail0 /dev/cuall0 \ + /dev/ttyl0 /dev/ttyil0 /dev/ttyll0 + fi + + # Unload ltmdm kernel module + kldstat -n ltmdm 2>/dev/null >/dev/null && kldunload ltmdm +} + +run_rc_command "$1" diff --git a/comms/ltmdm/files/patch-sys-dev-ltmdm-ltmdmsio.c b/comms/ltmdm/files/patch-sys-dev-ltmdm-ltmdmsio.c index bf6fb11d3a68..35ae60a60c4a 100644 --- a/comms/ltmdm/files/patch-sys-dev-ltmdm-ltmdmsio.c +++ b/comms/ltmdm/files/patch-sys-dev-ltmdm-ltmdmsio.c @@ -1,5 +1,5 @@ --- sys/dev/ltmdm/ltmdmsio.c.orig Tue Mar 12 04:47:31 2002 -+++ sys/dev/ltmdm/ltmdmsio.c Tue Jul 27 23:28:56 2004 ++++ sys/dev/ltmdm/ltmdmsio.c Mon Oct 25 15:31:51 2004 @@ -60,7 +60,9 @@ #include <sys/proc.h> #include <sys/module.h> @@ -140,7 +140,16 @@ }; static u_int com_events; /* input chars + weighted output completions */ -@@ -1295,8 +1343,11 @@ +@@ -968,8 +1016,6 @@ + { + { SWI_TTY , "SWI_TTY" }, + { SWI_NET , "SWI_NET" }, +- { SWI_CAMNET , "SWI_CAMNET" }, +- { SWI_CAMBIO , "SWI_CAMBIO" }, + { -1 , NULL } + }; + +@@ -1295,8 +1341,11 @@ DPRINTF(1,(" x_chip_version = %d\n", x_chip_version)); com->flags = flags; @@ -152,7 +161,7 @@ /* * initialize the device registers as follows: -@@ -1433,11 +1484,19 @@ +@@ -1433,11 +1482,19 @@ s = splfunc(); if (tp) { @@ -172,7 +181,7 @@ } vxdPortClose(); siosettimeout(); -@@ -1470,7 +1529,11 @@ +@@ -1470,7 +1527,11 @@ } static int @@ -184,7 +193,7 @@ { struct com_s *com; int error; -@@ -1610,7 +1673,11 @@ +@@ -1610,7 +1671,11 @@ * the true carrier. */ if (com->prev_modem_status & MSR_DCD || mynor & CALLOUT_MASK) @@ -196,7 +205,7 @@ } /* * Wait for DCD if necessary. -@@ -1626,7 +1693,11 @@ +@@ -1626,7 +1691,11 @@ goto out; goto open_top; } @@ -208,7 +217,7 @@ disc_optim(tp, &tp->t_termios, com); if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) com->active_out = TRUE; -@@ -1639,7 +1710,11 @@ +@@ -1639,7 +1708,11 @@ } static int @@ -220,7 +229,7 @@ { struct com_s *com; int mynor; -@@ -1654,11 +1729,19 @@ +@@ -1654,11 +1727,19 @@ return (ENODEV); tp = com->tp; s = splfunc(); @@ -240,7 +249,7 @@ siosettimeout(); splx(s); if (com->gone) { -@@ -1685,7 +1768,9 @@ +@@ -1685,7 +1766,9 @@ s = splfunc(); com->do_timestamp = FALSE; com->do_dcd_timestamp = FALSE; @@ -250,7 +259,7 @@ write_vuart_port(UART_CFCR, com->cfcr_image &= ~CFCR_SBREAK); { write_vuart_port(UART_IER, 0); -@@ -1724,7 +1809,11 @@ +@@ -1724,7 +1807,11 @@ } static int @@ -262,7 +271,7 @@ { int mynor; struct com_s *com; -@@ -1735,11 +1824,19 @@ +@@ -1735,11 +1822,19 @@ com = com_addr(MINOR_TO_UNIT(mynor)); if (com == NULL || com->gone) return (ENODEV); @@ -282,7 +291,7 @@ { int mynor; struct com_s *com; -@@ -1754,7 +1851,11 @@ +@@ -1754,7 +1849,11 @@ if (com == NULL || com->gone) return (ENODEV); @@ -294,7 +303,7 @@ } static void -@@ -1860,7 +1961,11 @@ +@@ -1860,7 +1959,11 @@ if (line_status & LSR_PE) recv_data |= TTY_PE; } @@ -306,7 +315,7 @@ lt_disable_intr(); } while (buf < com->iptr); } -@@ -1894,23 +1999,34 @@ +@@ -1894,23 +1997,34 @@ u_char recv_data; u_char int_ctl; u_char int_ctl_new; @@ -341,7 +350,7 @@ line_status = read_vuart_port(UART_LSR); /* input event? (check first to help avoid overruns) */ -@@ -1948,7 +2064,11 @@ +@@ -1948,7 +2062,11 @@ recv_data = 0; } ++com->bytes_in; @@ -353,7 +362,7 @@ setsofttty(); ioptr = com->iptr; if (ioptr >= com->ibufend) -@@ -2053,7 +2173,11 @@ +@@ -2053,7 +2171,11 @@ } static int @@ -365,7 +374,7 @@ { struct com_s *com; int error; -@@ -2134,7 +2258,11 @@ +@@ -2134,7 +2256,11 @@ if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } @@ -377,7 +386,7 @@ if (error != ENOIOCTL) return (error); s = splfunc(); -@@ -2189,13 +2317,17 @@ +@@ -2189,13 +2315,17 @@ com->do_timestamp = TRUE; *(struct timeval *)data = com->timestamp; break; @@ -395,7 +404,7 @@ if (error == ENODEV) error = ENOTTY; return (error); -@@ -2257,8 +2389,13 @@ +@@ -2257,8 +2387,13 @@ com->state &= ~CS_CHECKMSR; lt_enable_intr(); if (delta_modem_status & MSR_DCD) @@ -409,7 +418,7 @@ } if (com->state & CS_ODONE) { lt_disable_intr(); -@@ -2270,7 +2407,11 @@ +@@ -2270,7 +2405,11 @@ sio_busycheck_handle = timeout(siobusycheck, com, hz / 100); com->extra_state |= CSE_BUSYCHECK; } @@ -421,7 +430,7 @@ } if (com_events == 0) break; -@@ -2769,11 +2910,21 @@ +@@ -2769,11 +2908,21 @@ && (!(t->c_iflag & PARMRK) || (t->c_iflag & (IGNPAR | IGNBRK)) == (IGNPAR | IGNBRK)) && !(t->c_lflag & (ECHO | ICANON | IEXTEN | ISIG | PENDIN)) @@ -443,7 +452,7 @@ } #ifdef KLD_MODULE -@@ -2796,7 +2947,7 @@ +@@ -2796,7 +2945,7 @@ #endif DRIVER_MODULE(ltmdm, pci, ltmdm_pci_driver, ltmdm_devclass, ltmdm_event, 0); |