PoE port control for MikroTik boards running OpenWrt (ATtiny V2/V3, SAMD20 V4). Provides per-port force — power without 802.3af/at negotiation — which the standard PSE-PD path does not cover.
Board, protocol and SPI device are auto-detected from /tmp/sysinfo/board_name
(override with --board / --proto / --dev):
rb-750p-pbr2— V2, 4 ports,/dev/spidev0.2mikrotik,routerboard-960pgs— V3, 4 ports,/dev/spidev0.2mikrotik,rb5009upr— V4, 8 ports,/dev/spidev2.0
Build the OpenWrt package yourself (see BUILD.md) and install the
resulting .apk. It is unsigned, so --allow-untrusted is required:
apk add --allow-untrusted ./mtpoe-0.1.0-r1.apk
Requires kmod-spi-dev (pulled in as a dependency). On first boot a uci-defaults
script creates /etc/config/mtpoe with every port set to auto.
mtpoe status # firmware, voltage, temperature, all ports
mtpoe show fw|voltage|temp # a single reading
mtpoe port # all ports and their state
mtpoe port <N> # a single port (1-based)
mtpoe port <N> <mode> # set a port
mtpoe apply # apply the configuration from UCI
mtpoe probe <cmd> [b1] [b2] # read a raw SPI register (debug)
mtpoe version
Global options: --json (machine-readable instead of text), --dev,
--uci-key, --proto, --board, --verbose.
off(0) — port offauto(2) — standard 802.3af/at; power only for a negotiating PDforce(1) — power unconditionally, without negotiation; for passive or non-standard devices (e.g. a Reolink doorbell)
Ports are 1-based throughout (matching the chassis labels) — in the CLI, UCI and JSON.
/etc/config/mtpoe:
config poe
option port1 'auto'
option port2 'off'
option port3 'force'
...
Values: off / auto / force or 0 / 1 / 2. mtpoe apply writes them to
the controller (only changed ports, where the current state can be read back).
- V4 (RB5009): the admin state of all 8 ports cannot be read back (register
0x45only covers 4 ports), sopoe_configisnullon V4 andapplywrites every port. Live per-port status and current work normally. - Persistence: the controller stores port states across reboots and power
loss — ports are active before the OS starts. With
forcethis means power is applied before OpenWrt is running. probe: sends a correctly framed command (CRC + retry) and shows the raw response in hex and decimal, without interpretation. Known brick opcodes (flash/reset) are refused without--force-dangerous.
- adron-s — original
mtpoe_ctrlauthor - prudy — RB5009UPr research and adaptations
- Sm00shed — maintainer of this Rust rewrite
GPL-2.0