Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
19e15b1
Add speaker pin for t40_lite_movols-mo-805p
Nov 28, 2026
f1f985a
Add nand support for Movols MO-805P
Nov 28, 2026
afdb7a9
README: the 7201V2_02M10 board is done, and the C23S IR LED note says…
openipc-ai Nov 28, 2026
e08497d
ak3918av130_lite_yoton-ws03: uImage entry 0x80008040, environment in …
Fever-r Nov 28, 2026
ab36f01
nt98566_lite_xm-ivg-n8s: add the XM IVG-N8S, its IMX415 on four MIPI …
openipc-ai Nov 29, 2026
8030e53
ak3918av130_lite_yoton-ws03: select ak3918av130-ws03 DTB (#280)
Fever-r Nov 29, 2026
4c68150
nt98566_lite_xm-ivg-n8s: put the IMX415's binning back as majestic st…
openipc-ai Nov 29, 2026
e434ecc
gk7201v300_lite_xm-g2-wr-v: add the XM G2-WR-V robot camera with a TF…
dimerr Dec 2, 2026
4ba1b91
Add fh8852v200_lite_tuya-f1602-d2: the Tuya F1602-D2 pan/tilt camera …
lexleite Dec 3, 2026
56f5a04
fh8852v200_lite_tuya-f1602-d2: fix the MIS4001 Bayer table for normal…
lexleite Dec 4, 2026
1e3dd31
fh8852v200_lite_tuya-f1602-d2: Wi-Fi setup from a QR code (#293)
lexleite Dec 4, 2026
87745db
hi3518ev100_lite_escam-qf002: add the Escam QF002 (#288)
SleepyNinja0o Dec 4, 2026
159f57f
xiaomi-mjsxj02hl, xiaomi-mjsxj03hl: let autoled.sh take the -p and -s…
kayaal34 Dec 4, 2026
e38edfc
t23_lite_vstarcam-c8622: add the Vstarcam C8622 board (#278)
PeterBeklemishev Dec 4, 2026
3549a06
fh8852v200_lite_tuya-f1602-d2: the MIS4001 library from source (#294)
openipc-ai Dec 4, 2026
45ee83c
fh8852v200_lite_tuya-f1602-d2: upright by default, measured pan/tilt …
lexleite Dec 4, 2026
a6fc586
ak3918ev300_lite_heimvision-pe3020w: drop v4l-utils and two Wi-Fi mod…
openipc-ai Dec 5, 2026
b9fbc86
hi3518ev200_lite_yeskamo-nk02: Initial support (#289)
luaxlab Dec 5, 2026
424ede8
nt98566_lite_xm-ivg-n8s: the split NOR layout (#299)
openipc-ai Dec 5, 2026
49e21f5
For Movols MO-805P: ubinize-nand.cfg, build as ultimate, add self-upd…
Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/firmware-drift.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,13 @@
"blob": "8534433dca5ef19f2132ad2d1f73f6f3e83ae1f5",
"reconciled": "2026-09-13",
"note": "rtl8188eu variant of the generic config: R8188EU=y instead of unset, which brings WIRELESS_EXT back; identical otherwise"
},
{
"builder": "devices/fh8852v200_lite_tuya-f1602-d2/general/overlay/etc/modules",
"firmware": "general/overlay/etc/modules",
"blob": "4841de402a40bbabbe0924b7403409f42a350504",
"reconciled": "2026-12-01",
"note": "firmware's list plus the gpiostep line with this board's pan/tilt pins"
}
],
"builder_only_symbols": {
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/ci-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
"s3l_ultimate_amcrest-ip4m1026e", # Ambarella
"ak3918ev300_lite_heimvision-pe3020w", # Anyka
"xm530_lite_anbiux-a8b-3mp", # Xiongmai
"nt98566_lite_xm-ivg-n8s", # Novatek
"fh8852v200_lite_tuya-f1602-d2", # Fullhan
]

# LICENSE and README anchored to whole filenames; unanchored they would also
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CMCC HDC-51 A6-V11 T31L SC2332 RTL8188FU_USB NOR_16M done
Cootli CAMV0103 GK7202V300 SC223A SSV6355_USB NOR_8M in progress
CP Plus CP-UNC-TA21L2C GK7205V200 SC223A - NOR_16M video-ok, ir-cut-no, audio-no
Emax Wyvern Link SSC338Q IMX415/335 NOR_16M done
Escam QF002 HI3518EV100 JXH22 RTL8188EU_USB NOR_8M testing, video-ok, wifi-ok, ethernet-ok, pan/tilt-ok
Foscam X5 SSC337DE GC4653 RTL8188FU_USB NOR_16M done
GARUS GSL-5030X-30AP-NM HI3516EV200 SC2315E? - NOR_8M done
G.Craftsman GCA50 T31ZX GC4653 - NOR_16M done
Expand All @@ -61,6 +62,8 @@ Lenovo Snowman 1080P HI3518EV200 SC2035 RTL8188EUS_USB NOR_16M in pr
LSC 3215672 T23N SC2331 ATBM6012B_USB NOR_8M **INIT** - progress
Meari Speed 6S SSC333 JXF37 RTL8188FU_USB NOR_16M video-yes, wifi-yes, motors-no
Misecu XM-63-AI-50W XM550 SC5332 ATBM603X_USB NOR_8M testing, video-ok, wifi-ok (several-day owner test), ircut-ok, irled-ok, day/night-ok (exposure), speaker-ok, mic-ok
Movols MO-805P T40N GC4653 - NOR_8M in progress, if NAND replaced to NOR
Movols MO-805P T40N GC4653 - NAND in progress
Night Owl WCM-PWNVR20W-BU HI3518EV200 SC2135 RTL8188EUS_USB NOR_8M testing, video-ok, wifi-ok (several-day owner test), ircut-ok, irled-ok, audio-ok, lightsensor-ok
OpenIPC AIO Mario SSC338Q IMX335 RTL8812AU_USB NOR_16M done
OpenIPC AIO Thinker SSC338Q IMX335 NOR_16M done
Expand Down Expand Up @@ -95,6 +98,7 @@ Trassir TR-D4121IR1 v2 HI3516CV200 AR0237 - NOR_16M done
Trassir TR-W2C1 v1 SSC325 GC2053 MT7601U_USB NOR_16M done
Trassir TR-W2C1 v2 SSC335 GC2053 MT7601U_USB NOR_16M done
Tuya GV7630-T31-PTZ T31L SC2336 ATBM6012B_USB NOR_8M in progress
Tuya F1602-D2 FH8852V200 MIS4001 RTL8733BU_USB NOR_8M testing, video-ok, wifi-ok, audio-ok (two-way), day/night-ok (SADC), ir-ok, pan/tilt-ok (gpiostep), sdcard-ok (1-bit, fh_mci.buswidth=1)
Umea QC012 GK7102C_A MIS2003 RDA5995_USB MOR_8M wip
Uniview C1L-2WN-G SSC335DE OS02G10 RTL8188FU_USB NOR_16M done
Vixand IPC-1 GK7205V200 none EC200N_USB NOR_8M frozen
Expand All @@ -107,14 +111,15 @@ Vixand IVG-G6S GK7205V300 IMX335 - NOR_16M done
Vixand IVG-G6S-W GK7205V300 IMX335 ATBM6032i_USB NOR_16M w/ext wifi board
VStarcam C43S(B) SSC333 JXF37 MT7601U_USB NOR_16M in progress
VStarcam CS55 T31N GC2053 RTL8188FU_USB NOR_16M in progress
VStarcam C8622 T23N SC2336P AIC8800DL_? NOR_8M **INIT** - in progress
VStarcam C8622 T23N GC1084 AIC8800DC_USB NOR_8M testing, video-ok, ir-ok, speaker-ok, wifi-ok, sd - in progress, ptz/ircut - in progress (gc6153)
XiongMai 85H50AI HI3516EV300 IMX335 - NOR_16M testing, motorized zoom+focus (pelco-xm)
XiongMai HI3516D_N81820 HI3516DV100 IMX291 - NOR_16M testing, motorized zoom+focus (ms41908 SPI)
XiongMai IPC_G6S 20X GK7205V300 IMX335 - NOR_16M untested, 20x zoom+focus (pelco-xm), board of Vixand IVG-G6S
XiongMai IVG-N8S NT98566 IMX415 - NOR_16M testing, 4-lane video-ok (OpenIPC/majestic#390), this image untested
XiongMai JZC-N51813L HI3518CV100 AR0130 - NOR_16M testing, 18x zoom+focus (visca lens MCU)
XiongMai XM72050200 GK7201V200 SC2336 RTL8733BU_USB NOR_16M done
XiongMai 7201V2_02M10 GK7201V200 SP2308 RTL8733BU_USB NOR_16M testing, sold as JN-107AR-D-WIFI
VStarcam C23S HI3518EV200 OV2710 MT7601U_USB NOR_16M testing, video-ok, pan coils held off (pins known), tilt-no, ircut-ok, IR LEDs local dusk switch (not SoC, #255)
XiongMai 7201V2_02M10 GK7201V200 SP2308 RTL8733BU_USB NOR_16M done, sold as JN-107AR-D-WIFI
VStarcam C23S HI3518EV200 OV2710 MT7601U_USB NOR_16M testing, video-ok, pan coils held off (pins known), tilt-no, ircut-ok, IR LEDs not switched by any SoC pin, local switch did not fire on the one unit checked (#255)
VStarcam C8892WIP HI3518EV200 AR0237 MT7601U_USB NOR_16M done
VStarcam C8896WIP GK7102C_A GC2033 RTL8189ES_SDIO NOR_8M wip
Wansview Q5 1080p T21Z OV2735B RTL8188FU_USB NOR_16M in progress
Expand All @@ -126,6 +131,7 @@ Xiaomi MJSXJ03HL T31N JXQ03 RTL8189FS_SDIO NOR_16M done
Xiaomi MJSXJ03HL T31N JXQ03P RTL8189FS_SDIO NOR_16M done
Xiaomi MJSXJ05HL T31L GC2053 ATBM6031_SDIO NOR_16M preparation
XVI ISI-2010C T31N GC2053 - NOR_8M done
Yeskamo NK02 HI3518EV200 SC2135 RTL8188EU_USB NOR_8M done, long first boot
Yoton WS03 AK3918AV130 SC3B2AQ? ATBM6132_USB NOR_8M testing: RAM boot only, wifi-ok (OpenIPC/firmware#2962), no sensor driver yet
YuanCam DGK-423403 HI3518EV300 JXH62 RTL8188FU_USB NOR_8M research
Zenointel SD-2N-4G GK7205V510 MIS2009 EC200A_USB NAND done, pan/tilt (gpiostep), IR + white lamps
Expand All @@ -135,6 +141,7 @@ ZTE K543 SSC337DE SC401AI MT7601U_USB NOR_16M done
ZTE K545 T31X SC4336 ATBM6012B_USB NOR_16M done
4G Camera XG521 V1.2 GK7202V300 GC1054 EC800E-CN_USB NOR_8M done
XM IPG-G3-WR GK7202V300 JXH63 ATBM60321S_USB NOR_8M done
XM G2-WR-V (TFT robot) GK7201V300 JXH63P SSV6020_SDIO NOR_8M in progress, untested on hardware: LCD via openipc-spilcd, pan/tilt and IR-cut via mx2208a (motors)
XM IPC-RM1-BLK7202V3 GK7202V300 SC223A SV6115C/8188EUS NOR_8M video-yes, wifi-yes (ssv6x5x#1), pan/tilt-yes, ir+audio untested
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Append the WS03 board device tree merged in OpenIPC/linux#338 instead of the EVB tree.
CONFIG_AK_OPENIPC_DTB="ak3918av130-ws03"

# atbm606x-openipc builds its own cfg80211.ko, the same name and exports as
# the kernel's, so the kernel's are off.
# CONFIG_CFG80211 is not set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMI
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/ak3918av130-yoton-ws03.config"
# The uImage is the zImage with the board's DTB appended
# (CONFIG_ARM_APPENDED_DTB), built by the kernel itself as on hisilicon.
# The entry is the payload past the 64-byte uImage header: this board's
# U-Boot runs the image in place, without relocating it (OpenIPC/firmware#2962).
BR2_LINUX_KERNEL_UIMAGE=y
BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x80008000"
BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x80008040"
BR2_LINUX_KERNEL_XZ=y

# Filesystem
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This board's vendor U-Boot keeps its device tree where OpenIPC keeps the
# U-Boot environment: 64 KiB at 0x40000, and the environment itself is 0x1000
# bytes at 0x3c000, which fw_printenv never looks at. Point it at a file
# instead: /etc/ws03.env is a 4 KiB environment image carried in the rootfs,
# so fw_printenv and fw_setenv work and flash is never written.
/etc/ws03.env 0x0 0x1000
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ BR2_LINUX_KERNEL_XZ=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config"
BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_LIBV4L=y
BR2_PACKAGE_LIBV4L_UTILS=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# MT7601U driver from the generic EV300 kernel config; this board has an RTL8188FU.
/lib/modules/4.4.302/kernel/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
# The staging RTL8188EU driver: it has no alias for this board's RTL8188FU
# (0bda:f179), which 8188fu drives.
/lib/modules/4.4.302/kernel/drivers/staging/rtl8188eu/r8188eu.ko
# mac80211: 8188fu needs cfg80211 alone, and the wlandev entry this board uses
# (rtl8188fu-generic) never loads it.
/lib/modules/4.4.302/kernel/net/mac80211/mac80211.ko
31 changes: 31 additions & 0 deletions devices/fh8852v200_lite_tuya-f1602-d2/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
![OpenIPC logo][logo]

## OpenIPC Builder
_Experimental system for building OpenIPC firmware for known devices_


### Release notes for the device

Tuya / Smart Life indoor pan/tilt camera on board F1602-D2: FH8852V200, MIS4001 4 MP MIPI sensor, 8 MB NOR, RTL8733BU USB Wi-Fi. Device page: [device-tuya-f1602-d2-fh8852v200](https://github.com/OpenIPC/wiki/blob/master/en/device-tuya-f1602-d2-fh8852v200.md).

#### MIS4001 sensor library and tuning

Built from source in [OpenIPC/openfullhan](https://github.com/OpenIPC/openfullhan)
(`libraries/sensor/fh8852v200/imagedesign_mis4001`), through the firmware's
`fullhan-opensdk` package, which installs `/usr/lib/sensors/libmis4001_mipi.so`
and the `/etc/sensors/mis4001_mipi*_attr.hex` tuning. It replaces the library
this profile used to carry from the stock firmware (OpenIPC/firmware#3027),
keeping its register values; its README has where they came from, the tuning
measurements, and what changed:

- `image.flip` and `image.mirror` now give the right colours when switched live
too (OpenIPC/majestic#416). The stock library could leave a magenta picture
until the next switch.
- The Bayer table is the one measured on this camera (OpenIPC/builder#292):
all four orientations are right from a fresh start. The profile sets both
off, for the camera standing upright. Hung upside down it needs both on (this
SoC can't rotate), and the pan/tilt directions in `/etc/gpiostep.conf`
swapped, as its comments say.


[logo]: https://openipc.org/assets/openipc-logo-black.svg
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Architecture
BR2_arm=y
BR2_arm1176jzf_s=y
BR2_ARM_EABI=y

# Toolchain
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="https://github.com/openipc/firmware/releases/download/$(OPENIPC_TOOLCHAIN).tgz"
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-openipc-linux-musleabi"
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_9=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y

# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/openipc/linux/archive/$(OPENIPC_KERNEL).tar.gz"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/fh8852v200.generic.config"
BR2_LINUX_KERNEL_UIMAGE=y
BR2_LINUX_KERNEL_XZ=y

# Filesystem
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/package/busybox/busybox.config"
BR2_PACKAGE_UBOOT_TOOLS=y
BR2_PACKAGE_ZLIB=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_WIREGUARD_LINUX_COMPAT=y
BR2_PACKAGE_WIREGUARD_TOOLS=y
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_SQUASHFS=y
BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y

# OpenIPC
BR2_OPENIPC_SOC_VENDOR="fullhan"
BR2_OPENIPC_SOC_MODEL="fh8852v200"
BR2_OPENIPC_SOC_FAMILY="fh8852v200"
BR2_OPENIPC_VARIANT="lite"
BR2_OPENIPC_FLASH_SIZE="8"

# Packages
BR2_PACKAGE_DROPBEAR_OPENIPC=y
BR2_PACKAGE_FULLHAN_OSDRV_FH8852V200=y
BR2_PACKAGE_GPIOSTEP_OPENIPC=y
BR2_PACKAGE_IPCTOOL=y
BR2_PACKAGE_LIBCURL_OPENIPC=y
BR2_PACKAGE_LIBCURL_OPENIPC_CURL=y
# BR2_PACKAGE_LIBCURL_OPENIPC_PROXY_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_OPENIPC_COOKIES_SUPPORT is not set
# BR2_PACKAGE_LIBCURL_OPENIPC_EXTRA_PROTOCOLS_FEATURES is not set
BR2_PACKAGE_LIBEVENT_OPENIPC=y
BR2_PACKAGE_LIBOGG_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC=y
BR2_PACKAGE_LINUX_FIRMWARE_OPENIPC_MEDIATEK_MT7601U=y
BR2_PACKAGE_MAJESTIC_FONTS=y
BR2_PACKAGE_MAJESTIC_WEBUI=y
BR2_PACKAGE_MAJESTIC=y
BR2_PACKAGE_MAJESTIC_AF=y
BR2_PACKAGE_MBEDTLS_OPENIPC=y
BR2_PACKAGE_MOTORS=y
BR2_PACKAGE_OPUS_OPENIPC=y
BR2_PACKAGE_OPUS_OPENIPC_FIXED_POINT=y
BR2_PACKAGE_VTUND_OPENIPC=y
BR2_PACKAGE_YAML_CLI=y

# Tuya F1602-D2
# USB Wi-Fi RTL8733BU (0bda:f72b). The dwc2 VBUS fix and the rtl8733bu-fh8852v200
# wlandev profile are in the firmware (OpenIPC/firmware#3026); the driver is too
# big for the generic fh8852v200 lite image, so it comes with this profile.
BR2_PACKAGE_RTL8733BU_OPENIPC=y
# The Ethernet socket on this board is not connected, so Wi-Fi is set up from a
# QR code shown to the lens (qrscan). Its progress is signalled by IR-cut filter
# clicks; the "joined" sound file is excluded to make room (general/scripts/excludes).
BR2_PACKAGE_QUIRC_OPENIPC=y
# The MIS4001 sensor library and its tuning, built from source (OpenIPC/openfullhan).
BR2_PACKAGE_FULLHAN_OPENSDK=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Tuya F1602-D2 pan/tilt head, read by majestic-af's gpiostep actuator. The
# coils are on GPIO (gpiostep pan_gpios=41,42,37,38 tilt_gpios=3,2,1,0, see
# /etc/modules), in the stock motor_gpio.ko's order. The pads boot in other
# functions; gpiostep switches them to GPIO itself (OpenIPC/firmware#3040).
# Travel from one gearbox stop to the other, in gpiostep steps (8 half-steps),
# measured by driving the head from stop to stop until the picture stopped
# moving: pan ~292 (both ways; the stock lr_len is 290), tilt ~146. A few steps
# short of that, so a move to the far end stops before the gearbox does.
pan_travel=288
tilt_travel=142
# The camera stands upright and the picture is neither flipped nor mirrored: raw
# +pan turns the view left, +tilt turns it down (from the picture shift on the
# camera). Hung upside down, with image.flip and image.mirror on, it needs both
# the other way round: pan_left=-1 and tilt_up=1.
pan_left=1
tilt_up=-1
# Per micro-step: 1 ms on both axes loses no steps in repeated round trips.
pan_delay_us=1000
tilt_delay_us=1000
# Find both stops once per boot, then centre the head.
home=1
# Homing seek at 2 ms per micro-step on both axes. This kernel has HZ=100 and no
# high-res timers, so any delay of 2.5 ms or more sleeps a whole 10 ms tick: tilt's
# default 3000 homed at 10 ms per micro-step (42 s in all; 19 s with these).
pan_home_delay_us=2000
tilt_home_delay_us=2000
# Steps that turn the head by one whole frame of the picture, across and down,
# measured on the board by image shift at 2560x1440 (about 20 px a pan step
# and 24 px a tilt step): what centres a point double-tapped on the picture.
pan_frame_steps=128
tilt_frame_steps=60
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/sh
# Reset button (camera3, FH8852V200): GPIO27 on pad 60, idle=1, pressed=0.
# Hold for 10 s -> factory reset (firstboot: wipe overlay + reboot). Short presses are ignored.
# Arms only after the button has been seen released, so a stuck button cannot loop resets.
GPIO=27
PADREG=0xf0000170 # pad 60: sel 0 = SADC_XAIN1, sel 1 = GPIO27
HOLD=50 # 50 x 0.2 s = 10 s
PIDFILE=/var/run/resetbtn.pid

setup() {
devmem $PADREG 32 $(( ($(devmem $PADREG) & ~0x0f000000) | 0x01000000 ))
[ -d /sys/class/gpio/GPIO$GPIO ] || echo $GPIO > /sys/class/gpio/export
echo in > /sys/class/gpio/GPIO$GPIO/direction
}

watch() {
v=/sys/class/gpio/GPIO$GPIO/value
until [ "$(cat $v)" = 1 ]; do sleep 1; done
n=0
while :; do
if [ "$(cat $v)" = 0 ]; then
n=$((n + 1))
[ $n = 5 ] && logger -t resetbtn "button pressed, keep holding 10 s to factory reset"
if [ $n -ge $HOLD ]; then
logger -t resetbtn "held 10 s: factory reset (firstboot)"
if [ -n "$DRYRUN" ]; then echo "DRYRUN: would run firstboot now"; n=0
until [ "$(cat $v)" = 1 ]; do usleep 200000; done; continue; fi
firstboot
exit 0
fi
else
[ $n -ge 5 ] && logger -t resetbtn "released after $((n / 5)) s: nothing done"
n=0
fi
usleep 200000
done
}

case "$1" in
start)
if [ -f $PIDFILE ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null; then
echo "Reset button watcher already running"
exit 0
fi
echo "Starting reset button watcher..."
setup
watch </dev/null >/dev/null 2>&1 &
echo $! > $PIDFILE
;;
stop)
[ -f $PIDFILE ] && kill $(cat $PIDFILE) 2>/dev/null; rm -f $PIDFILE
;;
test)
setup; DRYRUN=1 watch
;;
*)
echo "Usage: $0 {start|stop|test}"; exit 1
;;
esac
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vfat
exfat
gpiostep pan_gpios=41,42,37,38 tilt_gpios=3,2,1,0
Loading