Skip to content

Commit 7152c72

Browse files
author
Mark Stalzer
committed
driver_vive: downgrade unknown lightcap report from error to warning
SV_ERROR with SURVIVE_ERROR_HARWARE_FAULT crashes the process when an unrecognised USB lightcap report ID is received. New tracker firmware routinely emits report IDs that older libsurvive versions do not know; crashing on an unrecognised ID makes libsurvive incompatible with any firmware newer than it was built against. The adjacent VIVE_REPORT_USB_TRACKER_LIGHTCAP_V1 case already uses SV_INFO and ignores the packet. Apply the same treatment to the unknown case: log a warning and continue so tracking on all known report types is unaffected.
1 parent 1fb4276 commit 7152c72

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/driver_vive.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,8 +3106,13 @@ void survive_data_cb_locked(uint64_t time_received_us, SurviveUSBInterface *si)
31063106
} else if (id == VIVE_REPORT_USB_TRACKER_LIGHTCAP_V1) {
31073107
SV_INFO("USB lightcap report is of an unexpected type for %s: %d (0x%02x)", obj->codename, id, id);
31083108
} else {
3109-
SV_ERROR(SURVIVE_ERROR_HARWARE_FAULT, "USB lightcap report is of an unknown type for %s: %d (0x%02x)",
3110-
obj->codename, id, id);
3109+
/* Unknown report IDs are emitted by newer tracker firmware that
3110+
* this version of libsurvive doesn't know about. Treating an
3111+
* unrecognised ID as a hardware fault is wrong — it crashes the
3112+
* process on firmware upgrades. Downgrade to a warning and ignore
3113+
* the packet so tracking continues on all known report types. */
3114+
SV_WARN("USB lightcap report is of an unknown type for %s: %d (0x%02x); ignoring",
3115+
obj->codename, id, id);
31113116
}
31123117

31133118
break;

0 commit comments

Comments
 (0)