pstar: add initial device specific rootdir

This commit is contained in:
SGCMarkus 2022-02-17 10:22:49 +01:00
parent 39edadedcd
commit cb1aae3e9d
5 changed files with 445 additions and 0 deletions

View File

@ -30,6 +30,14 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/audio/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \ $(LOCAL_PATH)/audio/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
$(LOCAL_PATH)/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml $(LOCAL_PATH)/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml
# Init
$(foreach f,$(wildcard $(COMMON_PATH)/rootdir/etc/init/hw/*.rc),\
$(eval PRODUCT_COPY_FILES += $(f):$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/$(notdir $f)))
$(foreach f,$(wildcard $(COMMON_PATH)/rootdir/etc/init/*.rc),\
$(eval PRODUCT_COPY_FILES += $(f):$(TARGET_COPY_OUT_VENDOR)/etc/init/$(notdir $f)))
$(foreach f,$(wildcard $(COMMON_PATH)/rootdir/bin/*.sh),\
$(eval PRODUCT_COPY_FILES += $(f):$(TARGET_COPY_OUT_VENDOR)/bin/$(notdir $f)))
# Media # Media
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/media/media_profiles_kona.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_kona.xml \ $(LOCAL_PATH)/media/media_profiles_kona.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_kona.xml \

View File

@ -0,0 +1,84 @@
#!/vendor/bin/sh
#
# Identify fingerprint sensor model
#
# Copyright (c) 2019 Lenovo
# All rights reserved.
#
# Changed Log:
# ---------------------------------
# April 15, 2019 chengql2@lenovo.com Initial version
# April 28, 2019 chengql2 Add fps_id creating step
# December 2, 2019 chengql2 Store fps_id into persist fs, and identify sensor
# again when secure unit boots as factory mode.
script_name=${0##*/}
script_name=${script_name%.*}
function log {
echo "$script_name: $*" > /dev/kmsg
}
persist_fps_id=/mnt/vendor/persist/fps/vendor_id
FPS_VENDOR_GOODIX=goodix
FPS_VENDOR_FPC=fpc
FPS_VENDOR_NONE=none
PROP_FPS_IDENT=vendor.hw.fps.ident
MAX_TIMES=20
function ident_fps {
log "- install FPC driver"
insmod /vendor/lib/modules/fpc1020_mmi.ko
sleep 1
log "- identify FPC sensor"
setprop $PROP_FPS_IDENT ""
start fpc_ident
for i in $(seq 1 $MAX_TIMES)
do
sleep 0.1
ident_status=$(getprop $PROP_FPS_IDENT)
log "-result : $ident_status"
if [ $ident_status == $FPS_VENDOR_FPC ]; then
log "ok"
echo $FPS_VENDOR_FPC > $persist_fps_id
return 0
elif [ $ident_status == $FPS_VENDOR_NONE ]; then
log "fail"
log "- unload FPC driver"
rmmod fpc1020_mmi
break
fi
done
log "- install Goodix driver"
insmod /vendor/lib/modules/goodix_fod_mmi.ko
echo $FPS_VENDOR_GOODIX > $persist_fps_id
return 0
}
if [ ! -f $persist_fps_id ]; then
ident_fps
return $?
fi
fps_vendor=$(cat $persist_fps_id)
if [ -z $fps_vendor ]; then
fps_vendor=$FPS_VENDOR_NONE
fi
log "FPS vendor: $fps_vendor"
if [ $fps_vendor == $FPS_VENDOR_GOODIX ]; then
log "- install Goodix driver"
insmod /vendor/lib/modules/goodix_fod_mmi.ko
return $?
fi
if [ $fps_vendor == $FPS_VENDOR_FPC ]; then
log "- install FPC driver"
insmod /vendor/lib/modules/fpc1020_mmi.ko
return $?
fi
ident_fps
return $?

View File

@ -0,0 +1,123 @@
#!/vendor/bin/sh
#
# Start indicated fingerprint HAL service
#
# Copyright (c) 2019 Lenovo
# All rights reserved.
#
# April 15, 2019 chengql2@lenovo.com Initial version
# December 2, 2019 chengql2 Store fps_id into persist fs
script_name=${0##*/}
script_name=${script_name%.*}
function log {
echo "$script_name: $*" > /dev/kmsg
}
persist_fps_id=/mnt/vendor/persist/fps/vendor_id
persist_fps_id2=/mnt/vendor/persist/fps/last_vendor_id
MAX_TIMES=100
if [ ! -f $persist_fps_id ]; then
log "warn: no associated persist file found"
return -1
fi
FPS_VENDOR_NONE=none
FPS_VENDOR_GOODIX=goodix
FPS_VENDOR_FPC=fpc
prop_fps_status=vendor.hw.fingerprint.status
prop_persist_fps=persist.vendor.hardware.fingerprint
FPS_STATUS_NONE=none
FPS_STATUS_OK=ok
fps_vendor2=$(cat $persist_fps_id2)
if [ -z $fps_vendor2 ]; then
fps_vendor2=$FPS_VENDOR_NONE
fi
log "FPS vendor (last): $fps_vendor2"
fps_vendor=$(cat $persist_fps_id)
if [ -z $fps_vendor ]; then
fps_vendor=$FPS_VENDOR_NONE
fi
log "FPS vendor: $fps_vendor"
if [ $fps_vendor == $FPS_STATUS_NONE ]; then
log "warn: boot as the last FPS"
fps=$fps_vendor2
else
fps=$fps_vendor
fi
for i in $(seq 1 2)
do
setprop $prop_fps_status $FPS_STATUS_NONE
if [ $fps == $FPS_VENDOR_FPC ]; then
log "start fps_hal"
start fps_hal
else
log "start goodix_hal"
start goodix_hal
fi
log "wait for HAL finish ..."
fps_status=$(getprop $prop_fps_status)
for ii in $(seq 1 $MAX_TIMES)
do
# log "check fps vendor status: $fps_status"
if [ $fps_status != $FPS_STATUS_NONE ]; then
break
fi
sleep 0.2
fps_status=$(getprop $prop_fps_status)
done
log "fingerprint HAL status: $fps_status"
if [ $fps_status == $FPS_STATUS_OK ]; then
log "HAL success"
setprop $prop_persist_fps $fps
if [ $fps_vendor2 == $fps ]; then
return 0
fi
log "- update FPS vendor (last)"
echo $fps > $persist_fps_id2
log "- done"
return 0
fi
if [ $fps == $fps_vendor2 ]; then
if [ $fps == $FPS_VENDOR_FPC ]; then
rmmod fpc1020_mmi
sleep 0.1
stop fps_hal
sleep 0.1
insmod /vendor/lib/modules/goodix_fod_mmi.ko
fps=$FPS_VENDOR_GOODIX
else
rmmod goodix_fod_mmi
sleep 0.1
stop goodix_hal
sleep 0.1
insmod /vendor/lib/modules/fpc1020_mmi.ko
fps=$FPS_VENDOR_FPC
fi
log "- update FPS vendor"
echo $fps > $persist_fps_id
sleep 1
else
log "error: HAL fail unload ko"
if [ $fps == $FPS_VENDOR_FPC ]; then
rmmod fpc1020_mmi
else
rmmod goodix_fod_mmi
fi
setprop $prop_persist_fps $FPS_VENDOR_NONE
echo $FPS_VENDOR_NONE > $persist_fps_id
log "- done"
return 1
fi
done

View File

@ -0,0 +1,207 @@
# NFC ST21NFC
import /vendor/etc/init/hw/init.vendor.st21nfc.rc
on early-init && property:ro.bootmode=mot-factory
insmod /vendor/lib/modules/moto_f_usbnet.ko
on mmi-priority
# Only high priority MMI DLKMs loaded here
# For instance, sensor_class referenced from several DLKMs
# and needs to load first. Touchscreen might need extra time
# to perform firmware update if necessary
setprop vendor.mmi_init.stage priority
exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules sensors_class.ko
on fs
# Majority of MMI DLKMs should be in this group
setprop vendor.mmi_init.stage common
insmod /vendor/lib/modules/wl2866d.ko
insmod /vendor/lib/modules/mmi_info.ko
insmod /vendor/lib/modules/mmi_annotate.ko
insmod /vendor/lib/modules/mmi_sys_temp.ko
# install wireless charger before smbcharger
insmod /vendor/lib/modules/qpnp-smbcharger-mmi.ko
insmod /vendor/lib/modules/qpnp-power-on-mmi.ko
insmod /vendor/lib/modules/bq2597x_mmi.ko
insmod /vendor/lib/modules/mmi_parallel_charger.ko
insmod /vendor/lib/modules/mmi_parallel_charger_qc3p.ko
insmod /vendor/lib/modules/mmi_annotate.ko
insmod /vendor/lib/modules/mmi_info.ko
insmod /vendor/lib/modules/tzlog_dump.ko
insmod /vendor/lib/modules/watchdog_cpu_ctx.ko
insmod /vendor/lib/modules/mmi_relay.ko
insmod /vendor/lib/modules/touchscreen_mmi.ko
insmod /vendor/lib/modules/stmicro_mmi.ko
insmod /vendor/lib/modules/sx937x_sar.ko
insmod /vendor/lib/modules/st21nfc.ko
insmod /vendor/lib/modules/stmvl53l1.ko
insmod /vendor/lib/modules/qpnp_adaptive_charge.ko
exec u:r:vendor_modprobe:s0 -- /vendor/bin/modprobe -a -d /vendor/lib/modules aw882xx_k419.ko aw8695.ko
on post-fs
# "double tap" gesture
chown root input /sys/class/sensors/dt-gesture/enable
chmod 0660 /sys/class/sensors/dt-gesture/enable
chown root input /sys/class/sensors/dt-gesture/enable_wakeup
chmod 0660 /sys/class/sensors/dt-gesture/enable_wakeup
chown root input /sys/class/sensors/dt-gesture/flush
chmod 0660 /sys/class/sensors/dt-gesture/flush
chown root input /sys/class/sensors/dt-gesture/max_latency
chmod 0660 /sys/class/sensors/dt-gesture/max_latency
chown root input /sys/class/sensors/dt-gesture/poll_delay
chmod 0660 /sys/class/sensors/dt-gesture/poll_delay
# Change ownership and permision of st nfc device
chown nfc nfc /dev/st21nfc
chmod 0660 /dev/st21nfc
on post-fs-data
# Load DLKM that can afford being loaded later
setprop vendor.mmi_init.stage late
start vendor.mmi_modules
wait_for_prop init.svc.vendor.mmi_modules stopped
setprop vendor.mmi_init.stage complete
service vendor.stflashtool /vendor/bin/STFlashTool -c /vendor/etc/st21nfc_conf.txt -P vendor.nfc.fw_status
group nfc
user nfc
oneshot
disabled
service vendor.mmi_modules /vendor/bin/init.mmi.modules.sh
user root
oneshot
disabled
service vendor.vl53l1_daemon /vendor/bin/vl53l1_daemon
class late_start
user root
group root
socket vl53l1_daemon stream 660 root system
service vendor.mmi-laser-sh /vendor/bin/init.mmi.laser.sh
class core
user root
oneshot
service vendor.ftmipcd2 /vendor/bin/ftmipcd2
user radio
group radio net_raw inet oem_2901
capabilities NET_RAW
disabled
oneshot
on property:ro.bootmode=factory
start vendor.ftmipcd2
on property:ro.bootmode=mot-factory
start vendor.ftmipcd2
on init
write /sys/block/zram0/comp_algorithm lz4
on boot
# Add for goodix fingerprint
chown system system /dev/goodix_fp
chmod 0664 /dev/goodix_fp
mkdir /data/vendor/gf_data 0770 system system
mkdir /mnt/vendor/persist/goodix 0770 system system
# Add for CQA fps calibration test
chown system system /sys/class/backlight/panel0-backlight/brightness
chown system system /d/dri/0/debug/motUtil
chmod 0666 /d/dri/0/debug/motUtil;
chmod 0666 /sys/class/backlight/panel0-backlight/brightness
# Set wls perms for HAL
chown system system /sys/class/power_supply/wireless/device/tx_mode
#Add for laser
chown system system sys/class/laser/stmvl53l1/enable_sar
chmod 0660 sys/class/laser/stmvl53l1/enable_sar
chown system system sys/class/laser/stmvl53l1/set_delay_ms
chmod 0660 sys/class/laser/stmvl53l1/set_delay_ms
chown system system sys/class/laser/stmvl53l1/autonomous_config
chmod 0660 sys/class/laser/stmvl53l1/autonomous_config
chown system system sys/class/laser/stmvl53l1/enable_ps_sensor
chmod 0660 sys/class/laser/stmvl53l1/enable_ps_sensor
chown system system sys/class/laser/stmvl53l1/do_flush
chmod 0660 sys/class/laser/stmvl53l1/do_flush
chown system /sys/devices/virtual/laser/stmvl53l1/enable_sar
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/enable_sar
chown system /sys/devices/virtual/laser/stmvl53l1/set_delay_ms
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/set_delay_ms
chown system /sys/devices/virtual/laser/stmvl53l1/do_flush
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/do_flush
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/autonomous_config
chown system /sys/devices/virtual/laser/stmvl53l1/autonomous_config
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/enable_ps_sensor
chown system /sys/devices/virtual/laser/stmvl53l1/enable_ps_sensor
chmod 0660 /sys/devices/virtual/laser/stmvl53l1/timing_budget
chown system /sys/devices/virtual/laser/stmvl53l1/timing_budget
chown system system /sys/devices/virtual/input/input1/timing_budget
chmod 0660 /sys/devices/virtual/input/input1/timing_budget
chmod 0664 /mnt/vendor/persist/camera/focus/offset_cal
chmod 0664 /mnt/vendor/persist/camera/focus/cal_data
# Touch grip suppression control
chown system system /sys/class/touchscreen/primary/suppression
chmod 0660 /sys/class/touchscreen/primary/suppression
chown system system /sys/class/touchscreen/primary/pill_region
chmod 0660 /sys/class/touchscreen/primary/pill_region
chown system system /sys/class/touchscreen/primary/hold_distance
chmod 0660 /sys/class/touchscreen/primary/hold_distance
chown system system /sys/class/touchscreen/primary/gs_distance
chmod 0660 /sys/class/touchscreen/primary/gs_distance
chown system system /sys/class/touchscreen/primary/rotate
chmod 0660 /sys/class/touchscreen/primary/rotate
chown system system /sys/class/touchscreen/primary/interpolation
chmod 0660 /sys/class/touchscreen/primary/interpolation
chown system system /sys/class/touchscreen/primary/edge
chmod 0660 /sys/class/touchscreen/primary/edge
# Change ownership for capsensor
chown root input /sys/class/sensors/Moto\ CapSense\ Ch0/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch0/poll_delay
chown root input /sys/class/sensors/Moto\ CapSense\ Ch1/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch1/poll_delay
chown root input /sys/class/sensors/Moto\ CapSense\ Ch2/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch2/poll_delay
chown root input /sys/class/sensors/Moto\ CapSense\ Ch3/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch3/poll_delay
chown root input /sys/class/sensors/Moto\ CapSense\ Ch4/enable
chown root input /sys/class/sensors/Moto\ CapSense\ Ch4/poll_delay
chown system system /sys/class/capsense/reset
chown system system /sys/class/capsense/int_state
# Set adaptive charging perms for HAL
chown system system /sys/module/qpnp_adaptive_charge/parameters/upper_limit
chown system system /sys/module/qpnp_adaptive_charge/parameters/lower_limit
write /proc/sys/kernel/hung_task_timeout_secs 120
# Change ownership and permission for bq25960-standalone factory testing
chown system system /sys/class/power_supply/bq25960-standalone/voltage_now
chown system system /sys/class/power_supply/bq25960-standalone/charging_enabled
chmod 0644 /sys/class/power_supply/bq25960-standalone/voltage_now
chmod 0664 /sys/class/power_supply/bq25960-standalone/charging_enabled
#fps dual sensor
service vendor.ident-fps-overlay-sh /vendor/bin/init.oem.fingerprint.overlay.sh
class core
user root
group drmrpc system
oneshot
disabled
# Turn on led to indicate device on factory mode
on property:ro.bootmode=mot-factory
write /sys/class/leds/charging/brightness 255
on post-fs-data
mkdir /data/vendor/tzstorage/goodix 0770 system system
exec_start vendor.ident-fps-overlay-sh
service vendor.qrtr-lookup-sh /vendor/bin/init.mmi.qrtr-lookup.sh
class late_start
user root
group log system
oneshot
disabled
on property:sys.boot_completed=1
start vendor.qrtr-lookup-sh

View File

@ -0,0 +1,23 @@
# This file needs to be executed by vendor_init at boot of the device,
# both in normal and factory mode.
on post-fs
# Change ownership and permision of st nfc device
chown nfc nfc /dev/st21nfc
chmod 0660 /dev/st21nfc
on property:ro.vendor.hw.nfc=true && property:persist.vendor.radio.multisim.config=*
start vendor.stflashtool
on property:ro.vendor.hw.nfc=st && property:persist.vendor.radio.multisim.config=*
start vendor.stflashtool
on property:ro.vendor.hw.nfc=ese_st && property:persist.vendor.radio.multisim.config=*
start vendor.stflashtool
service vendor.stflashtool /vendor/bin/STFlashTool -c /vendor/etc/st21nfc_conf.txt -P vendor.nfc.fw_status
group nfc
user nfc
oneshot
disabled