The open source OpenXR runtime
0
fork

Configure Feed

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

d/wmr: Implement bluetooth debug message handling

Handle the debug message packet from the bluetooth
interface on the HP G2. There might be other packet
types, but that's the only one I've seen so far.

authored by

Jan Schmidt and committed by
Jakob Bornecrantz
7b95755f e0b5070f

+31 -2
+27
src/xrt/drivers/wmr/wmr_hmd.c
··· 78 78 static void 79 79 hololens_handle_bt_iface_packet(struct wmr_hmd *wh, const unsigned char *buffer, int size) 80 80 { 81 + int pkt_type; 82 + 83 + if (size < 2) 84 + return; 85 + 86 + if (size < 6) { 87 + WMR_DEBUG(wh, "Short Bluetooth interface packet (%d) type 0x%02x", size, buffer[1]); 88 + return; 89 + } 90 + 91 + pkt_type = buffer[1]; 92 + if (pkt_type != WMR_BT_IFACE_MSG_DEBUG) { 93 + WMR_DEBUG(wh, "Unknown Bluetooth interface packet (%d) type 0x%02x", size, pkt_type); 94 + return; 95 + } 96 + buffer += 2; 97 + 98 + uint16_t tag = read16(&buffer); 99 + uint16_t msg_len = read16(&buffer); 100 + 101 + if (size < msg_len + 6) { 102 + WMR_DEBUG(wh, "Bluetooth interface debug packet (%d) too short. tag 0x%x msg len %u", size, tag, 103 + msg_len); 104 + return; 105 + } 106 + 107 + WMR_DEBUG(wh, "BT debug: tag %d: %.*s", tag, msg_len, buffer); 81 108 } 82 109 83 110 static void
+4 -2
src/xrt/drivers/wmr/wmr_protocol.h
··· 34 34 #define WMR_MS_HOLOLENS_MSG_SENSORS 0x01 35 35 #define WMR_MS_HOLOLENS_MSG_CONTROL 0x02 // Integrated motion controller messages? 36 36 #define WMR_MS_HOLOLENS_MSG_DEBUG 0x03 37 - #define WMR_MS_HOLOLENS_MSG_BT_IFACE 0x05 /* Bluetooth interface */ 38 - #define WMR_MS_HOLOLENS_MSG_LEFT_CONTROLLER 0x06 /* Left controller */ 37 + #define WMR_MS_HOLOLENS_MSG_BT_IFACE 0x05 /* Bluetooth interface */ 38 + #define WMR_MS_HOLOLENS_MSG_LEFT_CONTROLLER 0x06 /* Left controller */ 39 39 #define WMR_MS_HOLOLENS_MSG_RIGHT_CONTROLLER 0x0E /* Right controller */ 40 40 #define WMR_MS_HOLOLENS_MSG_UNKNOWN_17 0x17 41 41 42 42 // Messages types specific to WMR Hololens Sensors' companion devices 43 43 #define WMR_CONTROL_MSG_IPD_VALUE 0x01 44 44 #define WMR_CONTROL_MSG_UNKNOWN_05 0x05 45 + 46 + #define WMR_BT_IFACE_MSG_DEBUG 0x19 45 47 46 48 #define STR_TO_U32(s) ((uint32_t)(((s)[0]) | ((s)[1] << 8) | ((s)[2] << 16) | ((s)[3] << 24))) 47 49 #define WMR_MAGIC STR_TO_U32("Dlo+")