1#!/vendor/bin/sh
2
3# This script sets up `ro.vendor.sjtag_ap_is_unlocked` for the non-fused
4# device. For a fused device, this property should be set by
5# betterbug->ss-restart-detector when PD is acquired.
6
7SJTAG_STATUS=0x$(cat /sys/devices/platform/sjtag_ap/interface/status)
8SOFT_LOCK_BIT=4
9AUTH_PASS_BIT=8
10
11# Unlocked or locked but auth passed.
12if test "$((SJTAG_STATUS & (1 << SOFT_LOCK_BIT)))" = 0 -o \
13    "$((SJTAG_STATUS & (1 << AUTH_PASS_BIT)))" != 0 ; then
14  setprop ro.vendor.sjtag_ap_is_unlocked true
15fi
16