/files/rival3 (ada70b9684a3308936ba1d9537588c9fadacca33) (4043 bytes) (mode 100755) (type blob)
#!/bin/sh
effects='rainbow-shift|breath-fast|breath|breath-slow|steady|rainbow-breath|disco'
effect_to_hex()
{
case $effect in
rainbow-shift) effect=00;;
breath-fast) effect=01;;
breath) effect=02;;
breath-slow) effect=03;;
steady) effect=04;;
rainbow-breath) effect=05;;
disco) effect=06;;
*)
printf "\nERROR:invalid effect ($effects)\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=01 (factory default)
USAGE="Usage: $0 -z1 color(hex 3 bytes rrggbb) -z2 color(hex 3 bytes rrggbb) -z3 color(hex 3 bytes rrggbb) -logo color(hex 3 bytes rrggbb) -s dpi1,dpi2,dpi3,dpi4,dpi5(40-8500/40 increment) -e effect($effects) -save"
if test $# -eq 0; then
echo $USAGE
exit 0
fi
# vendor_id=0x1038
# product_id=0x1824
# product_id=0x182c, firmware v0.37.0.0
# endpoint index 3 (there are 4 endpoints)
endpoint=0
for l in /sys/class/hidraw/*; do
if readlink -f $l | egrep '1038:1824' >/dev/null 2>&1; then
if test $endpoint -eq 3; then
rival3=/dev/$(basename $l)
break
fi
endpoint=$(($endpoint + 1))
elif readlink -f $l | egrep -i '1038:182c' >/dev/null 2>&1; then
if test $endpoint -eq 3; then
rival3=/dev/$(basename $l)
break
fi
endpoint=$(($endpoint + 1))
fi
done
if test "${rival3-unset}" = unset; then
echo ERROR:unable to locate a rival3
exit 1
else
echo $rival3
fi
while test $# -ne 0; do
case $1 in
-z1)
if test "$2" = ""; then
echo missing rgb_hex
exit 1
fi
rgb_hex_z1=$2
shift 2
;;
-z2)
if test "$2" = ""; then
echo missing rgb_hex
exit 1
fi
rgb_hex_z2=$2
shift 2
;;
-z3)
if test "$2" = ""; then
echo missing rgb_hex
exit 1
fi
rgb_hex_z3=$2
shift 2
;;
-logo)
if test "$2" = ""; then
echo missing rgb_hex
exit 1
fi
rgb_hex_logo=$2
shift 2
;;
-s)
if test "$2" = ""; then
echo missing sensitivities
exit 1
fi
sensitivities=$2
shift 2
;;
-e)
if test "$2" = ""; then
echo missing effect
exit 1
fi
effect=$2
shift 2
;;
-save)
save=yes
shift
;;
*)
echo ignoring $1
shift
;;
esac
done
# each command is padded to 9 bytes
if test "${rgb_hex_z1-unset}" != unset; then
echo "rgb_hex_z1=$rgb_hex_z1";
cmd_hex=050001${rgb_hex_z1}64
fi
if test "${rgb_hex_z2-unset}" != unset; then
echo "rgb_hex_z2=$rgb_hex_z2";
cmd_hex=050002${rgb_hex_z2}64
fi
if test "${rgb_hex_z3-unset}" != unset; then
echo "rgb_hex_z3=$rgb_hex_z3";
cmd_hex=050003${rgb_hex_z3}64
fi
if test "${rgb_hex_logo-unset}" != unset; then
echo "rgb_hex_logo=$rgb_hex_logo";
cmd_hex=0500004${rgb_hex_logo}64
fi
if test "${sensitivities-unset}" != unset; then
printf "sensitivities = $sensitivities"
IFS_SAVED="$IFS"
IFS=','
dpi_n=0
sensitivities_rounded="/rounded_to ="
for dpi in $sensitivities
do
dpi_step=$(printf "$dpi/40" | bc)
dpi_rounded=$(printf "$dpi_step * 40" | bc)
sensitivities_rounded="${sensitivities_rounded} ${dpi_rounded}"
if test $dpi_rounded -lt 40; then
printf "\n$dpi_rounded from $dpi is below 40\n"
exit
fi
if test $dpi_rounded -gt 8500; then
printf "\n$dpi_rounded from $dpi is above 8500\n"
exit
fi
output=$(($dpi_step - 1))
output_hex=$(printf "%02x" $output)
sensitivities_hex="${sensitivities_hex}$output_hex"
dpi_n=$(printf "%02x" $(($dpi_n + 1)))
done
IFS="$IFS_SAVED"
printf "$sensitivities_rounded"
if test $dpi_n -gt 5; then
printf "\ndpi preset count is above 5\n"
exit
fi
echo "/hexcode = ${dpi_n}${sensitivities_hex}"
cmd_hex=${cmd_hex}0b00${dpi_n}01${sensitivities_hex}
fi
if test "${effect-unset}" != unset; then
printf "effect=$effect"
effect_to_hex
echo "/hexcode=$effect"
cmd_hex=${cmd_hex}0600${effect}
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}0900
fi
printf "00:$cmd_hex\n" | xxd -r >$rival3
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
5 |
8eba6c8dd4dcaf6166bd22285ed34625f38a84ff |
.gitignore |
100755 |
blob |
1587 |
57fa4264b9ee0ae0a6f678f2527a05d3b22dda78 |
00-bootstrap-build.sh |
100755 |
blob |
848 |
a30f443bf405d56682efe3b4c5d3a19d5f7eb45d |
01-re-bootstrap-build.sh |
100644 |
blob |
2142 |
f19c2d6b293244bb11a3f74ee77c10675cadc7d6 |
INSTALL |
100644 |
blob |
30 |
c9b735fa1332286f4b3f5f81fa10527fd7506b6e |
LICENSE |
040000 |
tree |
- |
206d6a23693cdd25c4309f53d5017899c0668d34 |
builders |
100644 |
blob |
1773 |
ef1551089a803bde37e36edc8d61bb819d06f793 |
conf.bootstrap.sh |
100644 |
blob |
479 |
8cc15efe46965ac7750fe304460f5a2b0aa4201c |
conf.sh |
040000 |
tree |
- |
90a6c62877b0c53ac1007d8dd55422cacb39ef99 |
files |
100755 |
blob |
333 |
06859f922e41c1e691c72ada1be3f981ef05f602 |
pkg-build |
100644 |
blob |
22800641 |
e9e6291054c857401f6835c728f31541dae4311e |
steam.tar.bz2 |
100644 |
blob |
173 |
2047af328b22f9d146585cd9e759edbc18122250 |
utils.sh |
040000 |
tree |
- |
b7a22de7f5cbd97650dd45412ef7d4246e395eb8 |
x86 |
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