Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Vive Input Utility overriding XRDisplaySubsystem id


Recommended Posts

Our app needs to know which headset type is currently plugged in.  We support Oculus, Windows MR, Vive, and Cosmos.  In the past we've used Unity's XRDisplaySubsystems, and then parsed their names to determine which headset is plugged in.  When we integrated the ViveInputUtility this broke, as now all of their ids are just "OpenVR Display".  Is there another way to get this info out of the Vive Input Utility, or to get the old ids back?  Thanks,

-Bert

Our existing code:

	public static XRDisplaySubsystem GetXrSubsystem()
	{
		var xrDisplaySubsystems = new List<XRDisplaySubsystem>();
		SubsystemManager.GetInstances<XRDisplaySubsystem>(xrDisplaySubsystems);
		return xrDisplaySubsystems.FirstOrDefault();
	}
    
    public static SteamVrDevice WindowsVrDevice
	{
		get
		{
			string device = GetXrSubsystem()?.SubsystemDescriptor.id.ToLowerInvariant();
			if (string.IsNullOrEmpty(device))
			{
				return SteamVrDevice.None;
			}
			if (device.Contains("oculus") || device.Contains("quest") || device.Contains("miramar"))
				return SteamVrDevice.Rift;
			else if (device.Contains("hp reverb") || device.Contains("samsung") || device.Contains("lenovo"))
				return SteamVrDevice.WindowsMr;
			else if (device.Contains("vive"))
				return SteamVrDevice.Vive;
			else if (device.Contains("openvr"))
				return SteamVrDevice.ViveCosmos;
			else
				return SteamVrDevice.None;
		}
	}

 

Link to comment
Share on other sites

@bert.haddad You can simply use VRModule.GetCurrentDeviceState(role.GetDeviceIndex()) to get device state which you can query information such as serialNumber, modelNumber, deviceModel, ...etc.

Let me know if you are still having issue.

UPDATE:

Code sample as follows,

ViveRoleProperty role = ViveRoleProperty.New(HandRole.RightHand);

var deviceState = VRModule.GetCurrentDeviceState(role.GetDeviceIndex());

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...