The open source OpenXR runtime
0
fork

Configure Feed

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

d/vive/device: Replace old debug macros with new ones.

+26 -52
+4 -4
src/xrt/drivers/vive/vive_config.c
··· 215 215 bool 216 216 vive_config_parse(struct vive_device *d, char *json_string) 217 217 { 218 - VIVE_DEBUG(d, "JSON config:\n%s\n", json_string); 218 + VIVE_DEBUG(d, "JSON config:\n%s", json_string); 219 219 220 220 cJSON *json = cJSON_Parse(json_string); 221 221 if (!cJSON_IsObject(json)) { 222 - VIVE_ERROR("Could not parse JSON data."); 222 + U_LOG_E("Could not parse JSON data."); 223 223 return false; 224 224 } 225 225 ··· 262 262 263 263 d->display.imuref = imu_to_head; 264 264 } break; 265 - default: VIVE_ERROR("Unknown Vive variant.\n"); return false; 265 + default: U_LOG_E("Unknown Vive variant."); return false; 266 266 } 267 267 268 268 JSON_STRING(json, "model_number", d->firmware.model_number); ··· 338 338 vive_config_parse_controller(struct vive_controller_device *d, 339 339 char *json_string) 340 340 { 341 - VIVE_CONTROLLER_DEBUG(d, "JSON config:\n%s\n", json_string); 341 + VIVE_CONTROLLER_DEBUG(d, "JSON config:\n%s", json_string); 342 342 343 343 cJSON *json = cJSON_Parse(json_string); 344 344 if (!cJSON_IsObject(json)) {
+19 -19
src/xrt/drivers/vive/vive_device.c
··· 80 80 vive_device_update_inputs(struct xrt_device *xdev) 81 81 { 82 82 struct vive_device *d = vive_device(xdev); 83 - VIVE_SPEW(d, "ENTER!"); 83 + VIVE_TRACE(d, "ENTER!"); 84 84 } 85 85 86 86 static void ··· 93 93 struct vive_device *d = vive_device(xdev); 94 94 95 95 if (name != XRT_INPUT_GENERIC_HEAD_POSE) { 96 - VIVE_ERROR("unknown input name"); 96 + U_LOG_E("unknown input name"); 97 97 return; 98 98 } 99 99 ··· 172 172 type = __le16_to_cpu(report.type); 173 173 if (type != VIVE_HEADSET_MAINBOARD_DEVICE_INFO_REPORT_TYPE || 174 174 report.len != 60) { 175 - VIVE_ERROR("Unexpected device info!"); 175 + U_LOG_E("Unexpected device info!"); 176 176 return -1; 177 177 } 178 178 ··· 224 224 225 225 if (__le16_to_cpu(report->unknown) != 0x2cd0 || report->len != 60 || 226 226 report->reserved1 || report->reserved2[0]) { 227 - VIVE_ERROR("Unexpected message content."); 227 + U_LOG_E("Unexpected message content."); 228 228 } 229 229 230 230 ipd = __le16_to_cpu(report->ipd); ··· 234 234 if (d->board.ipd != ipd) { 235 235 d->board.ipd = ipd; 236 236 d->board.lens_separation = lens_separation; 237 - VIVE_SPEW(d, "IPD %4.1f mm. Lens separation %4.1f mm.", 237 + VIVE_TRACE(d, "IPD %4.1f mm. Lens separation %4.1f mm.", 238 238 1e-2 * ipd, 1e-2 * lens_separation); 239 239 } 240 240 241 241 if (d->board.proximity != proximity) { 242 - VIVE_SPEW(d, "Proximity %d", proximity); 242 + VIVE_TRACE(d, "Proximity %d", proximity); 243 243 d->board.proximity = proximity; 244 244 } 245 245 246 246 if (d->board.button != report->button) { 247 247 d->board.button = report->button; 248 - VIVE_SPEW(d, "Button %d.", report->button); 248 + VIVE_TRACE(d, "Button %d.", report->button); 249 249 d->rot_filtered = (struct xrt_quat){0, 0, 0, 1}; 250 250 } 251 251 } ··· 346 346 scale * d->imu.gyro_scale.z * gyro[2] - d->imu.gyro_bias.z, 347 347 }; 348 348 349 - VIVE_SPEW(d, "ACC %f %f %f", acceleration.x, acceleration.y, 349 + VIVE_TRACE(d, "ACC %f %f %f", acceleration.x, acceleration.y, 350 350 acceleration.z); 351 351 352 - VIVE_SPEW(d, "GYRO %f %f %f", angular_velocity.x, 352 + VIVE_TRACE(d, "GYRO %f %f %f", angular_velocity.x, 353 353 angular_velocity.y, angular_velocity.z); 354 354 355 355 switch (d->variant) { ··· 387 387 angular_velocity_fixed.z = -angular_velocity.z; 388 388 angular_velocity = angular_velocity_fixed; 389 389 } break; 390 - default: VIVE_ERROR("Unhandled Vive variant\n"); return; 390 + default: U_LOG_E("Unhandled Vive variant"); return; 391 391 } 392 392 393 393 d->imu.time_ns += dt_ns; ··· 420 420 return true; 421 421 } 422 422 if (ret < 0) { 423 - VIVE_ERROR("Failed to read device '%i'!", ret); 423 + U_LOG_E("Failed to read device '%i'!", ret); 424 424 return false; 425 425 } 426 426 427 427 switch (buffer[0]) { 428 428 case VIVE_MAINBOARD_STATUS_REPORT_ID: 429 429 if (ret != sizeof(struct vive_mainboard_status_report)) { 430 - VIVE_ERROR("Mainboard status report has invalid size."); 430 + U_LOG_E("Mainboard status report has invalid size."); 431 431 return false; 432 432 } 433 433 vive_mainboard_decode_message( 434 434 d, (struct vive_mainboard_status_report *)buffer); 435 435 break; 436 436 default: 437 - VIVE_ERROR("Unknown mainboard message type %d", buffer[0]); 437 + U_LOG_E("Unknown mainboard message type %d", buffer[0]); 438 438 break; 439 439 } 440 440 ··· 479 479 return true; 480 480 } 481 481 if (ret < 0) { 482 - VIVE_ERROR("Failed to read device '%i'!", ret); 482 + U_LOG_E("Failed to read device '%i'!", ret); 483 483 return false; 484 484 } 485 485 486 486 switch (buffer[0]) { 487 487 case VIVE_IMU_REPORT_ID: 488 488 if (ret != 52) { 489 - VIVE_ERROR("Wrong IMU report size: %d", ret); 489 + U_LOG_E("Wrong IMU report size: %d", ret); 490 490 return false; 491 491 } 492 492 update_imu(d, (struct vive_imu_report *)buffer); 493 493 break; 494 - default: VIVE_ERROR("Unknown sensor message type %d", buffer[0]); break; 494 + default: U_LOG_E("Unknown sensor message type %d", buffer[0]); break; 495 495 } 496 496 497 497 return true; ··· 671 671 fov, h_meters, 672 672 (double)d->base.hmd->views[eye].lens_center.y_meters, 0, 673 673 &d->base.hmd->views[eye].fov)) { 674 - VIVE_ERROR( 674 + U_LOG_E( 675 675 "Failed to compute the partial fields of view."); 676 676 free(d); 677 677 return NULL; ··· 699 699 ret = os_thread_helper_start(&d->mainboard_thread, 700 700 vive_mainboard_run_thread, d); 701 701 if (ret != 0) { 702 - VIVE_ERROR("Failed to start mainboard thread!"); 702 + U_LOG_E("Failed to start mainboard thread!"); 703 703 vive_device_destroy((struct xrt_device *)d); 704 704 return NULL; 705 705 } ··· 708 708 ret = os_thread_helper_start(&d->sensors_thread, 709 709 vive_sensors_run_thread, d); 710 710 if (ret != 0) { 711 - VIVE_ERROR("Failed to start sensors thread!"); 711 + U_LOG_E("Failed to start sensors thread!"); 712 712 vive_device_destroy((struct xrt_device *)d); 713 713 return NULL; 714 714 }
+3 -29
src/xrt/drivers/vive/vive_device.h
··· 147 147 * 148 148 */ 149 149 150 - #define VIVE_SPEW(p, ...) \ 151 - do { \ 152 - if (p->ll <= U_LOGGING_TRACE) { \ 153 - fprintf(stderr, "%s - ", __func__); \ 154 - fprintf(stderr, __VA_ARGS__); \ 155 - fprintf(stderr, "\n"); \ 156 - } \ 157 - } while (false) 158 - #define VIVE_DEBUG(p, ...) \ 159 - do { \ 160 - if (p->ll <= U_LOGGING_DEBUG) { \ 161 - fprintf(stderr, "%s - ", __func__); \ 162 - fprintf(stderr, __VA_ARGS__); \ 163 - fprintf(stderr, "\n"); \ 164 - } \ 165 - } while (false) 166 - 167 - #define VIVE_ERROR(...) \ 168 - do { \ 169 - fprintf(stderr, "%s - ", __func__); \ 170 - fprintf(stderr, __VA_ARGS__); \ 171 - fprintf(stderr, "\n"); \ 172 - } while (false) 173 - 174 150 // clang-format off 175 - //#define VIVE_TRACE(p, ...) U_LOG_XDEV_IFL_T(&p->base, p->log_level, __VA_ARGS__) 176 - //#define VIVE_DEBUG(p, ...) U_LOG_XDEV_IFL_D(&p->base, p->log_level, __VA_ARGS__) 177 - //#define VIVE_INFO (p, ...) U_LOG_XDEV_IFL_I(&p->base, p->log_level, __VA_ARGS__) 178 - //#define VIVE_WARN (p, ...) U_LOG_XDEV_IFL_W(&p->base, p->log_level, __VA_ARGS__) 179 - //#define VIVE_ERROR(p, ...) U_LOG_XDEV_IFL_E(&p->base, p->log_level, __VA_ARGS__) 151 + #define VIVE_TRACE(d, ...) U_LOG_XDEV_IFL_T(&d->base, d->ll, __VA_ARGS__) 152 + #define VIVE_DEBUG(d, ...) U_LOG_XDEV_IFL_D(&d->base, d->ll, __VA_ARGS__) 153 + #define VIVE_ERROR(d, ...) U_LOG_XDEV_IFL_E(&d->base, d->ll, __VA_ARGS__) 180 154 // clang-format on 181 155 182 156 #ifdef __cplusplus