#!/bin/bash

. "${PM_FUNCTIONS}"

quirks="0a5c:219c 0a5c:21bc 413c:8187"

case "$1" in
	hibernate|suspend)
		# known bluetooth devices needing to stop bluetoothd
		for usbid in $quirks; do
			vendor=${usbid%:*}
			product=${usbid#*:}

			DEVS=$(udevadm trigger --verbose --dry-run \
				--attr-match=bDeviceClass=e0 --attr-match=bDeviceProtocol=01 \
				--attr-match=idVendor=$vendor --attr-match=idProduct=$product)
			if [ -n "$DEVS" ]; then
				add_parameters --quirk-bluetooth-service-off
			fi
		done
		;;
	thaw|resume)
		;;
esac
