54 lines
1.2 KiB
Bash
54 lines
1.2 KiB
Bash
|
|
#!/system/bin/sh
|
||
|
|
# FlipperDroid — early boot setup
|
||
|
|
# Sets up USB gadget and config directory
|
||
|
|
|
||
|
|
MODDIR=${0%/*}
|
||
|
|
CONFIG_DIR="/data/adb/flipperdroid"
|
||
|
|
CONFIG_FILE="$CONFIG_DIR/config.sh"
|
||
|
|
|
||
|
|
mkdir -p "$CONFIG_DIR/logs"
|
||
|
|
mkdir -p "$CONFIG_DIR/scripts"
|
||
|
|
|
||
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||
|
|
cat > "$CONFIG_FILE" << 'DEFAULTS'
|
||
|
|
# FlipperDroid configuration — persisted across reboots
|
||
|
|
|
||
|
|
# Connection mode: usb | bluetooth | auto
|
||
|
|
CONN_MODE=auto
|
||
|
|
|
||
|
|
# WebUI port
|
||
|
|
WEBUI_PORT=8089
|
||
|
|
|
||
|
|
# Auto-connect on boot
|
||
|
|
AUTO_CONNECT=1
|
||
|
|
|
||
|
|
# Bridge protocol baud rate (USB CDC ignores this, BT serial uses it)
|
||
|
|
BAUD_RATE=115200
|
||
|
|
|
||
|
|
# Enable Flipper subsystems to expose
|
||
|
|
ENABLE_GPIO=1
|
||
|
|
ENABLE_SUBGHZ=1
|
||
|
|
ENABLE_RFID=1
|
||
|
|
ENABLE_NFC=1
|
||
|
|
ENABLE_IR=1
|
||
|
|
ENABLE_IBUTTON=1
|
||
|
|
ENABLE_BADUSB=0
|
||
|
|
|
||
|
|
# CPU sharing — allow Flipper to offload compute to phone
|
||
|
|
CPU_SHARE=1
|
||
|
|
CPU_SHARE_THREADS=2
|
||
|
|
|
||
|
|
# Logging level: 0=off, 1=errors, 2=info, 3=debug
|
||
|
|
LOG_LEVEL=2
|
||
|
|
DEFAULTS
|
||
|
|
fi
|
||
|
|
|
||
|
|
source "$CONFIG_FILE"
|
||
|
|
|
||
|
|
# Ensure USB ACM gadget is available for Flipper CDC
|
||
|
|
if [ -d /config/usb_gadget ]; then
|
||
|
|
# Don't reconfigure, just ensure the CDC ACM function exists
|
||
|
|
# The kernel handles Flipper Zero as /dev/ttyACM* automatically
|
||
|
|
echo "FlipperDroid: USB gadget ready" > /dev/kmsg 2>/dev/null
|
||
|
|
fi
|