Skip to content

Optionally retry on FORM_FACTOR_UNAVAILABLE#946

Open
gareth-morgan-nv wants to merge 2 commits into
bjornbytes:devfrom
gareth-morgan-nv:gmorgan/OptionalRetry
Open

Optionally retry on FORM_FACTOR_UNAVAILABLE#946
gareth-morgan-nv wants to merge 2 commits into
bjornbytes:devfrom
gareth-morgan-nv:gmorgan/OptionalRetry

Conversation

@gareth-morgan-nv
Copy link
Copy Markdown
Contributor

@gareth-morgan-nv gareth-morgan-nv commented May 20, 2026

Apologies that we are going back and forth on this. It turns out implementing a retry loop in the LUA gets really complicated due to the graphics init order. The amount of boiler plate code required just to connect the headset seems excessive, as shown in this Gist:
https://gist.github.com/gareth-morgan-nv/82d9e3b242146f8028e4d60af73c873c

So this PR adds the same retry loop we pushed in the last PR, but this time its behind a command line flag which is false by default.

@bjornbytes
Copy link
Copy Markdown
Owner

bjornbytes commented May 21, 2026

Yeah, the boilerplate is unfortunate, but it kinda falls out of the complexity of XR_KHR_vulkan_enable2.

If it's too much to stomach, one thing you might be able to do is put the lovr.headset.connect retry loop in conf.lua. This would let the rest of the boot process continue normally, compared to disabling headset/graphics and reimplementing a huge chunk of the boot logic yourself. I haven't tested it yet, but something like this:

-- conf.lua
function lovr.conf(t)
  -- ...fill out conf table

  -- Wait until headset is connected before booting lovr!
  local headset = require('lovr.headset') -- or lovr.headset = require 'lovr.headset' is fine too
  local timer = require('lovr.timer')
  while not headset.connect() do
    timer.sleep(1)
  end
end

This is still pretty awkward, but it's got a smaller surface area.

(I'm maybe seeing an issue where requiring modules in conf.lua will cause them to not pick up the conf table properly, but that could be fixed)

Regarding the change here (optional flag to enable a retry loop in xrGetSystem), my impression is that it still feels a little too "opinionated" or "specific", but I'm still giving it thought.

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