Repository navigation
Conversation
|
@Somnius thank you, this is a careful piece of work, and opening it as a draft is exactly what I asked for. The tool, the runbook and the tags make it easy to see what's verified and what isn't. I read all of What I checked and agree with
Before I can say go on a4
Questions, not blockers
Fine to do now: the read-only Thanks again. The baseline-relative guard and the cold-port-first logic in boot-undo are just what I hoped for. |
d63de5c to
41d042d
Compare
…k only its own, signals undo first Changes from the maintainer's review of the draft (derekross#282): - revert b5-host returns the port cold (0x92 and GPIO5 read back 0), nothing else. A failed restore of 0xcb/0xc4/0xb9 with the port cold leaves the saved values in /var/lib/husky-deadman/registers-not-restored, which the next b5-host refuses on, and never makes run() reset the phone (a reset costs a slot B try). Only a port not proven cold keeps the marker and returns failure. - boot-undo (and the same-boot undo) put back only what still reads as b5-host's own write: MODE 0xb9 only if it reads 0x00, bit 3 of 0xcb only if it was clear before and reads set now, 0xc4 only if it was different before and reads 0x00 now. Anything else stays as the bootloader left it and is logged, so a unit at boot never turns charging on over this boot's bootloader. - TERM, INT and HUP during b5-host run the undo first (systemctl stop or a reboot during a run must not leave the port hot); the watchdog feeder ignores the signal until that undo has asked it to close. - boot-undo loads max77759 (the MFD) before gpio_max77759, waits a bounded time for each, and keeps the marker if either never shows up. - The charger_loaded refusal says what b5-host writes (MODE 0x00 and the bypass registers), not "MODE untouched". - shellcheck: no new warnings against main's two tools (the remaining ones are main's); the a && b || c patterns the new code added are braced. tests/husky-deadman covers each: a 0xcb that refuses the set (undo, no reset), a 0xcb that refuses the clear after a clean soak (port cold, registers-not-restored, no reset), boot-undo leaving a new boot's MODE 0x05 and 0xc4 alone and clearing only the OTG_V_PGM bit, boot-undo with the MFD missing (modprobe tried, nothing written, marker kept) and once it loads, TERM mid-soak (undo, watchdog closed). 24 ok. Nothing has run on the phone.
…o ignores a second signal, the result says it From the second review round of derekross#282: - restore_own_writes: an unreadable 0xc4 or 0xb9 (empty read) is a failed restore, as 0xcb already was: registers-not-restored is written and "registers restored" is not reported. - revert b5-host: in the "no saved registers anywhere" branch a failed bit-3 clear now also writes registers-not-restored (a note instead of the saved values), so the next run is refused as in the other case. - A failed register restore after a clean soak shows in the result ("soaked: VBUS off, but 0xcb/0xc4/0xb9 were not all restored, see ..."), and after a trip in the tripped result; the desktop tool prints it as a warning. The port is off in both cases. - revert ignores TERM, INT and HUP from its first line, so a signal during the watchdog close cannot start a second undo and overwrite the result with "interrupted". tests/husky-deadman: INT and HUP cases next to TERM (started with job control on, since a non-interactive shell's background job has SIGINT ignored, which systemd-run does not do); boot-undo with MODE reading 0x00 asserts the saved 0x05 is written back; the stuck-set case asserts MODE restored; an unreadable 0xb9 at the restore (file written, result says so); the quoting slip fixed. 27 ok, three runs in a row. shellcheck -S warning: the three remaining warnings are on main's own lines (one SC1007, two SC2046); none new.
|
@derekross thanks for reading all of it. I rebased #282 onto main (with #279 in) and added four commits on top, head
Your questions: boot-undo now loads Tests: |
|
@Somnius thank you, I've gone through the new head against the one I reviewed, point by point, and every one is in the code, not just the reply: the plans are in the repository with the Two small things:
Once the read-only |
…registers, and the host-mode runbook Draft: nothing here has been run on the phone beyond what the runbook lists (one sourcing run on 2026-11-01 with an earlier version of the tool). It answers the maintainer's review of the host-mode plan, point by point, and opens the tool and the runbook for review. The tool (tools/husky-deadman-phone, tools/husky-deadman): - b5-host is stage (a) only: nothing on the port but a passive USB-C meter. --device is gone (dwc3 stays in device role, nothing can enumerate, the 1 s voltage poll is the only overcurrent detection); attached devices go through the kernel path later. The soak ends in the tool's own undo, so VBUS is never left on without the guard, and --no-watchdog is refused for this step. - --meter is required: the operator's statement that an independent meter is on the port and reads 0 V. The TCPC's own 0x70 reading is logged, not trusted as the check; a word with the TCPCI scale bits set counts as unreadable instead of being scaled. - A new read-only 'baseline' step reads CHG_DETAILS_00/01/02 five times with the cable out and keeps them for the boot. b5-host refuses without one and its charger guard trips on a change from the baseline in the fields mainline names, not on an absolute value (0xb1 was in every dump). The MODE 0x00 write is followed by a comparison: a change stops the run before any VBUS, so that reading can be reviewed. - CC_STATUS 0x1d is decoded as tcpci.h does: a partner Rp refuses the step and trips the undo while sourcing. - Google's bypass registers are programmed as gs101_otg_bypass_enable() does: CHG_CNFG_11 0xc4 = 0x00 (5000 mV, stock husky has no usb-otg-mv) and CHG_CNFG_18 0xcb bit 3 OTG_V_PGM (the bit is in Google's max77759_A1_regs.h and v0p65 headers), read-modify-write of that bit, CHGPROT unlocked only on a failed readback, both saved and restored by the undo. - GPIO5 and 0x92 are PMIC registers, so a SoC reset is expected to leave the port hot. Before its first write the step enables husky-deadman-undo.service (oneshot, ConditionPathExists= a marker in /var/lib that carries the saved registers, TimeoutStartSec, RequiresMountsFor) and writes the marker last. 'boot-undo' runs early in the next boot: the port cold (0x92 and GPIO5 read back) removes the marker and the unit; registers it could not restore (charger driver loaded) go to registers-not-restored, which the next b5-host refuses on. A port not proven cold keeps the marker for the following boot. It cannot run on a normal boot: no marker, no run. - The Pixel 8 Pro compatible check and main's recovery text, which the local branch had lost, are back. device/husky/HOST-MODE-RUNBOOK.md is the gated runbook: Google's functions cited by line, the meter rule, the hot-port rules (nothing that can source during a stage, the load out first, the boot undo, a fail-safe manual script after a freeze that deletes the marker only after every readback), the baseline and guard definition, the bypass values and their source, stage (a) with its three expected outcomes (the first run most likely stops at MODE 0x00, no 5 V without ext_bst_mode is allowed, 5 V and back to 0 V), pass, stop and rollback, and the unknowns in one place. Every claim is tagged verified, inferred or unknown. BATTERY-NOTES links it. The typec-test and usb-role-test overlays it depends on are added. tests/husky-deadman runs the phone tool against stubs in a user and mount namespace, with a file bound over /dev/watchdog0: the refusals (--meter, baseline, partner Rp, --no-watchdog, scale bits, leftover marker or registers file), the unit written before the first register write and armed through the soak, the soak ending in the undo with the registers restored, the undo after a VBUS miss and after MODE 0x00 moving the details, the CHGPROT unlock path, boot-undo without and with the marker and with the charger loaded, and a mid-soak Rp trip. Ran: bash -n on both tools and the test, tests/device-overlays with the kernel's dtc (55 overlays compile), tests/husky-deadman (18 ok), tools/pr-check origin/main. Not run: anything on the phone; shellcheck is not installed here.
…k only its own, signals undo first Changes from the maintainer's review of the draft (derekross#282): - revert b5-host returns the port cold (0x92 and GPIO5 read back 0), nothing else. A failed restore of 0xcb/0xc4/0xb9 with the port cold leaves the saved values in /var/lib/husky-deadman/registers-not-restored, which the next b5-host refuses on, and never makes run() reset the phone (a reset costs a slot B try). Only a port not proven cold keeps the marker and returns failure. - boot-undo (and the same-boot undo) put back only what still reads as b5-host's own write: MODE 0xb9 only if it reads 0x00, bit 3 of 0xcb only if it was clear before and reads set now, 0xc4 only if it was different before and reads 0x00 now. Anything else stays as the bootloader left it and is logged, so a unit at boot never turns charging on over this boot's bootloader. - TERM, INT and HUP during b5-host run the undo first (systemctl stop or a reboot during a run must not leave the port hot); the watchdog feeder ignores the signal until that undo has asked it to close. - boot-undo loads max77759 (the MFD) before gpio_max77759, waits a bounded time for each, and keeps the marker if either never shows up. - The charger_loaded refusal says what b5-host writes (MODE 0x00 and the bypass registers), not "MODE untouched". - shellcheck: no new warnings against main's two tools (the remaining ones are main's); the a && b || c patterns the new code added are braced. tests/husky-deadman covers each: a 0xcb that refuses the set (undo, no reset), a 0xcb that refuses the clear after a clean soak (port cold, registers-not-restored, no reset), boot-undo leaving a new boot's MODE 0x05 and 0xc4 alone and clearing only the OTG_V_PGM bit, boot-undo with the MFD missing (modprobe tried, nothing written, marker kept) and once it loads, TERM mid-soak (undo, watchdog closed). 24 ok. Nothing has run on the phone.
… runbook revision 2 The two plans the overlays, the tool header and the runbook cite are now in the repository: device/husky/HOST-MODE-PLAN.md (what is missing for host mode, the external boost, the kernel patch outline, the staged plan, stage 1's result) and TYPEC-FAST-CHARGE-PLAN.md (the limiter chain, the stages, what has run). Both cite Google's GPL sources by file and line and tag each claim. BATTERY-NOTES gets section 7.2: the three Type-C boots of 2026-11-01 on 7.3.0-rc6-omamobile-push1-g5899fec2bd28: b4-tcpm charger-less (sink, 3.0 A, 0 hard resets, USB and Wi-Fi up, the driver closing the data switch on a replug), charger plus Type-C in one boot (TCPM's 3 A drove the input limit 0x13 to 0x77), and the USB role switch with no VBUS (xHCI root hubs at 480 Mbit/s and 10 Gbit/s, back to device cleanly). The section 1 table no longer says the Type-C controller has no driver. HOST-MODE-RUNBOOK revision 2: Google's use-case properties cited from kernel/devices/google/shusky dts/zuma-shusky-usecases.dtsi (lines 12, 13, 14, 31, 34) instead of a decompiled stock tree; OTG_V_PGM cited at max77759_A1_regs.h:2383 and 2386; the undo's cold-port split and the own-writes-only restore; the TERM/INT/HUP undo; a3 with its own Expect and Stop (a3 and a4 in one boot); a6 as a reset that skips shutdown (the watchdog path or sysrq b, not reboot-to), a separate go after a4 and after a4 has answered whether CHGIN sees the phone's own 5 V, with what to watch for the bootloader charging from the boost until boot-undo.
…o ignores a second signal, the result says it From the second review round of derekross#282: - restore_own_writes: an unreadable 0xc4 or 0xb9 (empty read) is a failed restore, as 0xcb already was: registers-not-restored is written and "registers restored" is not reported. - revert b5-host: in the "no saved registers anywhere" branch a failed bit-3 clear now also writes registers-not-restored (a note instead of the saved values), so the next run is refused as in the other case. - A failed register restore after a clean soak shows in the result ("soaked: VBUS off, but 0xcb/0xc4/0xb9 were not all restored, see ..."), and after a trip in the tripped result; the desktop tool prints it as a warning. The port is off in both cases. - revert ignores TERM, INT and HUP from its first line, so a signal during the watchdog close cannot start a second undo and overwrite the result with "interrupted". tests/husky-deadman: INT and HUP cases next to TERM (started with job control on, since a non-interactive shell's background job has SIGINT ignored, which systemd-run does not do); boot-undo with MODE reading 0x00 asserts the saved 0x05 is written back; the stuck-set case asserts MODE restored; an unreadable 0xb9 at the restore (file written, result says so); the quoting slip fixed. 27 ok, three runs in a row. shellcheck -S warning: the three remaining warnings are on main's own lines (one SC1007, two SC2046); none new.
…the signal path, a3 wording The runbook now says the undo and the boot undo put 0xc4 and 0xcb's bit 3 back only where they still read as the step's own write (the function is restore_own_writes), that a register that cannot be read or written back counts as not restored and goes to registers-not-restored, and that the result shows it. A MODE reading 0x00 after a reset cannot be told apart from a bootloader that left it at 0x00: the rule accepts that, and boot-undo may then switch charging on over such a bootloader (unknown whether husky's ever does; every dump read 0x05). The boot-undo paragraph names the max77759 modprobe and its 10 s bound. The signal path notes the undo's ~5 s plus the 12 s watchdog close fit the transient unit's default 90 s TimeoutStopSec. a3 says register 0x93 reads 0x09, as BATTERY-NOTES 7.2 records.
If TERM, INT or HUP arrives after the trap is set but before b5-host has saved the registers, the undo found neither host.saved nor the marker and cleared 0xcb bit 3 if it was set, which may be the bootloader's. It now writes none of 0xb9, 0xc4 and 0xcb in that case and only switches the port off. Test 9e2 covers it; the runbook says so in the undo paragraph. tests/all: keep main's list and add tests/husky-deadman.
41d042d to
7538524
Compare
|
@derekross thanks for going through it point by point. Both small things are done, pushed to the same branch (head
What ran: The read-only |
|
@derekross here are the two read-only things you said were fine to do now. Nothing was written to the phone and nothing sourced: the loaded modules were only Baseline, cable out ( The tool only passes when its 5 reads agree. With the Baseus brick plugged in the same registers read Baseus brick (the 30 W GaN one from my earlier test, no data connection to a computer), logged every 30 s for 30 min, starting at 21 % and ending at 44 %:
So at this step, which the plan calls the 500 mA limit ( The raw log is below. For a4 I'm waiting for your decision, and I won't run anything that sources VBUS until you've said go. the 60 log lines (phone clock, time soc status voltage uV, current uA, temp 0.1 C, then registers) |
Round 39 (2026-11-03) reviewed 40 pull requests and issues, and the maintainer's merges of the modem bring-up night. The confirmed lessons: version collisions that merge silently across open PRs, boot-file staleness from a device package's src/, shipped defaults checked on a fresh install rather than the reference phone (the card = none that #416 fixed), shutdown events that the next boot's dmesg can't see, guards added through the root image alone, conflict resolutions whose kept tests depend on order, and squash merges without a body. Corrections: C-26 (provisional) on L-190's reasoning about a longer BT_REG_ON hold; C-27 corrects L-326 in place (gs101's ACPM clocks are cached); C-28 on our first #282 review's premise. L-102, L-158 and L-183 gain one sentence each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Somnius thank you for both the round-2 changes and the two read-only runs. I checked the new head against the one I reviewed: the One housekeeping point first: main has changed the same Your baseline turns out to answer more than I expected, and it corrects something I said. Decoded with the enums in
On the Baseus numbers: you found the answer yourself with 0x87. That's the TCPC's On a4: go, under these conditions. The meter is in hand and passes a1's CC check, the runbook has the corrections in 1 and 2, and it's one run in one boot, a3 first as planned. Please post the a4 log (the MODE-0 line, the VBUS lines and whichever check ended it), the meter readings before, during (if you caught one) and after, Thanks again. A read-only baseline that ends up explaining the first run is just the sort of result this careful approach is meant to produce. |
# Conflicts: # tests/all
Section 4 (0xb1 was a charging reading, not a cable-out one), section 5 and 8 item 4 (CHGIN does see the boost with MODE 0x05), the a4 and a6 expectations, and the 500 mA input-limit claim caveated. Signed-off-by: Lef <me@lefteros.com>
|
I merged main into the branch (no rebase, so no force-push) and fixed the conflict in tests/all the way you said: main's line, tests/husky-deadman right after tests/flame-probe. tests/husky-deadman passes. Runbook text, as you asked: section 4 no longer says 0xb1 appeared with the cable out (it means a source was charging; with the pack done it reads 0xb4). Section 5 and 8 item 4: with MODE 0x05 CHGIN does see the boost, it's only open for MODE 0x00. The a4 expectation now says the likely outcome is VBUS on and a trip on CHGIN within 1 s, so the meter has to be reading real VBUS from the first run. a6 says to expect the charger to charge from the boost until boot-undo runs, and it stays a separate go. I took out the "500 mA step" wording and put the caveat in the Type-C plan: 0xc2 reads 0x13 but bit 7 NO_AUTOIBUS is clear, so the chip's own detection sets the input current, and 23 % in 30 min at about 49 mAh per % is nearer 2.2 A than 1.57 A, like you said. Nothing from the runbook has been run, a4 waits for the meter and your go. The charger baseline you asked for on #272 is #452. |
One conflict, in the list of test suites in tests/all: main added tests/pinned-packages and this branch added tests/husky-deadman, so both are in the list now.
|
@Somnius thank you, and thanks for merging rather than force-pushing. It made checking easy: the tool and its tests are exactly what I reviewed last time, and only the two docs changed. Two small text things on a4, and then it's a go as I described (meter in hand and passing the a1 CC check, a3 first, one run in one boot):
After the run, please post the a4 log, the meter before, during and after, |
…s its own outcome; section 8 item 3 agrees
|
@derekross fixed both. The a4 cell now has the most likely result as its own outcome, (a4c): VBUS on, then the CHGIN trip within a second. It says what I expect to see: the log line with the three registers right after VBUS on, the guard line that names the check that ended the run (exit 7), MODE 0xb9 put back, the meter at 5 V briefly and then 0 V after the undo, and no undo marker left behind. It's marked as inferred because I haven't seen it yet. §8 item 3 no longer calls a4' the expected first outcome: it now says a4c is the most likely and a4' is the other one that reads the MODE-0 details. |
…erge # Conflicts: # tests/all
|
@derekross a correction to my last comment: CI hadn't started on the draft because the PR had become conflicting with |
|
@Somnius thank you, both text fixes read right, and thanks for resolving |
…erge # Conflicts: # tests/all
# Conflicts: # tests/all
|
Merged main into this branch again (the only conflict was the test list in tests/all, I kept both new entries). tests/husky-deadman passes here after the merge; I didn't run the whole tests/all. |
|
@Somnius thanks for keeping the branch merged with main. I checked the merge: only the test list in |
One conflict, the test list in tests/all: this branch adds tests/husky-deadman and main adds tests/extract-vendor-firmware, so both are in the list. Signed-off-by: Lef <me@lefteros.com>
|
@derekross #282 went dirty again when main moved, so I merged main into it, a normal merge, no force-push. One conflict, in the test list of Merge commit: 09bc0c6 Nothing else changed, so what you wrote about a4 and a6 stands as it was. |
|
Thanks, @Somnius. I checked the merge: only |
…rekross#417) Round 39 (2026-11-03) reviewed 40 pull requests and issues, and the maintainer's merges of the modem bring-up night. The confirmed lessons: version collisions that merge silently across open PRs, boot-file staleness from a device package's src/, shipped defaults checked on a fresh install rather than the reference phone (the card = none that derekross#416 fixed), shutdown events that the next boot's dmesg can't see, guards added through the root image alone, conflict resolutions whose kept tests depend on order, and squash merges without a body. Corrections: C-26 (provisional) on L-190's reasoning about a longer BT_REG_ON hold; C-27 corrects L-326 in place (gs101's ACPM clocks are cached); C-28 on our first derekross#282 review's premise. L-102, L-158 and L-183 gain one sentence each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ekross#452) A dated NOTES record of the 8 Pro's MAX77759 charger registers at the 92 % stop, plugged in and charge done, for the host-mode work in derekross#272 and derekross#282. Signed-off-by: Lef <me@lefteros.com>
@derekross this is the draft PR you asked for on #272: the
b5-hosttool and the runbook, so you can read the guard, the undo and the latch yourself. It's a draft, not meant to merge. Nothing in it has run on the phone in this form, and nothing will until you say go.The runbook is
device/husky/HOST-MODE-RUNBOOK.md, linked from BATTERY-NOTES.md. Your six points, where each one is:tools/husky-deadmanandtools/husky-deadman-phone), and the runbook cites Google'sgs101_standby_to_otg(),gs101_otg_enable(),gs101_otg_bypass_enable()/_disable(),gs101_ls_mode(),gs101_ext_mode()andgs101_ext_bst_mode()inmax77759_usecase.c, with line numbers.--meter, and the runbook says the meter, not the TCPC's0x70, is the measurement. It also answers the charging-current question on Pixel 8a (akita / zuma, Tensor G3) port: offering hardware and help #1. The tool can't read the meter, so that part stays a person looking at it.CC_STATUSrefuses the run or undoes it at once. There is a oneshot undo unit installed for that boot only, with a marker, that sets0x92, GPIO5 and the bypass registers back early in the next boot and removes itself. The runbook has the manual fallback and what to do if the phone freezes (unplug, force a restart, run the undo first thing).baseline(cable out, nothing written): it logsCHG_DETAILS_00/01/02five times, andb5-hostrefuses without one from this boot. The guard trips on a change from that baseline, not on the absolute0xb1. With MODE0x00those fields will probably move, so the first run is expected to stop right there before VBUS comes on, and the runbook says that.CHG_CNFG_11=0x00(5000 mV, husky's stock node has nousb-otg-mv) andOTG_V_PGM, bit 3 ofCHG_CNFG_18, saved before and restored at undo. The bit comes from Google's register headers. I haven't checked it against a datasheet.--deviceis refused. The runbook has theregulator-fixedon GPIO5 asvbus-supply(neverboot-onoralways-on) as the later kernel path, with its own runbook. It also says writing0x92withi2cset -fwhiletcpci_maximis bound is research only, with the "0x92 changed" guard.Also in the PR: the two overlays the tool refers to (
typec-test.dtso,usb-role-test.dtso) andtests/husky-deadman, which uses stubs (fakei2cget/i2cset/gpiosetin a throwaway namespace), 18 checks: the undo unit and marker, the refusal without a baseline, the apply-failure undo, the unit not firing without its marker, and the others.What ran:
bash -non both tools, the new test,tests/device-overlays(55 overlays compiled with the kernel's dtc),tools/pr-check origin/main. What didn't: shellcheck (not installed), and anything on the phone. What I don't know is in section 8 of the runbook: the unit's ordering against the I2C and GPIO drivers at boot, whether libgpiod is on the phone, whether0xcbneeds the CHGPROT unlock, and what MODE0x00does to the charger details. The 5 ms between GPIO5 and0x92can't be exactly kept withgpioset, so the tool logs the real time instead.