Skip to content

SBP-2: align reconnect and logout with Apple - #228

Merged
mrmidi merged 4 commits into
mrmidi:mainfrom
mhellevang:fix/sbp2-login-ref-deviations
Oct 23, 2026
Merged

mrmidi merged 4 commits into
mrmidi:mainfrom
mhellevang:fix/sbp2-login-ref-deviations

Conversation

@mhellevang

Copy link
Copy Markdown
Contributor

On top of #227 (needs it). Fixes the places where LoginSession differed from the references. With the state machine each fix is a few rows in the table. One commit each:

  1. Reconnect window runs from the bus reset. Apple starts the reconnect timer in suspendedNotify (management timeout + 1 s) and restarts it on every further reset (IOFireWireSBP2Login.cpp:2067-2077, 2202-2235). If the login hasn't reconnected when it expires, it's lost (reconnectTimeout, :2395-2413). We started the timer only when the reconnect write was ACKed, and waited for rediscovery without a limit. The window is now a second timer beside the management one. If it closes before rediscovery, the session reports lost and rediscovery logs in afresh. On the LS-9000 that's a ~3 s window against the 650 ms rediscovery measured in SBP-2: re-login/reconnect after rediscovery, not on a 100 ms timer #216.
  2. Resend the reconnect on "unspecified error". Apple treats request complete + sbp_status 0xFF as transient and resends after 100 ms, inside the window (:2498-2503, :589). We fell back to a fresh login. Other rejections still fall back. The LS-9000's rejection after a power-cycle is sbpStatus=4, so it's unchanged.
  3. Ignore a bus reset while logging out. Apple's suspendedNotify does nothing in LoggingOut (:2088-2092). We dropped to Idle silently. Now the old-generation logout write fails, or the logout timeout fires, and either one reports the logout.

Kept as is, documented: logout while suspended follows Linux (sbp2_remove logs out at once, sbp2.c:1221-1243). Apple's fLogoutPending path never actually sends one: in Reconnect it only sets the flag again, and the timeout calls executeLogout with the flag still set, which returns busy (:2409-2410, :2634).

Not tested on hardware yet. Plan for the LS-9000:

  • a cable pull with a quick replug (reconnect inside the window),
  • a power-cycle (rejected → login),
  • unplugged for longer than the window (lost → login on replug).

An ID-0 reconnect on the H4D is still open.

@mrmidi
mrmidi merged commit 5bf339e into mrmidi:main Oct 23, 2026
2 checks passed
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