Files
libgphoto2/packaging/generic/check-ptp-camera
Marcus Meissner 6062efd7fb run with bash, since it uses bashisms
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@10003 67ed7778-7388-44ab-90cf-0a291f65f57c
2007-02-14 10:03:28 +00:00

21 lines
497 B
Bash

#!/bin/bash
# check if any interface of this device is a PTP camera interface (06)
INTERFACE="${1:-06/01/01}"
BASENAME=${PHYSDEVPATH##*/}
for d in /sys/${PHYSDEVPATH}/${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