-
-
Save FNGarvin/09d29f2f901cbcdffc806905ec31b499 to your computer and use it in GitHub Desktop.
Kingston Fury Beast DDR5 RGB controller script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Kingston Fury Beast DDR5 RGB controller script | |
# | |
# Sauce: | |
# https://gitlab.com/CalcProgrammer1/OpenRGB/-/issues/2879#note_1336953263 | |
# | |
# Supports only static colors. | |
# | |
# Usage examples: | |
# | |
# sudo ./rgbram.sh ff 00 00 # red | |
# sudo ./rgbram.sh 00 ff ff # cyan | |
# sudo ./rgbram.sh 00 00 00 # lights out | |
if [ 4 -ne $# ]; then | |
echo "usage: $0 [i2c BUS] [r] [g] [b]" | |
echo "use [sudo] i2cdetect -l to find the bus number" | |
echo "eg, [sudo] $0 7 00 ff ff for cyan" | |
exit 2 | |
fi | |
#work on AMD | |
if ! [ "$(i2cdetect -l | grep 'I801\|PIIX4')" ]; then | |
echo "Intel I801/PIIX4 not detected!" | |
exit 2 | |
fi | |
# from 0 to 0x63 | |
brightness=0x2 | |
#assumption, but it might be reasonable | |
ramstick1=0x61 | |
ramstick2=0x63 | |
#afaik, there might be multiple I801 lines (at least one for each daisy-chain?) | |
#certainly true for PIIX4 | |
#i2cbus=$(i2cdetect -l | grep I801 | awk '{ print $1 }' | sed 's/i2c-//') | |
#i2cbusdet=$(i2cdetect -l | grep I801) | |
i2cbus=$1 | |
if [ "$(i2cdetect -y $i2cbus | grep '60: -- 61 -- 63')" ]; then | |
#bank switch | |
i2cset -y $i2cbus 0x51 0x0b 0x04 | |
#look for KF5 code that all Kingston Fury DDR5 should have | |
if [ "$(i2cdump -y $i2cbus 0x51 b | grep "^80:.*KF5....$")" ]; then | |
#decided I prefer less verbosity | |
true | |
# echo "Found Kingston Fury DDR5 RAM" | |
else | |
echo "Failed to detect Kingston Fury DDR5 RAM in slot 2 and 4" | |
exit 2 | |
fi | |
else | |
echo "Failed to detect any RAM in slot 2 and 4" | |
exit 2 | |
fi | |
if ! [[ $2 =~ ^[0-9a-fA-F]{2}$ ]]; then | |
echo "$2 is not a valid octet hex value" | |
exit 1 | |
fi | |
red=$2 | |
if ! [[ $3 =~ ^[0-9a-fA-F]{2}$ ]]; then | |
echo "$3 is not a valid octet hex value" | |
exit 1 | |
fi | |
green=$3 | |
if ! [[ $4 =~ ^[0-9a-fA-F]{2}$ ]]; then | |
echo "$4 is not a valid octet hex value" | |
exit 1 | |
fi | |
blue=$4 | |
#echo "Detected bus: $i2cbusdet" | |
#decided I prefer silent operation | |
#echo -e "Setting up color value of #$red$green$blue\n" | |
# ram stick 1 | |
i2cset -y $i2cbus $ramstick1 0x08 0x53 | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x09 0x00 | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x31 0x$red | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x32 0x$green | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x33 0x$blue | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x20 $brightness | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick1 0x08 0x44 | |
# ram stick 2 | |
i2cset -y $i2cbus $ramstick2 0x08 0x53 | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x09 0x00 | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x31 0x$red | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x32 0x$green | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x33 0x$blue | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x20 $brightness | |
sleep 0.020 | |
i2cset -y $i2cbus $ramstick2 0x08 0x44 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, my particular combination of hardware only seems to support reading and writing bytes. So none of the RGB software I've used on Linux works except for the source of this gist, which I have slightly modified to support AMD and to do a few cursory checks before writing data that could potentially brick your computer. Not to say it can't still brick your computer, though... gl.