-
-
Notifications
You must be signed in to change notification settings - Fork 1
Daemon
infrafid is the server-side component of InfraFi. It listens for IR transmissions from the Flipper Zero, decodes the WiFi credentials, and uses them to connect the Linux machine to a WiFi network.
Requires GCC and Linux kernel headers (linux/lirc.h).
cd daemon
makeTo install and enable as a systemd service:
sudo ./install.shThe installer:
- Detects LIRC or evdev hardware
- Configures the IR receiver for RC-6 and NEC protocols
- Creates a udev rule (
/etc/udev/rules.d/99-infrafid-ir.rules) to persist protocol config across reboots - Builds and installs the binary
- Enables and starts the
infrafid.service
Usage: infrafid [options]
Options:
-d, --device PATH LIRC device for RX (default: /dev/lirc0)
-e, --evdev PATH Use evdev input device for RX (NEC via MSC_RAW)
-s, --serial PATH Serial device for Arduino IR transceiver
-a, --ack-device PATH LIRC device for ACK TX (default: same as --device)
-f, --foreground Run in foreground (don't daemonize)
-v, --verbose Verbose/debug logging
-V, --version Show version and exit
-h, --help Show help
Mutually exclusive: --evdev and --serial cannot be used together.
# LIRC receiver, foreground with verbose logging (most common for testing)
sudo infrafid -f -v
# Different RX device
sudo infrafid -d /dev/lirc1 -f -v
# Separate TX device for ACK (RX on lirc0, ACK on lirc1)
sudo infrafid -d /dev/lirc0 -a /dev/lirc1
# Arduino serial backend (handles both RX and TX ACK)
sudo infrafid -s /dev/ttyACM0 -f -v
# Arduino RX with separate LIRC device for ACK TX
sudo infrafid -s /dev/ttyACM0 -a /dev/lirc1
# evdev input (e.g. Squeezebox Touch)
sudo infrafid -e /dev/input/event1 -f -vThe default backend. Opens the LIRC device in LIRC_MODE_SCANCODE mode, which uses kernel-level RC-6/NEC decoding. This avoids the hardware FIFO overflow problems that occur with raw mode on small CIR chips like the ITE8708.
Requires /dev/lirc0 (or specified device) and the corresponding kernel RC decoder enabled.
For devices that expose IR via the Linux input subsystem using MSC_RAW events. NEC protocol only, using FAB4-style bit ordering (as found on Squeezebox Touch and similar embedded Linux devices).
For use with an Arduino Pro Micro running the InfraFi firmware. The daemon opens the serial device, performs a handshake with the Arduino, and reads decoded RC-6 scancodes from it. The same connection is used to command the Arduino's IR LED for ACK transmission.
See Arduino Firmware for setup details.
After a connection attempt (success or failure), the daemon can send an IR response back to the Flipper. The response uses the same frame format as the incoming transmission.
-
Success payload:
OK:192.168.1.102(includes the assigned IP) -
Failure payload:
FAIL
The Flipper waits up to 30 seconds for an ACK before timing out. ACK must be enabled in the Flipper app settings.
ACK with LIRC TX:
sudo infrafid -d /dev/lirc0 -a /dev/lirc1ACK with Arduino serial (both RX and TX on same connection):
sudo infrafid -s /dev/ttyACM0If the TX device cannot be opened, ACK is silently disabled and the daemon continues operating in RX-only mode.
infrafid supports two network management systems and automatically detects which one is active:
If nmcli is available and NetworkManager is running, the daemon uses it:
nmcli device wifi connect "<SSID>" password "<password>"For hidden networks:
nmcli device wifi connect "<SSID>" password "<password>" hidden yesIf NetworkManager is not detected, the daemon falls back to writing /etc/network/interfaces and running ifdown/ifup.
Before attempting to connect to a new network, the daemon saves the currently active SSID. If the connection attempt fails:
- The daemon sends a
FAILACK to the Flipper. - It attempts to reconnect to the previous network using the saved SSID.
- If rollback also fails, a warning is logged and manual intervention may be needed.
This prevents the machine from being left disconnected if bad credentials are sent.
The systemd unit file is installed at /etc/systemd/system/infrafid.service.
systemctl status infrafid # Check service status
systemctl restart infrafid # Restart
journalctl -u infrafid -f # Follow logsService configuration: To pass custom arguments to the daemon, create /etc/default/infrafid:
# /etc/default/infrafid
INFRAFID_ARGS="--serial /dev/ttyACM0 --verbose"Then restart the service.
infrafid logs to syslog (facility LOG_DAEMON). When run with -f (foreground), logs also print to stderr.
With -v (verbose), debug-level messages are included, including raw scancode values.
# View recent logs
journalctl -u infrafid --since "1 hour ago"
# Follow live
journalctl -u infrafid -fdaemon/
main.c # Entry point: CLI parsing, main loop, credential handling
wfr_lirc.h/c # LIRC scancode reader (/dev/lirc0, LIRC_MODE_SCANCODE)
wfr_evdev.h/c # evdev input reader (/dev/input/eventN, NEC via MSC_RAW)
wfr_serial.h/c # Serial backend for Arduino transceiver
wfr_decode.h/c # IR scancode reassembler (START/DATA/END -> payload + CRC check)
wfr_network.h/c # WiFi connector (NetworkManager/ifupdown) with rollback
wfr_ack.h/c # LIRC TX ACK sender
Makefile
infrafid.service
install.sh
Getting Started
Components
Reference