diff --git a/docs/power-and-lock.md b/docs/power-and-lock.md index 3da346d..3514450 100644 --- a/docs/power-and-lock.md +++ b/docs/power-and-lock.md @@ -190,3 +190,33 @@ last frame; the lock screen's own update follows when `user.slice` thaws. `omarchy-tablet-power` (one process per press, state in brightness and files, a fixed window after resume), `omarchy-screen-toggle` and `omarchy-greeter-wake` (a second and third writer of the backlight). + +## J71t Mac USB charging candidate + +`system/overlay/etc/orchard/mac-usb-current` opts J71t into the matching +Orchard root initrd's Mac-current compatibility profile. It selects +05ac:1014 with ACM+NCM and 500 mA descriptor power. Only a real host vendor +grant allows the kernel charger to ramp higher, within board/pack limits. +This requires the 2026-11-08 hardware changes and a freshly matched initrd; +the file alone has no effect with older hardware bundles. No systemd gadget +service rewrites the initrd's gadget or serial during switch-root. + +This candidate has host tests but no device charging result. Unlock the Mac, +approve the new accessory and, if needed, reconnect it. The BOOT serial is +retained for Orchard discovery and can require fresh authorization each boot. +To disable the profile, remove `/etc/orchard/mac-usb-current` and reboot. +No PMIC current limit or host authorization policy is forced by this file. + +The USB recovery service recognizes the bound NCM or ECM function. In addition +to its carrier-loss handler, it probes 172.16.42.2 through usb0 while carrier +and UDC configuration remain up. After a peer has replied once, 15 seconds +of failed replies trigger an `ip link` down/up cycle, without rebinding UDC +or disturbing ACM/charging. It logs `usb0-stall-bounce` to journal and kmsg, +including packet/drop counters. There is a 60-second cooldown and at most +three attempts without a new successful reply. Suspended, unconfigured, +unbound, admin-down and VBUS-absent links do not trigger this fallback; +unknown charging current_max does not prevent network recovery. Hosts that +never answer ICMP do not arm it. All recovery remains disabled on NBD roots. +The runner's transient oi-usb0-watchdog should not run alongside this service +for an acceptance test; count all bounce markers and require zero for a clean +NCM sustained-transfer result. diff --git a/system/overlay/etc/orchard/mac-usb-current b/system/overlay/etc/orchard/mac-usb-current new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/system/overlay/etc/orchard/mac-usb-current @@ -0,0 +1 @@ +1 diff --git a/tests/test_mac_usb_current.py b/tests/test_mac_usb_current.py new file mode 100644 index 0000000..c6f718e --- /dev/null +++ b/tests/test_mac_usb_current.py @@ -0,0 +1,18 @@ +"""The system opts in through data, leaving USB ownership to the initrd.""" +from pathlib import Path +import unittest + +ROOT = Path(__file__).resolve().parents[1] + +class MacUsbCurrent(unittest.TestCase): + def test_profile_is_exact_opt_in_for_matching_hardware(self): + self.assertEqual((ROOT/'system/overlay/etc/orchard/mac-usb-current').read_bytes(), b'1\n') + self.assertIn('freshly matched initrd', (ROOT/'docs/power-and-lock.md').read_text()) + + def test_system_root_includes_the_opt_in(self): + from release.public_root import system_files + data, mode = system_files()['etc/orchard/mac-usb-current'] + self.assertEqual((data, mode), (b'1\n', 0o644)) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_tablet_port.py b/tests/test_tablet_port.py new file mode 100644 index 0000000..9e73609 --- /dev/null +++ b/tests/test_tablet_port.py @@ -0,0 +1,33 @@ +import importlib.machinery +import importlib.util +import json +import os +from pathlib import Path +import struct +import subprocess +import unittest +from unittest.mock import patch +import xml.etree.ElementTree as ET + +PROJECT = Path(__file__).resolve().parents[1] + +def load(name, path): + loader=importlib.machinery.SourceFileLoader(name,str(PROJECT/path)) + spec=importlib.util.spec_from_loader(name,loader) + mod=importlib.util.module_from_spec(spec); loader.exec_module(mod); return mod + +p=load('power','system/overlay/usr/libexec/omarchy-powerd') + +class TabletPort(unittest.TestCase): + pass + + + + + + + + + + +if __name__=='__main__': unittest.main()