bluetooth: remove hcseriald
Without ng_h4 gone, there's no need for hcseriald. Sponsored by: Netflix
This commit is contained in:
parent
4fa690be2c
commit
66d6299848
@ -40,6 +40,10 @@
|
|||||||
# xargs -n1 | sort | uniq -d;
|
# xargs -n1 | sort | uniq -d;
|
||||||
# done
|
# done
|
||||||
|
|
||||||
|
# 20210929:
|
||||||
|
OLD_FILES+=usr/sbin/hcseriald
|
||||||
|
OLD_FILES+=usr/share/man/man8/hcseriald.8.gz
|
||||||
|
|
||||||
# 20210929: Remove ng_h4
|
# 20210929: Remove ng_h4
|
||||||
OLD_FILES+=usr/share/man/man4/ng_h4.4.gz
|
OLD_FILES+=usr/share/man/man4/ng_h4.4.gz
|
||||||
|
|
||||||
|
@ -235,26 +235,6 @@ bluetooth_start()
|
|||||||
|
|
||||||
# Try to figure out device type by looking at device name
|
# Try to figure out device type by looking at device name
|
||||||
case "${dev}" in
|
case "${dev}" in
|
||||||
# uartX - serial/UART Bluetooth device
|
|
||||||
uart*)
|
|
||||||
load_kld ng_h4 || return 1
|
|
||||||
|
|
||||||
hook="hook"
|
|
||||||
|
|
||||||
# Obtain unit number from device.
|
|
||||||
unit=`expr ${dev} : 'uart\([0-9]\{1,\}\)'`
|
|
||||||
if [ -z "${unit}" ]; then
|
|
||||||
err 1 "Unable to get uart unit number: ${dev}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${hcseriald} -f /dev/cuau${unit} -n ${dev}
|
|
||||||
sleep 1 # wait a little bit
|
|
||||||
|
|
||||||
if [ ! -f "/var/run/hcseriald.${dev}.pid" ]; then
|
|
||||||
err 1 "Unable to start hcseriald on ${dev}"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
# USB Bluetooth adapters
|
# USB Bluetooth adapters
|
||||||
ubt*)
|
ubt*)
|
||||||
hook="hook"
|
hook="hook"
|
||||||
@ -316,14 +296,6 @@ bluetooth_stop()
|
|||||||
|
|
||||||
# Try to figure out device type by looking at device name
|
# Try to figure out device type by looking at device name
|
||||||
case "${dev}" in
|
case "${dev}" in
|
||||||
# uartX - serial/UART Bluetooth device
|
|
||||||
uart*)
|
|
||||||
if [ -f "/var/run/hcseriald.${dev}.pid" ]; then
|
|
||||||
kill `cat /var/run/hcseriald.${dev}.pid`
|
|
||||||
sleep 1 # wait a little bit
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
# 3Com Bluetooth Adapter 3CRWB60-A
|
# 3Com Bluetooth Adapter 3CRWB60-A
|
||||||
btccc*)
|
btccc*)
|
||||||
;;
|
;;
|
||||||
@ -349,7 +321,6 @@ bluetooth_stop()
|
|||||||
|
|
||||||
load_rc_config $name
|
load_rc_config $name
|
||||||
hccontrol="${bluetooth_hccontrol:-/usr/sbin/hccontrol}"
|
hccontrol="${bluetooth_hccontrol:-/usr/sbin/hccontrol}"
|
||||||
hcseriald="${bluetooth_hcseriald:-/usr/sbin/hcseriald}"
|
|
||||||
|
|
||||||
run_rc_command $*
|
run_rc_command $*
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ SUBDIR= \
|
|||||||
btpand \
|
btpand \
|
||||||
hccontrol \
|
hccontrol \
|
||||||
hcsecd \
|
hcsecd \
|
||||||
hcseriald \
|
|
||||||
l2control \
|
l2control \
|
||||||
l2ping \
|
l2ping \
|
||||||
rfcomm_pppd \
|
rfcomm_pppd \
|
||||||
|
@ -209,8 +209,7 @@ hccontrol -n ubt0hci le_set_advertising_enable enable
|
|||||||
.Xr bluetooth 3 ,
|
.Xr bluetooth 3 ,
|
||||||
.Xr netgraph 3 ,
|
.Xr netgraph 3 ,
|
||||||
.Xr netgraph 4 ,
|
.Xr netgraph 4 ,
|
||||||
.Xr ng_hci 4 ,
|
.Xr ng_hci 4
|
||||||
.Xr hcseriald 8
|
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
|
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
|
@ -117,8 +117,7 @@ Display usage message and exit.
|
|||||||
.Xr ng_btsocket 4 ,
|
.Xr ng_btsocket 4 ,
|
||||||
.Xr ng_hci 4 ,
|
.Xr ng_hci 4 ,
|
||||||
.Xr hcsecd.conf 5 ,
|
.Xr hcsecd.conf 5 ,
|
||||||
.Xr hccontrol 8 ,
|
.Xr hccontrol 8
|
||||||
.Xr hcseriald 8
|
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
|
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# $Id: Makefile,v 1.5 2003/08/14 20:06:21 max Exp $
|
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
PACKAGE= bluetooth
|
|
||||||
PROG= hcseriald
|
|
||||||
MAN= hcseriald.8
|
|
||||||
WARNS?= 2
|
|
||||||
|
|
||||||
LIBADD= netgraph
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
|
@ -1,18 +0,0 @@
|
|||||||
# $FreeBSD$
|
|
||||||
# Autogenerated - do NOT edit!
|
|
||||||
|
|
||||||
DIRDEPS = \
|
|
||||||
gnu/lib/csu \
|
|
||||||
include \
|
|
||||||
include/xlocale \
|
|
||||||
lib/${CSU_DIR} \
|
|
||||||
lib/libc \
|
|
||||||
lib/libcompiler_rt \
|
|
||||||
lib/libnetgraph \
|
|
||||||
|
|
||||||
|
|
||||||
.include <dirdeps.mk>
|
|
||||||
|
|
||||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
|
||||||
# local dependencies - needed for -jN in clean tree
|
|
||||||
.endif
|
|
@ -1,86 +0,0 @@
|
|||||||
.\" Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
|
|
||||||
.\" All rights reserved.
|
|
||||||
.\"
|
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
|
||||||
.\" modification, are permitted provided that the following conditions
|
|
||||||
.\" are met:
|
|
||||||
.\" 1. Redistributions of source code must retain the above copyright
|
|
||||||
.\" notice, this list of conditions and the following disclaimer.
|
|
||||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
.\" notice, this list of conditions and the following disclaimer in the
|
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
|
||||||
.\"
|
|
||||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
.\" SUCH DAMAGE.
|
|
||||||
.\"
|
|
||||||
.\" $Id: hcseriald.8,v 1.3 2003/05/21 00:47:26 max Exp $
|
|
||||||
.\" $FreeBSD$
|
|
||||||
.\"
|
|
||||||
.Dd June 14, 2002
|
|
||||||
.Dt HCSERIALD 8
|
|
||||||
.Os
|
|
||||||
.Sh NAME
|
|
||||||
.Nm hcseriald
|
|
||||||
.Nd supervise serial Bluetooth devices
|
|
||||||
.Sh SYNOPSIS
|
|
||||||
.Nm
|
|
||||||
.Op Fl dh
|
|
||||||
.Fl f Ar device
|
|
||||||
.Fl n Ar node_name
|
|
||||||
.Op Fl s Ar speed
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
The
|
|
||||||
.Nm
|
|
||||||
utility handles serial Bluetooth devices.
|
|
||||||
It does one simple thing:
|
|
||||||
it opens the specified serial device, sets the device parameters, and pushes
|
|
||||||
the
|
|
||||||
.Dv H4
|
|
||||||
line discipline.
|
|
||||||
.Pp
|
|
||||||
The options are as follows:
|
|
||||||
.Bl -tag -width indent
|
|
||||||
.It Fl d
|
|
||||||
Do not disassociate from the controlling terminal, i.e., run in foreground.
|
|
||||||
.It Fl f Ar device
|
|
||||||
Callout device name.
|
|
||||||
Example:
|
|
||||||
.Fl f Pa /dev/cuau0 .
|
|
||||||
.It Fl h
|
|
||||||
Display usage message and exit.
|
|
||||||
.It Fl n Ar node_name
|
|
||||||
Set H4 Netgraph node name.
|
|
||||||
Example:
|
|
||||||
.Fl n Li sio0 .
|
|
||||||
.It Fl s Ar speed
|
|
||||||
Set serial device speed to
|
|
||||||
.Ar speed .
|
|
||||||
Example:
|
|
||||||
.Fl s Li 115200 .
|
|
||||||
.El
|
|
||||||
.Sh FILES
|
|
||||||
.Bl -tag -width ".Pa /var/run/hcserial. Ns Ar * Ns Pa .pid" -compact
|
|
||||||
.It Pa /var/run/hcserial . Ns Ar * Ns Pa .pid
|
|
||||||
Process ID of the currently running
|
|
||||||
.Nm
|
|
||||||
daemon.
|
|
||||||
Where
|
|
||||||
.Ar *
|
|
||||||
is an H4 Netgraph node name.
|
|
||||||
.El
|
|
||||||
.Sh SEE ALSO
|
|
||||||
.Xr ng_h4 4 ,
|
|
||||||
.Xr ng_hci 4 ,
|
|
||||||
.Xr tty 4 ,
|
|
||||||
.Xr hccontrol 8
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
|
|
@ -1,269 +0,0 @@
|
|||||||
/*-
|
|
||||||
* hcseriald.c
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* $Id: hcseriald.c,v 1.3 2003/05/21 22:40:32 max Exp $
|
|
||||||
* $FreeBSD$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
#include <netgraph/ng_message.h>
|
|
||||||
#include <netgraph.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
/* Prototypes */
|
|
||||||
static int open_device (char const *, speed_t, char const *);
|
|
||||||
static void sighandler (int);
|
|
||||||
static void usage ();
|
|
||||||
|
|
||||||
static char const * const hcseriald = "hcseriald";
|
|
||||||
static int done = 0;
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
char *device = NULL, *name = NULL;
|
|
||||||
speed_t speed = 115200;
|
|
||||||
int n, detach = 1;
|
|
||||||
char p[FILENAME_MAX];
|
|
||||||
FILE *f = NULL;
|
|
||||||
struct sigaction sa;
|
|
||||||
|
|
||||||
/* Process command line arguments */
|
|
||||||
while ((n = getopt(argc, argv, "df:n:s:h")) != -1) {
|
|
||||||
switch (n) {
|
|
||||||
case 'd':
|
|
||||||
detach = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f':
|
|
||||||
device = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'n':
|
|
||||||
name = optarg;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 's':
|
|
||||||
speed = atoi(optarg);
|
|
||||||
if (speed < 0)
|
|
||||||
usage(argv[0]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'h':
|
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (device == NULL || name == NULL)
|
|
||||||
usage(argv[0]);
|
|
||||||
|
|
||||||
openlog(hcseriald, LOG_PID | LOG_NDELAY, LOG_USER);
|
|
||||||
|
|
||||||
/* Open device */
|
|
||||||
n = open_device(device, speed, name);
|
|
||||||
|
|
||||||
if (detach && daemon(0, 0) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not daemon(0, 0). %s (%d)",
|
|
||||||
strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write PID file */
|
|
||||||
snprintf(p, sizeof(p), "/var/run/%s.%s.pid", hcseriald, name);
|
|
||||||
f = fopen(p, "w");
|
|
||||||
if (f == NULL) {
|
|
||||||
syslog(LOG_ERR, "Could not fopen(%s). %s (%d)",
|
|
||||||
p, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
fprintf(f, "%d", getpid());
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
/* Install signal handler */
|
|
||||||
memset(&sa, 0, sizeof(sa));
|
|
||||||
sa.sa_handler = sighandler;
|
|
||||||
|
|
||||||
if (sigaction(SIGTERM, &sa, NULL) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not sigaction(SIGTERM). %s (%d)",
|
|
||||||
strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sigaction(SIGHUP, &sa, NULL) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not sigaction(SIGHUP). %s (%d)",
|
|
||||||
strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sigaction(SIGINT, &sa, NULL) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not sigaction(SIGINT). %s (%d)",
|
|
||||||
strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Keep running */
|
|
||||||
while (!done)
|
|
||||||
select(0, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
/* Remove PID file and close device */
|
|
||||||
unlink(p);
|
|
||||||
close(n);
|
|
||||||
closelog();
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
} /* main */
|
|
||||||
|
|
||||||
/* Open terminal, set settings, push H4 line discipline and set node name */
|
|
||||||
static int
|
|
||||||
open_device(char const *device, speed_t speed, char const *name)
|
|
||||||
{
|
|
||||||
int fd, disc, cs, ds;
|
|
||||||
struct termios t;
|
|
||||||
struct nodeinfo ni;
|
|
||||||
struct ngm_name n;
|
|
||||||
char p[NG_NODESIZ];
|
|
||||||
|
|
||||||
/* Open terminal device and setup H4 line discipline */
|
|
||||||
fd = open(device, O_RDWR|O_NOCTTY);
|
|
||||||
if (fd < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not open(%s). %s (%d)",
|
|
||||||
device, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
tcflush(fd, TCIOFLUSH);
|
|
||||||
|
|
||||||
if (tcgetattr(fd, &t) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not tcgetattr(%s). %s (%d)",
|
|
||||||
device, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
cfmakeraw(&t);
|
|
||||||
|
|
||||||
t.c_cflag |= CLOCAL; /* clocal */
|
|
||||||
t.c_cflag &= ~CSIZE; /* cs8 */
|
|
||||||
t.c_cflag |= CS8; /* cs8 */
|
|
||||||
t.c_cflag &= ~PARENB; /* -parenb */
|
|
||||||
t.c_cflag &= ~CSTOPB; /* -cstopb */
|
|
||||||
t.c_cflag |= CRTSCTS; /* crtscts */
|
|
||||||
|
|
||||||
if (tcsetattr(fd, TCSANOW, &t) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not tcsetattr(%s). %s (%d)",
|
|
||||||
device, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
tcflush(fd, TCIOFLUSH);
|
|
||||||
|
|
||||||
if (cfsetspeed(&t, speed) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not cfsetspeed(%s). %s (%d)",
|
|
||||||
device, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tcsetattr(fd, TCSANOW, &t) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not tcsetattr(%s). %s (%d)",
|
|
||||||
device, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
disc = H4DISC;
|
|
||||||
if (ioctl(fd, TIOCSETD, &disc) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not ioctl(%s, TIOCSETD, %d). %s (%d)",
|
|
||||||
device, disc, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get default name of the Netgraph node */
|
|
||||||
memset(&ni, 0, sizeof(ni));
|
|
||||||
if (ioctl(fd, NGIOCGINFO, &ni) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not ioctl(%d, NGIOGINFO). %s (%d)",
|
|
||||||
fd, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assign new name to the Netgraph node */
|
|
||||||
snprintf(p, sizeof(p), "%s:", ni.name);
|
|
||||||
snprintf(n.name, sizeof(n.name), "%s", name);
|
|
||||||
|
|
||||||
if (NgMkSockNode(NULL, &cs, &ds) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not NgMkSockNode(). %s (%d)",
|
|
||||||
strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NgSendMsg(cs, p, NGM_GENERIC_COOKIE, NGM_NAME, &n, sizeof(n)) < 0) {
|
|
||||||
syslog(LOG_ERR, "Could not NgSendMsg(%d, %s, NGM_NAME, %s). " \
|
|
||||||
"%s (%d)", cs, p, n.name, strerror(errno), errno);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(cs);
|
|
||||||
close(ds);
|
|
||||||
|
|
||||||
return (fd);
|
|
||||||
} /* open_device */
|
|
||||||
|
|
||||||
/* Signal handler */
|
|
||||||
static void
|
|
||||||
sighandler(int s)
|
|
||||||
{
|
|
||||||
done = 1;
|
|
||||||
} /* sighandler */
|
|
||||||
|
|
||||||
/* Usage */
|
|
||||||
static void
|
|
||||||
usage(void)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Usage: %s -f device -n node_name [-s speed -d -h]\n" \
|
|
||||||
"Where:\n" \
|
|
||||||
"\t-f device tty device name, ex. /dev/cuau1\n" \
|
|
||||||
"\t-n node_name set Netgraph node name to node_name\n" \
|
|
||||||
"\t-s speed set tty speed, ex. 115200\n" \
|
|
||||||
"\t-d run in foreground\n" \
|
|
||||||
"\t-h display this message\n",
|
|
||||||
hcseriald);
|
|
||||||
exit(255);
|
|
||||||
} /* usage */
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user