#!/bin/bash

if [ "$#" -ne 3 ]; then
    echo "Usage: ./dimm_led_test.sh <CPU> <LETTER> <LED_STATE>"
    echo "CPU: 0~1"
    echo "LETTER: A~L"
    echo "LED_STATE: ON, FAULT, OFF, NA"
    echo "Example: ./dimm_led_test.sh 0 A ON"
    exit 1
fi

CPU=\$1
LETTER=\$2
LED_STATE=\$3

BASE_COMMAND="busctl set-property xyz.openbmc_project.DIMMTempSensor"

COMMAND="${BASE_COMMAND} /xyz/openbmc_project/sensors/temperature/DIMM_CPU${CPU}_${LETTER}_Temp xyz.openbmc_project.Sensor.dimmLED LEDState s \"${LED_STATE}\""

echo "Executing: $COMMAND at $(date)"

eval $COMMAND
