summaryrefslogtreecommitdiff
path: root/thermal
diff options
context:
space:
mode:
authorTeYuan Wang <kamewang@google.com>2020-05-05 20:00:07 +0800
committerWei Wang <wvw@google.com>2020-09-23 19:48:56 +0000
commit753d11ad6dbe1540c41e8145d41dad8b3433de04 (patch)
treeb1b8c9f3f909dc9f0056c17d50f45797f842382c /thermal
parenta4f1aadead3a4504849cc757730769199debdeee (diff)
downloadpixel-753d11ad6dbe1540c41e8145d41dad8b3433de04.tar.gz
thermal: create thermal symlinks in dev folder
Bug: 169261083 Test: thermal symlinks can be created in dev folder Change-Id: If813ecae4338385f8a1051ac235f471908d5018c Signed-off-by: TeYuan Wang <kamewang@google.com>
Diffstat (limited to 'thermal')
-rw-r--r--thermal/Android.bp9
-rw-r--r--thermal/device.mk1
-rwxr-xr-xthermal/init.thermal.symlinks.sh13
-rw-r--r--thermal/pixel-thermal-symlinks.rc11
4 files changed, 34 insertions, 0 deletions
diff --git a/thermal/Android.bp b/thermal/Android.bp
index a3055211..f67c1f36 100644
--- a/thermal/Android.bp
+++ b/thermal/Android.bp
@@ -54,3 +54,12 @@ sh_binary {
"pixel-thermal-logd.rc",
],
}
+
+sh_binary {
+ name: "thermal_symlinks",
+ src: "init.thermal.symlinks.sh",
+ vendor: true,
+ init_rc: [
+ "pixel-thermal-symlinks.rc",
+ ],
+}
diff --git a/thermal/device.mk b/thermal/device.mk
index a2d68a37..d3166338 100644
--- a/thermal/device.mk
+++ b/thermal/device.mk
@@ -1,6 +1,7 @@
# Thermal HAL
PRODUCT_PACKAGES += \
android.hardware.thermal@2.0-service.pixel \
+ thermal_symlinks
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += \
diff --git a/thermal/init.thermal.symlinks.sh b/thermal/init.thermal.symlinks.sh
new file mode 100755
index 00000000..d990897b
--- /dev/null
+++ b/thermal/init.thermal.symlinks.sh
@@ -0,0 +1,13 @@
+#!/vendor/bin/sh
+
+for f in /sys/class/thermal/thermal_zone*
+do
+ tz_name=`cat $f/type`
+ ln -s $f /dev/thermal/tz-by-name/$tz_name
+done
+for f in /sys/class/thermal/cooling_device*
+do
+ cdev_name=`cat $f/type`
+ ln -s $f /dev/thermal/cdev-by-name/$cdev_name
+done
+setprop vendor.thermal.link_ready 1
diff --git a/thermal/pixel-thermal-symlinks.rc b/thermal/pixel-thermal-symlinks.rc
new file mode 100644
index 00000000..99e11854
--- /dev/null
+++ b/thermal/pixel-thermal-symlinks.rc
@@ -0,0 +1,11 @@
+on early-boot
+ mkdir /dev/thermal 0777 system system
+ mkdir /dev/thermal/tz-by-name 0777 system system
+ mkdir /dev/thermal/cdev-by-name 0777 system system
+ start vendor.thermal.symlinks
+
+service vendor.thermal.symlinks /vendor/bin/thermal_symlinks
+ class hal
+ user system
+ group system
+ oneshot