Conversation
| # ttyS0 is wired to the status MCU, not to a user console. A login prompt on | ||
| # it reads the MCU replies, so turn it off as the vendor firmware does. | ||
| # procd reads /etc/inittab at boot, so this takes effect after a reboot. | ||
| sed -i 's|^::askconsole:|#::askconsole:|' /etc/inittab |
There was a problem hiding this comment.
Nothing reverts this edit: there is no postrm/prerm that restores ::askconsole:, and /etc/inittab is in base-files' keep list, so the serial console stays disabled after apk del, and after sysupgrades too. Add a Package/gl-e750-mcu/postrm that runs the reverse sed (guarded by IPKG_INSTROOT and board name).
Generated by Claude Code
There was a problem hiding this comment.
There was a problem hiding this comment.
@BKPepe thanks for the review, reworked along those lines:
- kernel side: ath79: gl-e750: add status MCU driver (OLED, battery) openwrt#25649 adds
kmod-gl-e750-mcu, a serdev driver bound from the DTS. It owns the MCU UART, exposes the battery as apower_supply(gl-e750-battery), turns the MCU's power-switch event into an orderly poweroff and takes screen updates through/dev/gl-e750-mcu. The board DTS setsconsole=ttynull, so/etc/inittabis no longer touched. - this package is now only
gl-e750-oled, a small event-driven ucode service (netifd/hostapd ubus events, JSON via ucode's encoder). It depends onkmod-gl-e750-mcu, so it can only be merged after adblock-fast: Makefile bugfixes and hijack rework #25649.
Tested on GL-E750 V1 and V2 with OpenWrt main. Marking ready for review.
| [ "$enabled" -eq 1 ] || return 0 | ||
|
|
||
| procd_open_instance | ||
| procd_set_param command /usr/sbin/gl-e750-mcu |
There was a problem hiding this comment.
The reload trigger never restarts the daemon. With no reload_service, reload just runs start again, and procd keeps the instance because its params are unchanged. A changed interval/hide_psk/modem_every therefore only takes effect after a manual restart. Let procd track the config file:
| procd_set_param command /usr/sbin/gl-e750-mcu | |
| procd_set_param command /usr/sbin/gl-e750-mcu | |
| procd_set_param file /etc/config/gl-e750-mcu |
Generated by Claude Code
There was a problem hiding this comment.
| # Keep kernel messages off the MCU uart, like the vendor firmware does. | ||
| echo "1 4 1 7" > /proc/sys/kernel/printk | ||
| stty -F "$TTY" 115200 raw -echo -echoe -echok -echoctl -echoke \ | ||
| -icrnl -opost -onlcr -isig -icanon -iexten min 0 time 1 |
There was a problem hiding this comment.
With min 0 time 1, a read() that sees no data for 100 ms returns 0. The cat "$TTY" in mcu_query (line 46) treats that as EOF and exits, so a reply is only caught if the MCU answers within about 100 ms, and the sleep 2/kill never comes into play. min 1 time 0 keeps cat blocking until it is killed, which seems to be the intent:
| -icrnl -opost -onlcr -isig -icanon -iexten min 0 time 1 | |
| -icrnl -opost -onlcr -isig -icanon -iexten min 1 time 0 |
Generated by Claude Code
There was a problem hiding this comment.
83774f7 to
b2ea3b9
Compare
|
Thanks, all three addressed in b2ea3b9 and re-tested on a GL-E750 V2 (25.12.5):
|
|
Relaxed |
BKPepe
left a comment
There was a problem hiding this comment.
I don't think this should be merged in its current form.
The GL-E750 MCU support itself is useful, but this package mixes two different responsibilities:
- hardware/MCU transport and battery telemetry
- userspace collection of network/UI state for the OLED
The first part should not be implemented as a polling shell daemon talking directly to /dev/ttyS0. The MCU is a real hardware controller connected through UART, and Linux already provides the appropriate serial/serdev infrastructure for protocol devices. Battery telemetry should also be exposed through the standard power_supply interface rather than a private /var/run/gl-e750-mcu/battery file.
The userspace part can then remain small and only handle the OLED presentation. It can consume normal OpenWrt/kernel/network state and send the resulting JSON to the MCU.
There are also several problems with the current implementation itself: it rebuilds JSON with destructive "escaping", polls UCI/ubus/hostapd/QMI periodically instead of reacting to state changes, uses heuristics for uplink/VPN state, hardcodes vpn_status=off, and modifies /etc/inittab to disable the serial console.
In particular, changing /etc/inittab from a package is a strong indication that the UART/MCU relationship should be handled as part of board/kernel support rather than by an application installed later.
I would therefore suggest splitting this into:
- an OpenWrt/kernel change for the GL-E750 MCU device and UART/serdev driver
- standard
power_supplyexposure for the battery state - a small userspace OLED service/package on top of that.
The OLED functionality itself is useful and worth keeping, but I don't think the current shell daemon is the right abstraction for upstream OpenWrt.
|
Thanks for the thorough review, agreed. I will rework it along those lines:
Converting this to draft until the kernel side is up and tested on V1/V2; I will link the openwrt/openwrt PR here. |
Show the router state on the OLED of the GL.iNet GL-E750 (Mudi): Wi-Fi SSIDs/keys per band, client count, uplink type, cellular state, VPN state and the clock. The MCU transport and the battery are handled by kmod-gl-e750-mcu in openwrt/openwrt; this service only builds the screen content and writes it to /dev/gl-e750-mcu. It is a ucode program that reacts to netifd interface events and hostapd notifications instead of polling; only the clock (once a minute) and the cellular signal via uqmi (once a minute, QMI only) are refreshed periodically. JSON is produced with ucode's encoder. The uplink type comes from the protocol of the interface that holds the default route and the Wi-Fi mode of its network, the VPN state from interfaces with a VPN protocol. Tested on a GL-E750 V1 and V2 with a main build that includes kmod-gl-e750-mcu: the screen follows clients joining and leaving within a second, Wi-Fi changes, and shows the clock and SIM state. With the ucode currently in main, stopping the service occasionally crashes ucode on exit after hostapd notifications were received; that is ucode-lang/ucode#438 (fixed upstream), it does not affect the running service. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Serv Pol <servpol@w420.ru>
|
@BKPepe reworked as you suggested, see the reply in the review thread above. The kernel side (serdev driver, |
📦 Package Details
Maintainer: @ServPol
Description:
Reworked after review: this is now only the OLED service for the GL.iNet GL-E750 (Mudi). The MCU transport, the battery (
power_supply) and the console handling moved to the kernel/board side in openwrt/openwrt#25649 (kmod-gl-e750-mcu), which this package depends on.gl-e750-oledis a small ucode service that builds the screen content (Wi-Fi SSIDs/keys per band, client count, uplink type, cellular state, VPN state, clock) and writes it as JSON to/dev/gl-e750-mcu./etc/inittabchanges and no direct UART access anymoreKnown issue: with the ucode currently in main, stopping the service occasionally crashes ucode on exit after hostapd notifications were received. That is ucode-lang/ucode#438, fixed upstream; the running service is not affected.
🧪 Run Testing Details
The screen shows the clock, Wi-Fi bands, SIM state and follows clients joining and leaving within a second; battery data comes from
/sys/class/power_supply/gl-e750-battery.✅ Formalities