Skip to content

omamobile-device-tegu 0.2.6: the USB rescue closes the switch after a replug the gadget didn't see - #280

Closed
W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:device-tegu-usb-rescue-stale
Closed

W4HO-ham wants to merge 1 commit into
derekross:mainfrom
W4HO-ham:device-tegu-usb-rescue-stale

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This afternoon the palmtop was unplugged from the laptop for a while (a USB-C power test with nothing in host mode) and then plugged back in, and it stayed off the bus, awake and screen on. A replug with the screen on didn't help either. Over Tailscale: USBSW_CTRL read 0x00 with VBUS present (TCPC_POWER_STATUS 0x0c), and the UDC still read configured. The rescue only looks at the chip while the gadget is unconfigured, so it never acted. Without a Type-C driver, dwc3 hears of no unplug, so "configured" can be stale. tegu-tcpc-switch connect by hand brought USB back at once.

While the gadget reads configured, the rescue now also reads the switch once per OMAMOBILE_TEGU_RESCUE_STALE seconds (default 10). If it's open with VBUS present, it logs "a replug the gadget didn't see" and closes it. With the switch closed that costs one register read per 10 s; with the cable out it's two (switch, then power) and no write or log line. The unconfigured path is unchanged.

Tested on the palmtop (7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, this change on top of #238 and #275, so nothing else changed): with the cable in and the gadget configured, I opened the switch the way the chip does after an unplug (i2cset of 0x93 = 0x00, with a 60 s dead-man that writes 0x09 back, and Tailscale as the second link). USB dropped, the rescue logged the close and wrote 0x09 nine seconds later, and SSH over USB answered again. An ordinary 7 s replug with the screen on also came back, without the rescue needing to act. test/usb-rescue covers the three configured cases (closed: one read; open with VBUS: closed and logged; open with the cable out: no write), and test/all and tools/pr-check pass.

Version 0.2.6, since #238 and #275 hold 0.2.4 and 0.2.5; set whatever is free at merge.

… replug the gadget didn't see

Unplugging the palmtop from the laptop and plugging it back left it off the bus: the switch read 0x00 with VBUS present, but the gadget still read configured, so the rescue never looked. Without a Type-C driver dwc3 hears of no unplug. While configured, the rescue now reads the switch every 10 s.
@derekross

Copy link
Copy Markdown
Owner

Thank you, good catch, and a careful test. Without a Type-C driver dwc3 never hears about the unplug, so a stale "configured" is exactly the blind spot the rescue had. Opening the switch by hand under a 60 s dead-man, with Tailscale as a second link, was the right way to reproduce it. The change only adds the read-and-close while the gadget is configured, and the unconfigured path is unchanged. The write still goes through tegu-tcpc-switch connect, which checks the chip's identity and VBUS, writes only from 0x00 to 0x09 and reads it back. With the cable in that costs one register read every 10 s, and with the cable out two, with no write and no log line. test/usb-rescue and the package's test/all pass for me merged onto today's main, tools/pr-check is clean, and 0.2.6 is the next free version now that #275 is in as 0.2.5.

One small suggestion, which I'm happy to make at merge if you'd rather not push again: in the configured branch, act only when the switch reads 0x00 rather than anything other than 0x09. 0x00 is the only open state the helper will close, and other values do turn up: USB-HOST-PLAN's H5 run logged USBSW_CTRL 0x24. With a configured gadget and VBUS present, a value like that would make the helper refuse every 10 s, which is two journal lines every 10 s for as long as it lasts. The edit is one condition plus a test case for 0x24 (one read, nothing else):

      if [[ $sw == 0x00 ]] && vbus_present; then

Thanks again!

@derekross derekross closed this in 78a7a17 Nov 1, 2026
@derekross

Copy link
Copy Markdown
Owner

Landed on main as 78a7a17 (squashed, authored by you), with the edits I described in my last comment. Thank you.

derekross pushed a commit that referenced this pull request Nov 2, 2026
…ing (#307)

The 9a's row after today's merges, with a NOTES entry for the evening's boots that the new cells link to.

- **Wi-Fi, testing to works.** `omamobile-device-tegu` 0.2.4 (#238) starts it at boot now, through the shared gs201 host and zuma PHY (kernel #178 on #156, both in review) and brcmfmac (kernel #56, in review), with only the extractor's firmware. The NOTES entry has the boot, and the three rebinds with Bluetooth up after #178's FLR commit. The kernel parts are still in review, and the cell says so, as the display cells did.
- **Suspend, WIP to testing.** The power key now lights the lock screen on the first press (#268, #275). Thirty attended sleeps and a day of real use with auto-sleep on all woke (SLEEP-PLAN, #284). The cell still says that three test sleeps on 10-28 to 10-30 never woke and that sleep tests stay attended. If you'd rather keep WIP until that hang is understood, I'll revert just the word.
- **Display:** the display DT is merged, and brightness, DPMS off and on and the 60/120 Hz switch now have a dated record (kernel #125's boot, which also checks the panel ID).
- **Charging, Haptics, Torch, NFC:** kernel #161, #96, #104 and #105 are merged.
- **USB net:** the rescue also handles a replug the gadget didn't see (#280).

The NOTES entry lists each boot with its release: Wi-Fi from the package, the power-key wake, the replug, storage idle (kernel #99), the panel ID (kernel #125), the RTC without the PMIC interrupt (kernel #55), and the auto-sleep day. GNSS and Modem stay as they are until the SIM test on Tuesday. Docs only; `tools/pr-check` passes, and the diff has no identifiers.

Closes #307

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
… replug the gadget didn't see (derekross#280)

Without a Type-C driver, dwc3 never hears about an unplug, so after a
replug the gadget can still read "configured" while the MAX77779 has
opened its USB2 switch. The tegu rescue now also closes the switch in
that state. The one write still goes through the guarded helper (the
chip's identity, VBUS, 0x00 to 0x09 only, read back). Tested on the
palmtop.

Maintainer edit at merge: the configured branch acts only on USBSW_CTRL
0x00, the value the helper accepts, so another open value (0x24 is on
record) doesn't log every 10 s; a test case covers it.

Closes derekross#280

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…ing (derekross#307)

The 9a's row after today's merges, with a NOTES entry for the evening's boots that the new cells link to.

- **Wi-Fi, testing to works.** `omamobile-device-tegu` 0.2.4 (derekross#238) starts it at boot now, through the shared gs201 host and zuma PHY (kernel derekross#178 on derekross#156, both in review) and brcmfmac (kernel derekross#56, in review), with only the extractor's firmware. The NOTES entry has the boot, and the three rebinds with Bluetooth up after derekross#178's FLR commit. The kernel parts are still in review, and the cell says so, as the display cells did.
- **Suspend, WIP to testing.** The power key now lights the lock screen on the first press (derekross#268, derekross#275). Thirty attended sleeps and a day of real use with auto-sleep on all woke (SLEEP-PLAN, derekross#284). The cell still says that three test sleeps on 10-28 to 10-30 never woke and that sleep tests stay attended. If you'd rather keep WIP until that hang is understood, I'll revert just the word.
- **Display:** the display DT is merged, and brightness, DPMS off and on and the 60/120 Hz switch now have a dated record (kernel derekross#125's boot, which also checks the panel ID).
- **Charging, Haptics, Torch, NFC:** kernel derekross#161, derekross#96, derekross#104 and derekross#105 are merged.
- **USB net:** the rescue also handles a replug the gadget didn't see (derekross#280).

The NOTES entry lists each boot with its release: Wi-Fi from the package, the power-key wake, the replug, storage idle (kernel derekross#99), the panel ID (kernel derekross#125), the RTC without the PMIC interrupt (kernel derekross#55), and the auto-sleep day. GNSS and Modem stay as they are until the SIM test on Tuesday. Docs only; `tools/pr-check` passes, and the diff has no identifiers.

Closes derekross#307

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants