Skip to content

Commit

Permalink
Merge pull request #1 from aacuevas/oni-open-fix
Browse files Browse the repository at this point in the history
Fix oni calls crashing when no acquisition board is present
  • Loading branch information
jsiegle authored Sep 16, 2024
2 parents 510fd93 + 1fac8b4 commit d3120a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Source/devices/oni/AcqBoardONI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ bool AcqBoardONI::detectBoard()
LOGC ("Searching for ONI Acquisition Board...");
const oni_driver_info_t* driverInfo;
int return_code = evalBoard->open (&driverInfo);

int major, minor, patch;
evalBoard->getONIVersion (&major, &minor, &patch);
LOGC ("ONI Library version: ", major, ".", minor, ".", patch);
LOGC ("ONI Driver: ", driverInfo->name, " Version: ", driverInfo->major, ".", driverInfo->minor, ".", driverInfo->patch, (driverInfo->pre_release ? "-" : ""), (driverInfo->pre_release ? driverInfo->pre_release : ""));


if (return_code == 1) // successfully opened board
{
int major, minor, patch;
evalBoard->getONIVersion (&major, &minor, &patch);
LOGC ("ONI Library version: ", major, ".", minor, ".", patch);
LOGC ("ONI Driver: ", driverInfo->name, " Version: ", driverInfo->major, ".", driverInfo->minor, ".", driverInfo->patch, (driverInfo->pre_release ? "-" : ""), (driverInfo->pre_release ? driverInfo->pre_release : ""));
if (evalBoard->getFTDriverInfo (&major, &minor, &patch))
{
LOGC ("FTDI Driver version: ", major, ".", minor, ".", patch);
Expand Down
5 changes: 3 additions & 2 deletions Source/devices/oni/rhythm-api/rhd2000ONIboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ bool Rhd2000ONIBoard::isUSB3()
int Rhd2000ONIBoard::open (const oni_driver_info_t** driverInfo)
{
ctx = oni_create_ctx ("ft600"); // "ft600" is the driver name for the usb
if (driverInfo)
getONIDriverInfo (driverInfo);
if (ctx == NULL)
return -1;
if (driverInfo)
getONIDriverInfo (driverInfo);


if (oni_init_ctx (ctx, -1) != ONI_ESUCCESS)
{
Expand Down

0 comments on commit d3120a7

Please sign in to comment.