Add NeoUI passcode configurator, duress mode profile, and Bluetooth OBEX UI
This commit is contained in:
1 parent
51a1a91d42
commit
62ac46e498
100 files changed
+2736
-240
No files matched your search
@@ -76,6 +76,9 @@ find_sd_part() {
|
||||
}
|
||||
|
||||
probe_controller() {
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ -b /dev/mmcblk1 ]; then
|
||||
return 0
|
||||
fi
|
||||
@@ -91,11 +94,18 @@ probe_controller() {
|
||||
sleep 0.1
|
||||
i="$(( i + 1 ))"
|
||||
done
|
||||
if [ ! -b /dev/mmcblk1 ]; then
|
||||
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
[ -b /dev/mmcblk1 ]
|
||||
}
|
||||
|
||||
do_mount() {
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
return 1
|
||||
fi
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
exec doas /usr/bin/sxmo_sdcard.sh mount "$@"
|
||||
fi
|
||||
@@ -178,16 +188,30 @@ do_unmount() {
|
||||
exec doas /usr/bin/sxmo_sdcard.sh unmount "$@"
|
||||
fi
|
||||
|
||||
force_mode=0
|
||||
if [ "${1:-}" = "--force-unmount" ]; then
|
||||
force_mode=1
|
||||
fi
|
||||
|
||||
sync
|
||||
if ! is_mounted; then
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
if [ "$force_mode" -eq 1 ] && [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
|
||||
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
|
||||
fi
|
||||
printf "SD card is not mounted\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if umount "$MOUNT_POINT" 2>/dev/null || umount -l "$MOUNT_POINT" 2>/dev/null; then
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
notify_user "SD Card" "Safely unmounted $MOUNT_POINT"
|
||||
if [ "$force_mode" -eq 1 ]; then
|
||||
if [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
|
||||
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
notify_user "SD Card" "Safely unmounted $MOUNT_POINT"
|
||||
fi
|
||||
printf "Unmounted %s\n" "$MOUNT_POINT"
|
||||
return 0
|
||||
fi
|
||||
@@ -197,6 +221,10 @@ do_unmount() {
|
||||
}
|
||||
|
||||
do_rescan() {
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
return 1
|
||||
fi
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
exec doas /usr/bin/sxmo_sdcard.sh rescan
|
||||
fi
|
||||
@@ -212,6 +240,11 @@ do_rescan() {
|
||||
}
|
||||
|
||||
do_status() {
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
printf "absent\n"
|
||||
return 0
|
||||
fi
|
||||
if is_mounted; then
|
||||
printf "1\n" > "$STATE_FILE" 2>/dev/null || true
|
||||
dev="$(findmnt -rn -o SOURCE "$MOUNT_POINT" 2>/dev/null || printf "/dev/mmcblk1p1")"
|
||||
@@ -233,6 +266,9 @@ do_status() {
|
||||
}
|
||||
|
||||
do_menu() {
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
exit 0
|
||||
fi
|
||||
. sxmo_hook_icons.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
@@ -280,10 +316,10 @@ case "$cmd" in
|
||||
do_status
|
||||
;;
|
||||
is_mounted|ismounted)
|
||||
is_mounted
|
||||
[ ! -f /tmp/bananarchy_duress_mode ] && is_mounted
|
||||
;;
|
||||
is_present|ispresent)
|
||||
find_sd_part >/dev/null 2>&1
|
||||
[ ! -f /tmp/bananarchy_duress_mode ] && find_sd_part >/dev/null 2>&1
|
||||
;;
|
||||
mount)
|
||||
do_mount "$@"
|
||||
@@ -291,6 +327,9 @@ case "$cmd" in
|
||||
unmount|umount|eject)
|
||||
do_unmount "$@"
|
||||
;;
|
||||
--force-unmount)
|
||||
do_unmount --force-unmount
|
||||
;;
|
||||
rescan|detect|probe)
|
||||
do_rescan
|
||||
;;
|
||||
@@ -299,11 +338,16 @@ case "$cmd" in
|
||||
kname="${2:-}"
|
||||
case "$act" in
|
||||
add|boot)
|
||||
if [ -f /tmp/bananarchy_duress_mode ]; then
|
||||
exit 0
|
||||
fi
|
||||
if [ -n "$kname" ]; then
|
||||
do_mount "/dev/$kname" >/dev/null 2>&1 || true
|
||||
else
|
||||
if find_sd_part >/dev/null 2>&1; then
|
||||
do_mount >/dev/null 2>&1 || true
|
||||
elif [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
|
||||
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
@@ -311,7 +355,12 @@ case "$cmd" in
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
umount -l "$MOUNT_POINT" 2>/dev/null || true
|
||||
rm -f "$STATE_FILE" 2>/dev/null || true
|
||||
notify_user "SD Card" "SD card removed"
|
||||
if [ -w /sys/bus/platform/drivers/sdhci_msm/unbind ]; then
|
||||
printf "7864900.sdhci" > /sys/bus/platform/drivers/sdhci_msm/unbind 2>/dev/null || true
|
||||
fi
|
||||
if [ ! -f /tmp/bananarchy_duress_mode ]; then
|
||||
notify_user "SD Card" "SD card removed"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user