# RipcurrentPro specific init.rc
import /vendor/etc/init/hw/init.${ro.board.platform}.board.rc

on init && property:ro.vendor.factory=1
    import /vendor/etc/init/hw/init.factory.rc

on init
    # eSE streset tool name
    setprop persist.vendor.se.streset libstreset24

on early-boot
    # Wait for insmod_sh to finish all common modules
    wait_for_prop vendor.common.modules.ready 1
    start insmod_sh_ripcurrentpro

service insmod_sh_ripcurrentpro /vendor/bin/insmod.sh /vendor_dlkm/etc/init.insmod.${ro.hardware}.cfg
    class main
    user root
    group root system
    disabled
    oneshot

on property:vendor.mfgapi.touchpanel.permission=1
    chmod 0600 /sys/devices/virtual/sec/tsp/cmd
    chown system system /sys/devices/virtual/sec/tsp/cmd

# WiFi
on post-fs-data
    setprop wifi.direct.interface p2p-dev-wlan0
    setprop wifi.aware.interface aware_nmi0

    # Speaker amp permission
    chmod 644 /mnt/vendor/persist/audio/speaker.cal

# Bluetooth
on post-fs-data
    chown bluetooth system /proc/bluetooth/timesync

# Haptics
on property:vendor.all.modules.ready=1
    mkdir /mnt/vendor/persist/haptics 0770 system system
    chmod 770 /mnt/vendor/persist/haptics
    chmod 440 /mnt/vendor/persist/haptics/cs40l26_dual.cal
    chown system system /mnt/vendor/persist/haptics
    chown system system /mnt/vendor/persist/haptics/cs40l26_dual.cal

    chown system system /sys/bus/i2c/devices/0-0043/calibration/f0_stored
    chown system system /sys/bus/i2c/devices/0-0043/calibration/q_stored
    chown system system /sys/bus/i2c/devices/0-0043/calibration/redc_stored
    chown system system /sys/bus/i2c/devices/0-0043/default/vibe_state
    chown system system /sys/bus/i2c/devices/0-0043/default/num_waves
    chown system system /sys/bus/i2c/devices/0-0043/default/f0_offset
    chown system system /sys/bus/i2c/devices/0-0043/default/owt_free_space
    chown system system /sys/bus/i2c/devices/0-0043/default/f0_comp_enable
    chown system system /sys/bus/i2c/devices/0-0043/default/redc_comp_enable
    chown system system /sys/bus/i2c/devices/0-0043/default/delay_before_stop_playback_us
    chown system system /sys/bus/i2c/devices/0-0042/calibration/f0_stored
    chown system system /sys/bus/i2c/devices/0-0042/calibration/q_stored
    chown system system /sys/bus/i2c/devices/0-0042/calibration/redc_stored
    chown system system /sys/bus/i2c/devices/0-0042/default/vibe_state
    chown system system /sys/bus/i2c/devices/0-0042/default/num_waves
    chown system system /sys/bus/i2c/devices/0-0042/default/f0_offset
    chown system system /sys/bus/i2c/devices/0-0042/default/owt_free_space
    chown system system /sys/bus/i2c/devices/0-0042/default/f0_comp_enable
    chown system system /sys/bus/i2c/devices/0-0042/default/redc_comp_enable
    chown system system /sys/bus/i2c/devices/0-0042/default/delay_before_stop_playback_us

    enable vendor.vibrator.cs40l26-dual
