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