/usr/bin/jscal-store is in joystick 1:1.4.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/bin/sh
# Stores the current calibration settings for the given joystick
# (materialized by its device). The calibration settings are stored
# using the joystick's name and serial number if available, and its
# vendor and product codes if it's a USB device. If none of these can
# be determined, the settings are stored against the device name.
if [ -z "$1" ]; then
echo "Usage: $0 {device}"
echo "Stores the device's calibration for future use."
exit 1
fi
if [ ! -x /sbin/udevadm ]; then
echo Storing joystick configuration requires udev! >&2
exit 1
fi
ident=$(mktemp)
/sbin/udevadm info -a -n $1 | /usr/share/joystick/ident > $ident
. $ident
rm $ident
STORE=/var/lib/joystick/joystick.state
if [ ! -d $(dirname $STORE) ]; then
mkdir -p $(dirname $STORE)
if [ $? -gt 0 ]; then
echo Unable to create directory $(dirname $STORE)! >&2
exit 1
fi
fi
# Filter the existing file
if [ -f $STORE ]; then
if [ -z "$NAME" ] && [ -z "$VENDOR" ]; then
echo "No product name or vendor available, calibration will be stored for the"
echo "given device name ($DEVICE) only!"
/usr/share/joystick/filter kernel="$DEVICE" < $STORE > $STORE.new
else
/usr/share/joystick/filter name="$NAME" serial="$SERIAL" vendor="$VENDOR" product="$PRODUCT" < $STORE > $STORE.new
fi
fi
# Append the new calibration information
if [ -f $STORE.new ] && [ ! -z "$(cat $STORE.new)" ]; then
echo >> $STORE.new
fi
if [ -z "$NAME" ] && [ -z "$VENDOR" ]; then
echo "DEVICE=\"$DEVICE\"" >> $STORE.new
fi
if [ ! -z "$NAME" ]; then
echo "NAME=\"$NAME\"" >> $STORE.new
fi
if [ ! -z "$SERIAL" ]; then
echo "SERIAL=\"$SERIAL\"" >> $STORE.new
fi
if [ ! -z "$VENDOR" ]; then
echo "VENDOR=\"$VENDOR\"" >> $STORE.new
fi
if [ ! -z "$PRODUCT" ]; then
echo "PRODUCT=\"$PRODUCT\"" >> $STORE.new
fi
# First store the axes mapping, then the calibration
# as they must be restored in the same order
jscal -q $1 | cut -d' ' -f-3 >> $STORE.new
jscal -p $1 | cut -d' ' -f-3 >> $STORE.new
if [ -f $STORE ]; then
mv $STORE $STORE.old
fi
mv $STORE.new $STORE
rm -f $STORE.old
|