#!/sbin/openrc-run

supervisor=supervise-daemon
name="Hexagonrpcd SDSP"
description="Daemon to support Qualcomm Hexagon SDSP virtual filesystem"

command=/usr/bin/hexagonrpcd
command_user=fastrpc:fastrpc

# Implement some conf loading heirarchy where the fw path is loaded from these
# locations in order of precedence:
# 1) /etc/conf.d/$RC_SVCNAME
# 2) /usr/share/hexagonrpcd/$RC_SVCNAME".conf
# 3) use default path (/usr/share/qcom)
if [ -z "$hexagonrpcd_fw_dir" ]; then
	# note: /etc/conf.d is sourced automatically by openrc, so if the var is empty
	# here then that conf doesn't exist
	[ -f "/usr/share/hexagonrpcd/$RC_SVCNAME".conf ] && . "/usr/share/hexagonrpcd/$RC_SVCNAME".conf
	hexagonrpcd_fw_dir="${hexagonrpcd_fw_dir:-/usr/share/qcom}"
fi

command_args="-f /dev/fastrpc-sdsp -d sdsp -s -R ${hexagonrpcd_fw_dir}"
