#!/bin/bash
 
# check if any interface of this device is a PTP camera interface (06)
INTERFACE="${1:-06/01/01}"

BASENAME=${DEVPATH##*/}
for d in /sys/${DEVPATH}/${BASENAME}:*; do
	[[ -d ${d} ]] || continue
	INTERFACEID="$(< ${d}/bInterfaceClass)"
	INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceSubClass)"
	INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceProtocol)"

	#echo ${d}: ${INTERFACEID}
	if [[ ${INTERFACE} == ${INTERFACEID} ]]; then
		# Found interface
		exit 0
	fi
done
 
exit 1
