blob: 2e44479f69cf21ee66c8a41c2cd51582de300972 [file] [log] [blame]
George Hungb67a01a2020-06-30 10:47:30 +08001#!/bin/bash
2
3MARGIN_TABLE_FILE="/usr/share/read-margin-temp/config-margin.json"
4
5target_num="$(cat $MARGIN_TABLE_FILE | grep '"target"' | wc -l)"
6
7cpu_hwmon="$(ls -la /sys/class/hwmon | grep f0082000 | head -n 1 | tail -n +1 | cut -d '/' -f 11)"
8
9# replace by the real cpu temperature hwmon path in runtime
10if [[ "$cpu_hwmon" != "" ]]
11then
12 sed -i "s/cpu_hwmon/$cpu_hwmon/g" $MARGIN_TABLE_FILE
13fi
14
15# wait target dbus
16for ((i=0; i<$target_num; i++))
17do
18 line_num=$((i+1))
19 path="$(cat $MARGIN_TABLE_FILE | grep '"target"' | head -n ${line_num} | tail -n +${line_num} | cut -d '"' -f 4)"
20 mapper wait $path
21done
22
23# start read margin temp
24/usr/bin/read-margin-temp &
25
26exit 0