xref: /freebsd/libexec/rc/rc.d/bthidd (revision a0409676120c1e558d0ade943019934e0f15118d)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: bthidd
7# REQUIRE: DAEMON hcsecd
8# BEFORE: LOGIN
9# KEYWORD: nojail shutdown
10
11. /etc/rc.subr
12
13name="bthidd"
14desc="Bluetooth HID daemon"
15rcvar="bthidd_enable"
16command="/usr/sbin/${name}"
17pidfile="/var/run/${name}.pid"
18start_precmd="bthidd_prestart"
19
20evdev_enabled()
21{
22	case ${bthidd_evdev_support} in
23	[Aa][Uu][Tt][Oo])
24		check_kern_features evdev_support
25		return $?
26		;;
27	*)
28		checkyesno bthidd_evdev_support
29		return $?
30		;;
31	esac
32}
33
34bthidd_prestart()
35{
36	if evdev_enabled; then
37		load_kld -m uinput uinput
38	fi
39	load_kld -m kbdmux kbdmux
40	load_kld -m vkbd vkbd
41	load_kld -m ng_btsocket ng_btsocket
42	return 0
43}
44
45load_rc_config $name
46config="${bthidd_config:-/etc/bluetooth/${name}.conf}"
47hids="${bthidd_hids:-/var/db/${name}.hids}"
48command_args="-c ${config} -H ${hids} -p ${pidfile}"
49if evdev_enabled; then
50	command_args="$command_args -u"
51fi
52required_files="${config}"
53
54run_rc_command "$1"
55