Skip to content

Conversation

@Naraenda
Copy link

@Naraenda Naraenda commented Dec 6, 2025

Closes #146.

This PR contains the following set of changes:

  • Refactors ViveFaceTracker.cs.
    • The main change is the refactor from static members to a full wrapper around the file descriptor.
    • De-duplicated code.
    • Added more comments.
    • Removed "unsafe" code.
    • Slightly better logging.
  • Fixes the VFT device on Linux.
    • The original issue stems from incorrect assumption about available control buffer size.
    • New code handles both 64 and 384 byte buffer.
    • Main logic should resemble reference implementation much more closer. See https://github.com/LordOfDragons/vivefacialtracker

While working on this, I realized Windows could be fixed really easy by using Window's IOCTL libraries. That's out of scope for this PR though (and I don't have a Windows install anymore).

@CLAassistant
Copy link

CLAassistant commented Dec 6, 2025

CLA assistant check
All committers have signed the CLA.

@dfgHiatus
Copy link
Collaborator

Thanks for your PR! We don't have the Vive Facial Tracker on hand here, but if we can get some people to test this we can get this merged in. Maybe some people from the LVRA discord could help?

@hypevhs
Copy link

hypevhs commented Dec 10, 2025

I have a Vive Facial Tracker and an Arch Linux install. I'd like to try testing this soon.

I don't know if there are any prerequisites other than building this branch and trying to run the desktop application with the VFT connected.

@Naraenda
Copy link
Author

I have a Vive Facial Tracker and an Arch Linux install. I'd like to try testing this soon.

I don't know if there are any prerequisites other than building this branch and trying to run the desktop application with the VFT connected.

Dependencies haven't changed, so you can just use the same build process as before.

@feilen
Copy link

feilen commented Dec 21, 2025

Heya! Apologies if I'm doing something wrong here, quite new to this project. I built this module in a separate source tree and placed it in the Modules for the upstream built app, I'm getting the following:

./Baballonia.Desktop
info: Baballonia.Views.MainWindow[0]
      Baballonia version 1.1.0.9 starting...
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4
info: DefaultInferenceRunner.eyeModel.onnx[0]
      /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4/eyeModel.onnx initialization finished
fail: Baballonia.VFTCapture.VftCapture[0]
      Error in ioctl uvc_xu_control_query request:
        {q:GET_LEN,sz:2}
        {r:-1,e:2}: No such file or directory
info: DefaultInferenceRunner.faceModel.onnx[0]
      /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4/faceModel.onnx initialization finished
info: Baballonia.Services.ActivationService[0]
      Configuring OpenVR...
warn: Baballonia.Services.OpenVRService[0]
      Failed to Enable SteamVR AutoStart: Init_NoServerForBackgroundApp
warn: Baballonia.Services.ActivationService[0]
      Failed to configure OpenVR during ActivationService startup. Skipping.
info: Baballonia.Services.LocalSettingsService[0]
      Saving settings
fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from Bigscreen Bigeye (video0), with VFTCapture, closing... Maybe the camera is opened somewhere else?
fail: Baballonia.VFTCapture.VftCapture[0]
      Error in ioctl uvc_xu_control_query request:
        {q:GET_LEN,sz:2}
        {r:-1,e:2}: No such file or directory
fail: Baballonia.VFTCapture.VftCapture[0]
      Error in ioctl uvc_xu_control_query request:
        {q:GET_LEN,sz:2}
        {r:-1,e:2}: No such file or directory
fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from Bigscreen Bigeye (video0), with VFTCapture, closing... Maybe the camera is opened somewhere else?
fail: Baballonia.VFTCapture.VftCapture[0]
      Error in ioctl uvc_xu_control_query request:
        {q:GET_LEN,sz:2}
        {r:-1,e:2}: No such file or directory

Let me know if you need anything else! I'm running Ubuntu 24.04.3 LTS if that matters. I've not added any additional udev rules specific to the VFT either.

@feilen
Copy link

feilen commented Dec 21, 2025

Should note that this is after removing the LibUVCCapture and OpenCV dlls as it was trying to open with those previously.

Trying again in case it was a fluke, got the following:

info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4
info: DefaultInferenceRunner.eyeModel.onnx[0]
      /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4/eyeModel.onnx initialization finished
info: DefaultInferenceRunner.faceModel.onnx[0]
      /home/feilen/Apps/Baballonia/Baballonia.x64.v1.1.0.9rc4/faceModel.onnx initialization finished
fail: Baballonia.ViewModels.SplitViewPane.HomePageViewModel[0]
      System.ArgumentNullException: Value cannot be null. (Parameter 'No provider for Bigscreen Bigeye (video0) not found')
         at Baballonia.Services.Inference.SingleCameraSourceFactory.CreateStart(String address) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Factories/SingleCameraSourceFactory.cs:line 64
         at Baballonia.Services.EyePipelineManager.StartLeftVideoSource(String cameraAddress, String preferredBackend) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Services/EyePipelineManager.cs:line 131
         at Baballonia.Services.EyePipelineManager.TryStartLeftIfNotRunning(String cameraAddress, String preferredBackend) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Services/EyePipelineManager.cs:line 268
         at Baballonia.ViewModels.SplitViewPane.HomePageViewModel.StartCamera(CameraControllerModel model) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/ViewModels/SplitViewPane/HomePageViewModel.cs:line 627
fail: Baballonia.ViewModels.SplitViewPane.HomePageViewModel[0]
      System.ArgumentNullException: Value cannot be null. (Parameter 'No provider for Bigscreen Bigeye (video0) not found')
         at Baballonia.Services.Inference.SingleCameraSourceFactory.CreateStart(String address) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Factories/SingleCameraSourceFactory.cs:line 64
         at Baballonia.Services.EyePipelineManager.StartRightVideoSource(String cameraAddress, String preferredBackend) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Services/EyePipelineManager.cs:line 200
         at Baballonia.Services.EyePipelineManager.TryStartRightIfNotRunning(String cameraAddress, String preferredBackend) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/Services/EyePipelineManager.cs:line 279
         at Baballonia.ViewModels.SplitViewPane.HomePageViewModel.StartCamera(CameraControllerModel model) in /home/runner/work/Baballonia/Baballonia/src/Baballonia/ViewModels/SplitViewPane/HomePageViewModel.cs:line 631
info: Baballonia.Services.ActivationService[0]
      Configuring OpenVR...
warn: Baballonia.Services.OpenVRService[0]
      Failed to Enable SteamVR AutoStart: Init_NoServerForBackgroundApp
warn: Baballonia.Services.ActivationService[0]
      Failed to configure OpenVR during ActivationService startup. Skipping.
info: Baballonia.Services.LocalSettingsService[0]
      Saving settings
fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from HTC_Multimedia_Camera HTC_Multimedia_Camera (video2), with VFTCapture, closing... Maybe the camera is opened somewhere else?
fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from HTC_Multimedia_Camera HTC_Multimedia_Camera (video2), with VFTCapture, closing... Maybe the camera is opened somewhere else?

@dfgHiatus
Copy link
Collaborator

No data was received from Bigscreen Bigeye (video0), with VFTCapture, closing... Maybe the camera is opened somewhere else?

If I were you, enable 'advanced settings' and make sure only the face camera has the VFTCapture set as the backend. The Bigscreen can be whatever else

@feilen
Copy link

feilen commented Dec 21, 2025

Hmm, I have Advanced Settings enabled but I don't see where I can set the backend?

@dfgHiatus
Copy link
Collaborator

It might be a thing too where you need to type out the device path, IE /dev/videoX instead of the camera from the dropdown

@feilen
Copy link

feilen commented Dec 21, 2025

Similar again, with the backend explicitly selected:

fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from /dev/video0, with OpenCvCapture, closing... Maybe the camera is opened somewhere else?
fail: Baballonia.Services.Inference.SingleCameraSourceFactory[0]
      No data was received from /dev/video0, with VFTCapture, closing... Maybe the camera is opened somewhere else?

@dfgHiatus
Copy link
Collaborator

Hm, back to the drawing board here. Thanks for your info so far!

@feilen
Copy link

feilen commented Dec 21, 2025

All good! I'll take a few more swings at it myself, not impossible that the issue is simply on my end.

@feilen
Copy link

feilen commented Dec 21, 2025

Copied the udevadm rules from the BSB eyetracking README and adjusted them for the vendor/product of the VFT, no dice. So it's not likely a permission issue

@Naraenda
Copy link
Author

Naraenda commented Dec 21, 2025

Hmm, it might be related to OpenCVSharp. I'm building mine seperately. I can try rebasing this onto the newer capture method PRs.

At least the camera ioctl calls work. That's what the PR modifies.

@feilen
Copy link

feilen commented Dec 29, 2025

Oh, suppose I should ask before I delve to deep - is there a way to even train a model for the VFT on linux? I don't think Baballonia on Windows can capture from it raw either, unless I'm mistaken.

@dfgHiatus
Copy link
Collaborator

dfgHiatus commented Dec 29, 2025

While we natively support training eye models on Linux, we do not do the same for the face. We have a strong enough general model here.

And you are correct. Currently we cannot open the VFT camera on Windows or Linux on main or v1109rc1.

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.

[Bug]: Vive Facial Tracker on linux fails to fetch data

5 participants