Repository navigation
Conversation
My Pixel 2 froze opening USB File Transfer (2026-11-21): the screen kept its last frame, POWER did nothing, and zyperos.log ended a minute earlier. Every open wrote "disconnect" then "connect" to the controller's soft_connect on the launcher's main thread, over a link in use too, and dwc2 can hang in that toggle (Joshua's kernel.log: "dwc2_core_reset: HANG! Soft Reset timeout"). - The fresh link only when the link needs it (src/cablefresh.c, the rule in linksteps.c): not for a link bound a moment ago, always for one that is not whole, and for one that looks whole only when the computer does not answer an ARP request over usb0, which keeps the Mac that dropped the Pixel while it said "configured" (2026-10-08) working. The Brick too. - The controller's writes (soft_connect, the gadget's UDC bind and unbind) in a forked child (src/hwput.c): waited for 2 s at most, or not at all, then "usb: the controller did not answer" and the launcher carries on. No second job while one hangs, reaped when it ends, and it holds none of the launcher's descriptors. Each write is said in the log before it is made. - The usb:, wire:, xfer:, mdns:, crash:, power: and watchdog: lines also go to the kernel's log, which pstore keeps across a warm reset, and zyperos.log is synced after them by a thread of its own (src/klog.c, a filter in front of stderr). New power: lines for POWER and the power-off. - A watchdog thread (src/wdog.c) the main loop feeds from its frames, its input and its waits while a game or a program has the screen: 60 s without the loop, the stage said and the backlight off; 120 s, sysrq s and b. The main loop's own long tasks are held. SIGUSR2 stops the loop for 150 s, to show it. make check-usbhang holds all of it; with USBHANG_BEFORE=1 it runs 1.1.0's reconnect and fails 16 times.
It ended when 500 ms passed between its passes, measured from the start of the pass before, and its own first pass opens a snap in mp4d, which takes that long on a Pixel 2: "ended, something else had the screen (1 s)" 213 times in 40 minutes, a clip never shown. The gap is from the end of its last pass now (saver_beat), so only what came between counts.
…t names the step A freeze now ends in a restart with a report, from power on: - The PX30's DesignWare watchdog, on by default. U-Boot starts it (CONFIG_WDT, DESIGNWARE_WATCHDOG, autostart, 30 s; u-boot-px2.bin rebuilt, main's config first reproduced byte for byte), the kernel pets it from its probe until something opens it (&wdt on in the dts, CONFIG_WATCHDOG, DW_WATCHDOG, HANDLE_BOOT_ENABLED, open_timeout=60; linux.config regenerated, main's fragment giving main's back), and package/hwdog pets it from init's first line after the splash: never the launcher, no file touched after it starts, mlockall and SCHED_FIFO, so a long copy to a slow card never makes it late (the false reset PR #115 feared). A respawned second copy waits to take over. The magic close at a shutdown. - rootwait=20 in place of rootwait (root is there 0.14 s after the wait begins on a cold start), and a task stuck 60 s panics during the start only (the hung task sysctls on the kernel's line, set back to 0 around a fresh card's format, an update's switch and a copy, and as the launcher starts). For roverfine's cold starts that stopped in the kernel under a second in, the backlight on, for good (2026-11-23). - Each step of the start in the kernel's log and /tmp/splash-stage ("zyboot: stage=C1" to L1), from datapart and zyperos.init. - crashlog says which reset it was (a panic's kind, rootwait, a stuck task, ZyperOS's watchdog, the hardware watchdog during the start) and writes its facts beside the report, zyperos-lastboot.txt on PX2BOOT and in /run, for ZyperOS's notice at the next start. - zytest=hang or zytest=stall in zytest.txt on PX2BOOT tests the chain once: U-Boot passes it on and writes the file back as zytest=-. make check-crashlog and the new check-hwdog hold them; docs/building.md says how to test each watchdog.
The stage lines (zyboot) in datapart and zyperos.init, and crashlog's reasons and zyperos-lastboot.txt, are boot-notice's to build, so they are out of here again. The hung task panic is still set back to 0 around the card's long writes and as the launcher starts.
…lone Opening File Transfer over a Pixel 2's Developer Mode link froze the screen for about 10 s: the gadget was unbound and bound again, the controller toggled and SSH stopped and started, all on the launcher's main thread before the page drew, and the computer met the handheld three times. The link's work is now asked for and never waited on (src/gadget.h): the binds, the unbinds and the fresh link go to hwput's child one job at a time, the last word wins, and every look at the port reaps a job that ended and says it. usb0's address and udhcpd come up on a thread of their own on the Pixel 2. The page draws its first frame at once, the link steps' loading bar while the link comes, and B and POWER work all through it. A link the computer configured and answers on is never bound again or toggled: not as File Transfer opens (cablefresh.h asks the computer first) and not at a plug in Developer Mode, where the link is looked at 3 s after the plug and only made fresh if the computer has not taken it. Developer Mode's SSH takes File Transfer's PIN in place (sshlink_repin), its sessions kept, instead of a stop and a start; SSH and zyperos.local start once the page is up. The log times each part: "xfer: opened in N ms (link, art, systems, server and SSH)" and "xfer: the page's first frame N ms after it was asked for". check-xferopen opens it in desk mode over a stand-in cable whose controller writes take 3 s (src/device/deskcable.h): a link that is off, the same with POWER, a configured one the computer answers on, and one it does not.
# Conflicts: # Makefile
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My Pixel 2 (1.1.0) froze opening USB File Transfer: once for hours with nothing in the log, once for about 10 s before the page came. roverfine's Pixel 2 sometimes stops in the kernel on a cold start, LED off and backlight on, for good. This makes the launcher never wait on the USB controller, opens File Transfer at once, leaves a link my computer took alone, and turns any freeze into a restart with a report.
Pairs with the boot-notice PR (the slow start's lines and Zyper's notice after a restart): #485. I'd merge this one first: boot-notice's reasons W and its "The handheld froze" bubble report on the watchdogs here. Either order builds and passes on its own. The second to merge takes main with two small conflicts,
plastron/buildroot/package/zyperos/zyperos.initandplastron/buildroot/board/px2/rootfs-overlay/etc/init.d/datapart, both sides' lines kept (this one'shung_panic_off, boot-notice'sstagecalls). The start's stage lines and crashlog's summary for the launcher are boot-notice's; this branch has none of them.What the 10 s freeze was
The log, all on the launcher's main thread before the page drew: "usb: the link to the computer is off: charging only", "...is on", "a computer is on the cable: a fresh link", "wire: the cable connection made fresh", "ssh: stopped", "ssh: dropbear ...", then "xfer: link step 2.0". The kernel's log has the gadget bound three times (87.6, 88.6 and 92.5 s): my Mac met the handheld three times over, over a link it had already configured.
The fixes
src/hwput.c,hwput_runat :169). soft_connect and the gadget's UDC are written by a forked child, waited for 2 s at most or not at all; then "usb: the controller did not answer" and the launcher goes on. One job at a time, reaped when it ends, each write said in the log before it is made.src/gadget.c,gadget_link:225,gadget_pump:165,gadget_fresh:253). Binds, unbinds and the fresh link go to hwput's child; the last word wins; every look at the port reaps a job that ended and says it. The Pixel 2 (src/device/pixel2.c:1723) and the Brick (src/device/brick.c:1142) both use it. usb0's address and udhcpd come up on a thread of their own on the Pixel 2 (net_run,pixel2.c:1683).src/xfer_screen.c,xs_open:1394). Its first frame is the link steps' loading bar while the link comes (the screen's existing loading state, no new UI), and B and POWER work all through it. SSH and zyperos.local start once the page is up and usb0 has its address (xs_cable_services:1379).src/cablefresh.c:158). At a plug in Developer Mode, the link is looked at 3 s after the plug and made fresh only if the computer has not configured it (src/usblink.c,USBLINK_SETTLE_MS); the Brick, whose controller cannot tell, gets the fresh link at once as before.sshlink_repin,src/sshlink.c:729), never while a radio is up.xfer_screen.c:1506,:2248), so the next device run measures it.src/wdog.c): 60 s without the main loop, it says so and turns the backlight off; 120 s, sync and restart (sysrq s, b). SIGUSR2 stops the loop 150 s to show it.&wdtin the dts, the kernel's DW_WATCHDOG withwatchdog.open_timeout=60, U-Boot's WDT autostart, and plastron'shwdogpetting it from init's first line after the splash (mlockall, SCHED_FIFO), with a respawned second petter.zytest=hangandzytest=stallinzytest.txton PX2BOOT test it once.rootwait=20in place of a wait forever, and a task stuck 60 s panics during the start only (set back to 0 by zyperos.init around the card's long writes and as the launcher starts). For roverfine's cold starts that stopped under a second in.src/klog.c): usb:, wire:, xfer:, mdns:, crash:, power: and watchdog: lines go to /dev/kmsg too, which pstore keeps across a reset, so crashlog's report names the step.src/saver.c, its gap measured from the end of its last pass).Checks
Open times on this Mac, desk mode over a stand-in cable whose controller writes take 3 s each (
check-xferopen,src/device/deskcable.h):XFEROPEN_BEFORE=1)The after times are from five runs while this Mac had other builds going (load average 15 to 210); the larger ones are the busiest runs, and the part that grew was the card's (systems) and the fork, not the link. The window's own present in desk mode (the handheld's face drawn around it) adds 40 to 250 ms here that a Pixel 2's flip does not. The device's real numbers come from the two xfer: lines on the next run. check-xferopen holds the open and the first frame under 1 s, a third of one controller write.
check-xferopen: four cases. A link that is off: the loading bar at once, B with the bind on its way, the bind landing in the background, the unbind B asked for, no child left. The same with POWER: its power-off asked at once and the launcher ends with the bind still on its way. A configured link the computer answers on: nothing bound, unbound or toggled. One it does not answer on: made fresh, "disconnect" then "connect". WithXFEROPEN_BEFORE=1it fails 19 times.check-usbhang(withUSBHANG_BEFORE=1it fails 16 times),check-usblink(a link the computer took is not bound again; one it did not take in 3 s is made fresh once),check-linksteps,check-saver,check-crashlog: pass.check-hwdogon Linux (Docker): pass. The Pixel 2's, the R36S's, the Brick's and the Smart Pro's platform code and the link's files compiled for Linux with the device build's warnings: clean.steps-usb-unplugged,-taking,-opening,-noanswer) in 8 languages on the Pixel 2, the Brick and the Smart Pro (wide), light and dark: everything fits; I looked at them.make check CHECK_JOBS=4: all 277 checks passed in 17 min, none flaky.On a spare card
Build the image with both PRs together (
python3 tools/merge-train.py --integrate-only 487 485) and write it to a spare card.ssh root@zyperos.local). Open File Transfer: the page at once, the SSH session stays open, and the log says "usb: the computer answers over the cable: the link left as it is" and "ssh: dropbear N goes on with File Transfer's PIN, its sessions kept", with no "the gadget's UDC" line.dmesg | grep "bound driver"shows no new bind.dmesg, and the log says "usb: a computer is on the cable: its link looked at in 3 s", then "usb: the computer took the link: left as it is".kill -USR2 $(pidof zyperos.elf). At 60 s the backlight goes off; at 120 s the handheld restarts.zyperos-crash.txton PX2BOOT has "zyperos: watchdog: ..." near its end.echo zytest=hang > zytest.txton PX2BOOT, start: init is held, about 60 s in the chip resets. On the next startzytest.txtsayszytest=-, and the report on PX2BOOT has "hwdog: zytest=hang ..." before the reset. With boot-notice in the image, Zyper says "I had to restart!" with "Code K2W · ..." on the home, and About ZyperOS shows it as Last Restart.zytest=stall, start: the home comes, and about 60 s later the chip resets. With boot-notice, the next start says "The handheld froze. Code HX · ...".