/files/rival110 (62a7ad36b7d8377733fb9fe21b89cb33333e4c2a) (3483 bytes) (mode 100755) (type blob)
#!/bin/sh
dpi_to_hex()
{
case $2 in
40) eval $1=00;;
80) eval $1=01;;
120) eval $1=02;;
160) eval $1=03;;
200) eval $1=04;;
240) eval $1=05;;
280) eval $1=06;;
320) eval $1=07;;
360) eval $1=08;;
400) eval $1=09;;
440) eval $1=0a;;
480) eval $1=0b;;
520) eval $1=0c;;
560) eval $1=0d;;
600) eval $1=0e;;
640) eval $1=0f;;
680) eval $1=10;;
720) eval $1=11;;
760) eval $1=12;;
800) eval $1=13;;
840) eval $1=14;;
880) eval $1=15;;
920) eval $1=16;;
960) eval $1=17;;
1000) eval $1=18;;
1040) eval $1=19;;
1080) eval $1=1a;;
1160) eval $1=1b;;
1200) eval $1=1c;;
1240) eval $1=1d;;
1280) eval $1=1e;;
1320) eval $1=1f;;
1360) eval $1=20;;
1400) eval $1=21;;
1440) eval $1=22;;
1480) eval $1=23;;
1520) eval $1=24;;
1560) eval $1=25;;
1600) eval $1=26;;
#... can do way more
*)
printf "\nERROR:invalid dpi (40-1600/40 increment)\n"
exit 1
;;
esac
}
effect_to_hex()
{
case $effect in
steady) effect=01;;
slow) effect=02;;
breath) effect=03;;
pulsing) effect=04;;
*)
printf "\nERROR:invalid effect (steady|slow|breath|pulsing)\n"
exit 1
;;
esac
}
# not implemented, because factory default value is ok
# set polling rate in Hz:
# command=04 00
# suffix=00 00 00 00 00 00
# values=
# 125 Hz=04
# 250 Hz=03
# 500 Hz=02
# 1000 Hz=02 (factory default)
#
# not implemented, because no use for it
# button 6 (wheel button) action:
# command=0b
# suffix=00 00 00 00 00 00 00
# values=
# default=00
# os=01
USAGE="Usage: $0 -c color(hex 3 bytes rrggbb) -s1 dpi1(200-7200/100 increment) -s2 dpi2(100-7200/100 increment) -e effect(steady|slow|breath|pulsing) -s"
if test $# -eq 0; then
echo $USAGE
exit 0
fi
# vendor_id=0x1038
# product_id=0x1729
for l in /sys/class/hidraw/*; do
if readlink -f $l | egrep '1038:1729' >/dev/null 2>&1; then
rival110=/dev/$(basename $l)
break
fi
done
if test "${rival110-unset}" = unset; then
echo ERROR:unable to locate a rival110
exit 1
else
echo $rival110
fi
while test $# -ne 0; do
case $1 in
-c)
if test "$2" = ""; then
echo missing rgb_hex
exit 1
fi
rgb_hex=$2
shift 2
;;
-s1)
if test "$2" = ""; then
echo missing sensitivity 1
exit 1
fi
sensitivity_1=$2
shift 2
;;
-s2)
if test "$2" = ""; then
echo missing sensitivity 2
exit 1
fi
sensitivity_2=$2
shift 2
;;
-e)
if test "$2" = ""; then
echo missing effect
exit 1
fi
effect=$2
shift 2
;;
-s)
save=yes
shift
;;
*)
echo ignoring $1
shift
;;
esac
done
# each command is padded to 9 bytes
if test "${rgb_hex-unset}" != unset; then
echo "rgb_hex=$rgb_hex";
cmd_hex=0500${rgb_hex}00000000
fi
if test "${sensitivity_1-unset}" != unset; then
printf "sensitivity_1=$sensitivity_1 dpi"
dpi_to_hex sensitivity_1 $sensitivity_1
echo "/hexcode=$sensitivity_1"
cmd_hex=${cmd_hex}0301${sensitivity_1}000000000000
fi
if test "${sensitivity_2-unset}" != unset; then
printf "sensitivity_2=$sensitivity_2 dpi"
dpi_to_hex sensitivity_2 $sensitivity_2
echo "/hexcode=$sensitivity_2"
cmd_hex=${cmd_hex}0302${sensitivity_2}000000000000
fi
if test "${effect-unset}" != unset; then
printf "effect=$effect"
effect_to_hex
echo "/hexcode=$effect"
cmd_hex=${cmd_hex}0700${effect}000000000000
fi
# must be last for an obvious reason
if test "${save-unset}" != unset; then
echo "****will save settings in mouse persistent memory****"
cmd_hex=${cmd_hex}090000000000000000
fi
printf $cmd_hex | xxd -r -p >$rival110
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
5 |
8eba6c8dd4dcaf6166bd22285ed34625f38a84ff |
.gitignore |
100755 |
blob |
2487 |
533016d4902080b22ae5dc5352802ebdd0d78b16 |
01-x86_64-nyan-linux-gnu.sh |
100755 |
blob |
4254 |
31fdc18cc3e6c6cfd8444fa404f7e82f849bad56 |
02-nyan-cross-core.sh |
100755 |
blob |
3549 |
7f1362bad6786a6818ce7a7d613d0dc11f611fb9 |
03-nyan-cross-x11.sh |
100755 |
blob |
12534 |
f9036d33f9f159ea2421ce1a1ebf7067f0f695c1 |
04-bootstrap-conf.sh |
100755 |
blob |
671 |
5f6bc5de83a883da3a7f0d4a37e1d0ef51c08561 |
10-sdk-conf.sh |
100755 |
blob |
2201 |
83fa9bf5bddbecb88db53779e324b9f270b1080e |
11-sdk.sh |
100755 |
blob |
2826 |
090b622caebd38755ef1e57a9cf0f4f673b22a8e |
12-desktop.sh |
100755 |
blob |
129 |
08460f0dece90701f01cbf7d710609ecbb3d56e0 |
13-beyond.sh |
100644 |
blob |
1075 |
1b5314b511d4c6dc7eb4db36a21dd47ba5a00a9d |
INSTALL |
100644 |
blob |
30 |
c9b735fa1332286f4b3f5f81fa10527fd7506b6e |
LICENSE |
100644 |
blob |
1973 |
6aa180fc473777d9ca6b155cbf9b973065cdd77a |
README |
040000 |
tree |
- |
6e0f97c22efc2294f47faf11de74ead6d18ea1e2 |
builders |
100644 |
blob |
2986 |
43344438bb4d817ff81f1890de1097f627c6d6c4 |
conf.sh |
040000 |
tree |
- |
317962325b26fefabb04d8e26db40eae9e5b8d62 |
files |
100755 |
blob |
351 |
6af534903b47d67a8dcb71653e7a0e1c1a4dfda4 |
pkg-build |
100755 |
blob |
289 |
7f5fbdbb712f274d04a036b9c486cbc9cf581be6 |
pkg-build-target |
100644 |
blob |
915 |
a7f21134dbc05d0e8227eaee366856b8171832a4 |
sdk.sh |
100755 |
blob |
5001 |
ef66a8b35dbba08f4397c2163cf2e7559207783a |
x86.sh |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/nyanlinux
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/nyanlinux
Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/nyanlinux
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main