Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Sep 2021 03:23:23 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 66d6299848c3 - main - bluetooth: remove hcseriald
Message-ID:  <202109300323.18U3NNsb099776@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=66d6299848c39c35327a7ea19d7cd6b03283784c

commit 66d6299848c39c35327a7ea19d7cd6b03283784c
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-09-30 03:08:30 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-09-30 03:18:17 +0000

    bluetooth: remove hcseriald
    
    Without ng_h4 gone, there's no need for hcseriald.
    
    Sponsored by:           Netflix
---
 ObsoleteFiles.inc                            |   4 +
 libexec/rc/rc.d/bluetooth                    |  29 ---
 usr.sbin/bluetooth/Makefile                  |   1 -
 usr.sbin/bluetooth/hccontrol/hccontrol.8     |   3 +-
 usr.sbin/bluetooth/hcsecd/hcsecd.8           |   3 +-
 usr.sbin/bluetooth/hcseriald/Makefile        |  11 --
 usr.sbin/bluetooth/hcseriald/Makefile.depend |  18 --
 usr.sbin/bluetooth/hcseriald/hcseriald.8     |  86 ---------
 usr.sbin/bluetooth/hcseriald/hcseriald.c     | 269 ---------------------------
 9 files changed, 6 insertions(+), 418 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 4a0d2fe1b7ea..ee77a56b7acc 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -40,6 +40,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20210929:
+OLD_FILES+=usr/sbin/hcseriald
+OLD_FILES+=usr/share/man/man8/hcseriald.8.gz
+
 # 20210929: Remove ng_h4
 OLD_FILES+=usr/share/man/man4/ng_h4.4.gz
 
diff --git a/libexec/rc/rc.d/bluetooth b/libexec/rc/rc.d/bluetooth
index 318428ba2fee..b89a2c328048 100755
--- a/libexec/rc/rc.d/bluetooth
+++ b/libexec/rc/rc.d/bluetooth
@@ -235,26 +235,6 @@ bluetooth_start()
 
 	# Try to figure out device type by looking at device name
 	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
 	ubt*)
 		hook="hook"
@@ -316,14 +296,6 @@ bluetooth_stop()
 
 	# Try to figure out device type by looking at device name
 	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
 	btccc*)
 		;;
@@ -349,7 +321,6 @@ bluetooth_stop()
 
 load_rc_config $name
 hccontrol="${bluetooth_hccontrol:-/usr/sbin/hccontrol}"
-hcseriald="${bluetooth_hcseriald:-/usr/sbin/hcseriald}"
 
 run_rc_command $*
 
diff --git a/usr.sbin/bluetooth/Makefile b/usr.sbin/bluetooth/Makefile
index 5868ffe90747..99f2a2eb9087 100644
--- a/usr.sbin/bluetooth/Makefile
+++ b/usr.sbin/bluetooth/Makefile
@@ -8,7 +8,6 @@ SUBDIR= \
 	btpand \
 	hccontrol \
 	hcsecd \
-	hcseriald \
 	l2control \
 	l2ping \
 	rfcomm_pppd \
diff --git a/usr.sbin/bluetooth/hccontrol/hccontrol.8 b/usr.sbin/bluetooth/hccontrol/hccontrol.8
index e04b1f01b427..1d6e519f6acc 100644
--- a/usr.sbin/bluetooth/hccontrol/hccontrol.8
+++ b/usr.sbin/bluetooth/hccontrol/hccontrol.8
@@ -209,8 +209,7 @@ hccontrol -n ubt0hci le_set_advertising_enable enable
 .Xr bluetooth 3 ,
 .Xr netgraph 3 ,
 .Xr netgraph 4 ,
-.Xr ng_hci 4 ,
-.Xr hcseriald 8
+.Xr ng_hci 4
 .Sh AUTHORS
 .An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
 .Sh BUGS
diff --git a/usr.sbin/bluetooth/hcsecd/hcsecd.8 b/usr.sbin/bluetooth/hcsecd/hcsecd.8
index a55e85e5ab8c..2550fa1a143e 100644
--- a/usr.sbin/bluetooth/hcsecd/hcsecd.8
+++ b/usr.sbin/bluetooth/hcsecd/hcsecd.8
@@ -117,8 +117,7 @@ Display usage message and exit.
 .Xr ng_btsocket 4 ,
 .Xr ng_hci 4 ,
 .Xr hcsecd.conf 5 ,
-.Xr hccontrol 8 ,
-.Xr hcseriald 8
+.Xr hccontrol 8
 .Sh AUTHORS
 .An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com
 .Sh BUGS
diff --git a/usr.sbin/bluetooth/hcseriald/Makefile b/usr.sbin/bluetooth/hcseriald/Makefile
deleted file mode 100644
index 8a0d422ee74a..000000000000
--- a/usr.sbin/bluetooth/hcseriald/Makefile
+++ /dev/null
@@ -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>
diff --git a/usr.sbin/bluetooth/hcseriald/Makefile.depend b/usr.sbin/bluetooth/hcseriald/Makefile.depend
deleted file mode 100644
index 3f4cb50e1709..000000000000
--- a/usr.sbin/bluetooth/hcseriald/Makefile.depend
+++ /dev/null
@@ -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
diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.8 b/usr.sbin/bluetooth/hcseriald/hcseriald.8
deleted file mode 100644
index 15f08411f98d..000000000000
--- a/usr.sbin/bluetooth/hcseriald/hcseriald.8
+++ /dev/null
@@ -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
diff --git a/usr.sbin/bluetooth/hcseriald/hcseriald.c b/usr.sbin/bluetooth/hcseriald/hcseriald.c
deleted file mode 100644
index e019d52618b8..000000000000
--- a/usr.sbin/bluetooth/hcseriald/hcseriald.c
+++ /dev/null
@@ -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 */
-



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109300323.18U3NNsb099776>