-
Notifications
You must be signed in to change notification settings - Fork 80
shell script to launch g13d with a .bind file
Vangamar edited this page Apr 28, 2016
·
2 revisions
This shell script automates running g13d from the command line and passing in a given .bind file.
WARNING: It might not be the best way, but I just do a sudo chmod +w on a couple usb/input device folders, so that I can run g13d as normal user vs. root.
If you disagree with this approach, delete the two sudo chmod lines, or never use this script, or edit this script to show a better way - this way works, though ;-)
#!/bin/bash
if [ ! -s "./g13d" ] ; then
echo "ERROR:"
echo " Make a sym link to this shell script in the appropriate"
echo " distro sub-dir, then run the sym link from that sub-dir."
echo "EXAMPLE:"
echo " cd Ubuntu15.10 ; ln -s ../load_bind.sh"
exit 1;
fi
if [ "$1" == "" ] ; then
echo "ERROR:"
echo " Enter the G13 Bind File as an argument."
exit 1
fi
if [ -s "$1" ] ; then bindFile="$1"
elif [ -s "$1.bind" ] ; then bindFile="$1.bind"
elif [ -s "../$1" ] ; then bindFile="../$1"
elif [ -s "../$1.bind" ] ; then bindFile="../$1.bind"
else
echo "ERROR:"
echo " The G13 Bind File: \"$1\" does not exist"
exit 1
fi
# Fixes no write access to usb device
sudo chmod a+rw -R /dev/bus/usb/*
sudo chmod a+rw /dev/uinput
# works but prints messier output
#./g13d --config "$bindFile"
# cleaner output than passing in via '--config' above
# This /tmp config file is read in by g13d at startup
cat "$bindFile" > /tmp/g13-0
./g13d