freebsd-dev/etc/rc.d/bthidd
Vladimir Kondratyev 44af5666d9 bthidd(8): Add evdev protocol support for bluetooth keyboards and mouses
User-visible changes:

"-u" is added to to list of command line options supported by bthidd.
Use it to enable evdev support. uinput and evdev modules should be
kld-loaded or compiled into the kernel in that case.

bthidd_evdev_support rc.conf variable is added to control enabling of
evdev support in bthidd startup script. Possible values are: "YES", "NO",
"AUTO"(default). Setting bthidd_evdev_support to "AUTO" inserts "-u" option
if kernel is compiled with EVDEV_SUPPORT option enabled.

Support for consumer HID usage page keyboard events is implemented. Most of
them are available only through evdev protocol.

kern.evdev.rcpt_mask sysctl is checked, so "sysctl kern.evdev.rcpt_mask=12"
should be executed if EVDEV_SUPPORT is compiled into kernel.

It is recommended to regenerate bthidd.conf entries with bthidcontrol(8)
"Query" command to set user-friendly names of bluetooth devices.

Reviewed by:	emax, gonzo, wblock (docs), bcr (docs, early version)
Differential Revision:	https://reviews.freebsd.org/D13456
2018-04-30 12:16:54 +00:00

55 lines
928 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: bthidd
# REQUIRE: DAEMON hcsecd
# BEFORE: LOGIN
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="bthidd"
desc="Bluetooth HID daemon"
rcvar="bthidd_enable"
command="/usr/sbin/${name}"
pidfile="/var/run/${name}.pid"
start_precmd="bthidd_prestart"
evdev_enabled()
{
case ${bthidd_evdev_support} in
[Aa][Uu][Tt][Oo])
check_kern_features evdev_support
return $?
;;
*)
checkyesno bthidd_evdev_support
return $?
;;
esac
}
bthidd_prestart()
{
if evdev_enabled; then
load_kld -m uinput uinput
fi
load_kld -m kbdmux kbdmux
load_kld -m vkbd vkbd
load_kld -m ng_btsocket ng_btsocket
return 0
}
load_rc_config $name
config="${bthidd_config:-/etc/bluetooth/${name}.conf}"
hids="${bthidd_hids:-/var/db/${name}.hids}"
command_args="-c ${config} -H ${hids} -p ${pidfile}"
if evdev_enabled; then
command_args="$command_args -u"
fi
required_files="${config}"
run_rc_command "$1"