2022-02-05 14:23:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-02-17 23:47:10 +00:00
|
|
|
source /etc/profile
|
2022-02-05 14:23:32 +00:00
|
|
|
|
2023-07-17 22:01:09 +00:00
|
|
|
### Apply device quirks
|
2023-06-02 20:58:46 +00:00
|
|
|
if [ -e "/sys/firmware/devicetree/base/model" ]
|
|
|
|
then
|
2023-07-17 22:01:09 +00:00
|
|
|
export QUIRK_DEVICE="$(tr -d '\0' </sys/firmware/devicetree/base/model 2>/dev/null)"
|
2023-06-02 20:58:46 +00:00
|
|
|
else
|
2023-07-17 22:01:09 +00:00
|
|
|
export QUIRK_DEVICE="$(tr -d '\0' </sys/class/dmi/id/sys_vendor 2>/dev/null) $(tr -d '\0' </sys/class/dmi/id/product_name 2>/dev/null)"
|
2023-06-02 20:58:46 +00:00
|
|
|
fi
|
2023-07-17 22:01:09 +00:00
|
|
|
export QUIRK_DEVICE="$(echo ${QUIRK_DEVICE} | sed -e "s#[/]#-#g")"
|
2023-06-02 20:58:46 +00:00
|
|
|
|
|
|
|
info_quirks() {
|
2023-07-25 21:06:19 +00:00
|
|
|
for QUIRK in /usr/lib/autostart/quirks/platforms/"${HW_DEVICE}"/info.d/${1}/* \
|
|
|
|
/usr/lib/autostart/quirks/devices/"${QUIRK_DEVICE}"/info.d/${1}/*
|
2023-06-02 20:58:46 +00:00
|
|
|
do
|
|
|
|
"${QUIRK}" 2>/dev/null
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
### short version (for osd)
|
|
|
|
if test "$1" = "--short"
|
|
|
|
then
|
2023-08-05 02:00:47 +00:00
|
|
|
BATT=$(awk 'BEGIN {FS="="} /POWER_SUPPLY_CAPACITY=/ {print $2; exit}' /sys/class/power_supply/{BAT,bat}*/uevent 2>/dev/null)
|
2022-02-05 14:23:32 +00:00
|
|
|
DT=$(date +%H:%M)
|
|
|
|
if test -n "${BATT}"
|
|
|
|
then
|
|
|
|
echo "Battery: ${BATT}% - ${DT}"
|
|
|
|
else
|
|
|
|
echo "${DT}"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
###
|
|
|
|
|
2022-02-12 03:40:39 +00:00
|
|
|
V_CPUNB=$(grep -E $'^processor\t:' /proc/cpuinfo | wc -l)
|
2022-02-05 14:23:32 +00:00
|
|
|
V_CPUMODEL1=$(grep -E $'^model name\t:' /proc/cpuinfo | head -1 | sed -e s+'^model name\t: '++)
|
|
|
|
V_SYSTEM=$(uname -rs)
|
|
|
|
V_ARCH=$(uname -m)
|
|
|
|
|
|
|
|
[[ "$V_CPUMODEL1" ]] || V_CPUMODEL1="${HW_CPU}"
|
|
|
|
|
|
|
|
# battery
|
2023-08-05 02:00:47 +00:00
|
|
|
BATT=$(awk 'BEGIN {FS="="} /POWER_SUPPLY_CAPACITY=/ {print $2; exit}' /sys/class/power_supply/{BAT,bat}*/uevent 2>/dev/null)
|
2022-02-07 01:19:44 +00:00
|
|
|
|
2023-01-03 11:14:42 +00:00
|
|
|
case ${HW_ARCH} in
|
|
|
|
aarch64)
|
|
|
|
declare -a CF MF
|
|
|
|
|
|
|
|
CNTR=0
|
|
|
|
for CPUFREQ in /sys/devices/system/cpu/cpufreq/*
|
|
|
|
do
|
|
|
|
if [[ "${CPUFREQ}" =~ boost ]]
|
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if [ "${CNTR}" -eq 0 ]
|
|
|
|
then
|
|
|
|
CF+=("CURRENT FREQUENCY:")
|
|
|
|
MF+=("MAXIMUM FREQUENCY:")
|
|
|
|
fi
|
2023-07-17 22:01:09 +00:00
|
|
|
RELCPUS=$(cat ${CPUFREQ}/related_cpus 2>/dev/null)
|
2023-01-03 11:14:42 +00:00
|
|
|
if [ "${#RELCPUS}" -gt 1 ]
|
|
|
|
then
|
|
|
|
FIELD="$(cat ${CPUFREQ}/related_cpus 2>/dev/null | awk '{print $1"-"$NF}')"
|
|
|
|
else
|
2023-07-17 22:01:09 +00:00
|
|
|
FIELD="$(cat ${CPUFREQ}/related_cpus 2>/dev/null)"
|
2023-01-03 11:14:42 +00:00
|
|
|
fi
|
2023-07-17 22:01:09 +00:00
|
|
|
CF+=("THREADS ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_cur_freq 2>/dev/null | sort | tail -n 1) / 1000))MHz")
|
|
|
|
MF+=("THREADS ${FIELD}: $(( $(cat ${CPUFREQ}/scaling_max_freq 2>/dev/null | sort | tail -n 1) / 1000))MHz")
|
2023-01-03 11:14:42 +00:00
|
|
|
CNTR=$(( CNTR + 1 ))
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
2022-02-07 01:19:44 +00:00
|
|
|
|
2022-02-05 14:23:32 +00:00
|
|
|
# temperature
|
|
|
|
# Unit: millidegree Celsius
|
2023-02-22 21:54:01 +00:00
|
|
|
if [ -e "${DEVICE_TEMP_SENSOR}" ]
|
|
|
|
then
|
|
|
|
TEMPE=$(cat ${DEVICE_TEMP_SENSOR} 2>/dev/null | sort -rn | head -1 | sed -e s+"[0-9][0-9][0-9]$"++)
|
|
|
|
fi
|
2022-02-09 01:27:20 +00:00
|
|
|
echo "SYSTEM INFORMATION:"
|
2023-07-17 22:01:09 +00:00
|
|
|
echo "DEVICE: ${QUIRK_DEVICE}"
|
2022-02-07 03:07:43 +00:00
|
|
|
echo "OPERATING SYSTEM: ${OS_NAME}"
|
2022-02-09 01:27:20 +00:00
|
|
|
echo "VERSION: ${OS_VERSION}"
|
2022-04-12 20:42:13 +00:00
|
|
|
echo "BUILD ID: ${BUILD_ID:0:7} (${BUILD_BRANCH})"
|
2022-07-11 23:35:08 +00:00
|
|
|
echo "KERNEL: ${V_SYSTEM} ($(uname -m))"
|
2022-02-09 01:27:20 +00:00
|
|
|
echo "DISK SPACE:"
|
|
|
|
echo "/storage: $(df -h /storage | awk '/dev/ {print $3"/"$2" ("$5")"}')"
|
|
|
|
echo "/storage/roms: $(df -h /storage/roms | awk '/dev/ {print $3"/"$2" ("$5")"}')"
|
|
|
|
|
2022-02-07 03:07:43 +00:00
|
|
|
if test -n "${BATT}"
|
|
|
|
then
|
2022-07-11 23:35:08 +00:00
|
|
|
echo "BATTERY INFORMATION:"
|
2022-02-07 03:07:43 +00:00
|
|
|
echo "BATTERY REMAINING: ${BATT}%"
|
2022-09-01 21:17:36 +00:00
|
|
|
BATPATH="/sys/class/power_supply/$(ls /sys/class/power_supply/ | grep -i bat | tail -n 1)"
|
|
|
|
if [ -e "${BATPATH}/health" ]
|
2022-02-09 01:27:20 +00:00
|
|
|
then
|
2022-09-01 21:17:36 +00:00
|
|
|
echo "BATTERY HEALTH: $(cat ${BATPATH}/health)"
|
2022-02-09 01:27:20 +00:00
|
|
|
fi
|
2022-09-01 21:17:36 +00:00
|
|
|
if [ -e "${BATPATH}/status" ]
|
2022-02-09 01:27:20 +00:00
|
|
|
then
|
2022-09-01 21:17:36 +00:00
|
|
|
echo "BATTERY STATE: $(cat ${BATPATH}/status)"
|
2022-02-09 01:27:20 +00:00
|
|
|
fi
|
2022-02-07 03:07:43 +00:00
|
|
|
fi
|
2022-02-09 01:27:20 +00:00
|
|
|
echo "CPU INFORMATION:"
|
2022-02-12 03:40:39 +00:00
|
|
|
echo "CPU: ${V_CPUMODEL1} (${V_CPUNB} Cores)"
|
2022-02-07 01:35:15 +00:00
|
|
|
if test -n "${TEMPE}"
|
|
|
|
then
|
|
|
|
echo "CPU TEMPERATURE: ${TEMPE}°"
|
|
|
|
fi
|
2022-02-17 23:47:10 +00:00
|
|
|
if [ "${DEVICE_HAS_FAN}" = "true" ]
|
|
|
|
then
|
2023-01-02 20:12:49 +00:00
|
|
|
FANSPEED=$(cat ${DEVICE_PWM_FAN} 2>/dev/null)
|
2022-02-17 23:47:10 +00:00
|
|
|
if [ "${FANSPEED}" = "0" ]
|
|
|
|
then
|
|
|
|
FANSPEED="OFF"
|
|
|
|
else
|
|
|
|
FANSPEED="${FANSPEED} RPM"
|
|
|
|
fi
|
|
|
|
echo "CPU FAN: ${FANSPEED}"
|
|
|
|
fi
|
2023-01-03 11:14:42 +00:00
|
|
|
case ${HW_ARCH} in
|
|
|
|
aarch64)
|
|
|
|
for C in "${CF[@]}"
|
|
|
|
do
|
|
|
|
echo ${C}
|
|
|
|
done
|
|
|
|
for M in "${MF[@]}"
|
|
|
|
do
|
|
|
|
echo ${M}
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
2023-06-02 20:58:46 +00:00
|
|
|
|
|
|
|
info_quirks
|