Thanks to the lead suggested by DBMandrake, I got an APDS-9960 gesture sensor working as a controller for a Raspberry Pi 2-driven slideshow – in my case, a digital art frame (in which the Pi is hidden behind an HD monitor, which hangs on the wall).
xbmc-send provides all the functionality I need to intercept the six gestures generated by the sensor (using code generously provided by Justin Woodman) and turn them into Kodi commands for OSMC. Here is the script I wrote, which I run from /etc/rc.local on boot:
#! /bin/bash
ROOT_UID=0 # Only users with $UID 0 have root privileges.
E_NOTROOT=67 # Non-root exit error.
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script."
exit $E_NOTROOT
fi
./GestureTest | {
while read command
do
echo $command
case "$command" in
UP ) action=BACK;;
DOWN ) action=SELECT;;
LEFT ) action=LEFT;;
RIGHT ) action=RIGHT;;
FAR ) action="RecursiveSlideShow(/home/osmc/Pictures/Art)";;
NEAR ) action=SHUTDOWN;;
NONE ) action="Notification('ALERT','Unrecognized gesture.',2000)"
action="Notification('ALERT','Valid gestures are swipes L/R/U (sends BACK), and D (SELECT)...',5000)"
action="Notification('ALERT','Also push in & pull out (START SLIDESHOW); push in & move left (SHUTDOWN).',5000)"
;;
* ) action=NULL;;
esac
xbmc-send --action="$action"
done
}
exit 0