#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024-present ArchR (https://github.com/archr-linux/Arch-R)

###
### LED Control now redirects to the quirk device or platform /bin/analog_sticks_ledcontrol
### so we don't need to have multiple variants in /usr/bin.
###

if [ -z "${QUIRK_DEVICE}" ] || [ -z "${HW_DEVICE}" ]; then
  . /etc/profile
fi

if [ -f "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/analog_sticks_ledcontrol" ]; then
  exec "/usr/lib/autostart/quirks/devices/${QUIRK_DEVICE}/bin/analog_sticks_ledcontrol" $*
elif [ -f "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/analog_sticks_ledcontrol" ]; then
  exec "/usr/lib/autostart/quirks/platforms/${HW_DEVICE}/bin/analog_sticks_ledcontrol" $*
fi
