Skip to content

Commit

Permalink
Fix failing to create and initialize context
Browse files Browse the repository at this point in the history
Add and link missing riffa driver translator library
  • Loading branch information
anjaldoshi committed Dec 7, 2023
1 parent 9e6be62 commit eb7ee41
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ if (MSVC)
set(LIBONI_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libONI/win64)
target_link_libraries(${PLUGIN_NAME} "${LIBONI_LIB_DIR}/liboni.lib")
target_link_libraries(${PLUGIN_NAME} "${LIBONI_LIB_DIR}/riffa.lib")
install(FILES ${LIBONI_LIB_DIR}/liboni.dll DESTINATION ${GUI_BIN_DIR}/shared CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
install(FILES ${LIBONI_LIB_DIR}/riffa.dll DESTINATION ${GUI_BIN_DIR}/shared CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})
target_link_libraries(${PLUGIN_NAME} "${LIBONI_LIB_DIR}/onidriver_riffa.lib")
install(DIRECTORY ${LIBONI_LIB_DIR}/ DESTINATION ${GUI_BIN_DIR}/shared FILES_MATCHING PATTERN "*.dll")
elseif(LINUX)
find_library(LIBONI_LIBRARIES oni liboni PATHS ${CMAKE_CURRENT_SOURCE_DIR}/libONI/linux)
target_link_libraries(${PLUGIN_NAME} ${LIBONI_LIBRARIES})
Expand Down
6 changes: 3 additions & 3 deletions Source/OnixSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ void OnixSource::updateSettings(OwnedArray<ContinuousChannel>* continuousChannel

ctx = oni_create_ctx("riffa"); // "riffa" is the PCIe driver name

if (!ctx) { LOGD("Failed to create context."); return; }
if (!ctx) { LOGE("Failed to create context."); return; }

// Initialize context and discover hardware
int errorCode = oni_init_ctx(ctx, 0);

if (errorCode) { LOGD("Error: ", oni_error_str(errorCode)); return; }
if (errorCode) { LOGE(oni_error_str(errorCode)); return; }

oni_size_t num_devs = 0;
oni_device_t* devices = NULL;
Expand All @@ -82,7 +82,7 @@ void OnixSource::updateSettings(OwnedArray<ContinuousChannel>* continuousChannel

size_t devices_sz = sizeof(oni_device_t) * num_devs;
devices = (oni_device_t *)realloc(devices, devices_sz);
if (devices == NULL) { LOGD("No devices found."); return; }
if (devices == NULL) { LOGE("No devices found."); return; }
oni_get_opt(ctx, ONI_OPT_DEVICETABLE, devices, &devices_sz);

// print device info
Expand Down
Binary file modified libONI/win64/liboni.dll
Binary file not shown.
Binary file modified libONI/win64/liboni.lib
Binary file not shown.
Binary file added libONI/win64/libonidriver_riffa.dll
Binary file not shown.
Binary file added libONI/win64/onidriver_riffa.lib
Binary file not shown.
Binary file modified libONI/win64/riffa.dll
Binary file not shown.
Binary file modified libONI/win64/riffa.lib
Binary file not shown.

0 comments on commit eb7ee41

Please sign in to comment.