The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/wmr: Use proximity sensor value in IPD message.

The first byte after the packet ID toggles when
the proximity sensor is activated.

authored by

Jan Schmidt and committed by
Jakob Bornecrantz
733d463e 5efe0da7

+15 -6
+13 -6
src/xrt/drivers/wmr/wmr_hmd.c
··· 326 326 } 327 327 328 328 uint8_t id = read8(&buffer); 329 - uint8_t unknown = read8(&buffer); 330 - uint16_t value = read16(&buffer); 329 + if (id != 0x1) { 330 + WMR_ERROR(wh, "Invalid control IPD distance packet ID (expected 0x1 but got %u)", id); 331 + return; 332 + } 331 333 332 - (void)id; 333 - (void)unknown; 334 + uint8_t proximity = read8(&buffer); 335 + uint16_t ipd_value = read16(&buffer); 336 + 337 + bool changed = (wh->raw_ipd != ipd_value) || (wh->proximity_sensor != proximity); 334 338 335 - wh->raw_ipd = value; 339 + wh->raw_ipd = ipd_value; 340 + wh->proximity_sensor = proximity; 336 341 337 - WMR_DEBUG(wh, "Got IPD value: %04x", value); 342 + if (changed) { 343 + WMR_DEBUG(wh, "Proximity sensor %d IPD: %d", proximity, ipd_value); 344 + } 338 345 } 339 346 340 347 static bool
+2
src/xrt/drivers/wmr/wmr_hmd.h
··· 99 99 100 100 //! Latest raw IPD value from the device. 101 101 uint16_t raw_ipd; 102 + //! Latest proximity sensor value from the device. 103 + uint8_t proximity_sensor; 102 104 103 105 /* Distortion related parameters */ 104 106 struct wmr_hmd_distortion_params distortion_params[2];