#!/usr/bin/bash

stck=$1
shift
# jscal -q /dev/input/$stck|sed 's/,/ /g'|sed 's/-u/=/g'|cut -d= -f2

set $* `jscal -q /dev/input/$stck|sed 's/,/ /g'|sed 's/-u/=/g'|cut -d= -f2`

axc=$1
shift
c=0
axes=""
while [ $c -ne $axc ]
do
axes=$axes:"$1"
shift 1
c=$(( $c + 1 ))
done
 printf axes$axes
btnc=$1
shift

c=0
btns=""
while [ $c -ne $btnc ]
do
btns=$btns:"$1"
shift 1
c=$(( $c + 1 ))
done
printf :btns$btns
# echo device $1
