# Newer Qualcomm devices need firmware files for HexagonFS.
# Symlink the firmware files if a sensor registry exists.
if [ -d "$BASEDIR"/mnt/persist/sensors/registry/registry ]
then
	# Set up the hexagonrpcd firmware directory
	HEXAGONFS_BASE="/usr/share/qcom"
	mkdir -p "$HEXAGONFS_BASE"
	mount -o mode=755,nodev,noexec,nosuid -t tmpfs none "$HEXAGONFS_BASE"

	mkdir "$HEXAGONFS_BASE"/sensors

	ln -s "$BASEDIR"/mnt/vendor/etc/acdbdata "$HEXAGONFS_BASE"/acdb

	# Some devices have a dsp partition, others have /vendor/dsp.
	# The ones with dsp partition have a mount point for it at /vendor/dsp, but
	# we don't mount it there, so we need to fall back to /vendor/dsp.
	if [ -d "$BASEDIR"/mnt/dsp ]
	then
		ln -s "$BASEDIR"/mnt/dsp "$HEXAGONFS_BASE"/dsp
	else
		ln -s "$BASEDIR"/mnt/vendor/dsp "$HEXAGONFS_BASE"/dsp
	fi

	ln -s "$BASEDIR"/mnt/vendor/etc/sensors/config "$HEXAGONFS_BASE"/sensors/config

	ln -s "$BASEDIR"/mnt/persist/sensors/registry/registry "$HEXAGONFS_BASE"/sensors/registry

	ln -s "$BASEDIR"/mnt/vendor/etc/sensors/sns_reg_config "$HEXAGONFS_BASE"/sensors/sns_reg.conf
fi
