update-check: a still controller isn't a broken web socket

vrserver sends a controller's state only when something on it changes, and one lying still
or asleep may not even send its first one. The check subscribed to one controller and failed
after 3 s of silence. It now subscribes to all, and silence after a good handshake is a skip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DeeJanuzandClaude Opus 5.5 committed 2026-10-03 08:37:15 -06:00
1 parent 5b08e43a5d
commit ae4a1e30ab
1 file changed
+14 -8
+14 -8
View File
@@ -393,18 +393,24 @@ def check_vr_socket():
report("FAIL", label, "vrserver refused the web socket; the pause gesture can't read the controllers")
return
mailbox = f"frametop_check_{os.getpid()}"
for text in (f"mailbox_open {mailbox}", "mailbox_send input_server " + json.dumps(
{"type": "request_input_state_updates", "device_path": found[0]["root_path"],
"returnAddress": mailbox})):
# Every controller: one lying still (or asleep) may send nothing at all.
for text in [f"mailbox_open {mailbox}"] + ["mailbox_send input_server " + json.dumps(
{"type": "request_input_state_updates", "device_path": d["root_path"], "returnAddress": mailbox})
for d in found]:
payload, mask = text.encode(), os.urandom(4)
size = bytes([0x80 | len(payload)]) if len(payload) < 126 else bytes([0x80 | 126]) + struct.pack(">H", len(payload))
s.sendall(b"\x81" + size + mask + bytes(b ^ mask[i % 4] for i, b in enumerate(payload)))
deadline = time.monotonic() + 3
while b"update_component_states" not in data and time.monotonic() < deadline:
chunk = s.recv(65536)
if not chunk:
break
data += chunk
try:
while b"update_component_states" not in data and time.monotonic() < deadline:
chunk = s.recv(65536)
if not chunk:
break
data += chunk
except socket.timeout:
report("skip", label, "it took the subscription, but no controller sent anything in 3 s "
"(lying still or asleep?): pick one up and check again")
return
except OSError as e:
report("FAIL", label, f"{e}; the pause gesture can't read the controllers")
return