Problems compiling gtec usbamp driver

Obtaining data from various hardware devices
Post Reply
BTD
Posts: 1
Joined: Mon Nov 02, 2020 5:34 pm

Problems compiling gtec usbamp driver

Post by BTD »

Hi All,

I have a g.USBamp that I am trying to get recognised by openvibe-acquisition application on a Linux Mint system. I have installed the gUSBAmp Linux drivers (I've tried v14 and 16) - these are in the /usr/lib directory. The FindThirdPartyGUSBampCAPI.cmake was edited and the drivers were found during build, but later I get a stream of errors....

/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp: In constructor ‘OpenViBE::AcquisitionServer::CDriverGTecGUSBampLinux::CDriverGTecGUSBampLinux(OpenViBE::AcquisitionServer::IDriverContext&)’:
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:87:57: error: invalid static_cast from type ‘gt_usbamp_device_mode* {aka usbamp_device_mode*}’ to type ‘int*’
m_settings.add("Mode", static_cast<int*>(&m_config.mode));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:88:82: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add("EnableTrigger", static_cast<bool*>(&m_config.enable_trigger_line));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:89:65: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add("ScanDIO", static_cast<bool*>(&m_config.scan_dio));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:90:69: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add("SlaveMode", static_cast<bool*>(&m_config.slave_mode));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:91:73: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add("EnableShortcut", static_cast<bool*>(&m_config.enable_sc));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:92:77: error: invalid static_cast from type ‘gt_usbamp_analog_out_shape* {aka usbamp_analog_out_shape*}’ to type ‘int*’
m_settings.add("AnalogOutShape", static_cast<int*>(&m_analogOutConfig.shape));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:93:85: error: invalid static_cast from type ‘short int*’ to type ‘int*’
m_settings.add("AnalogOutFrequency", static_cast<int*>(&m_analogOutConfig.frequency));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:94:85: error: invalid static_cast from type ‘short int*’ to type ‘int*’
m_settings.add("AnalogOutAmplitude", static_cast<int*>(&m_analogOutConfig.amplitude));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:95:79: error: invalid static_cast from type ‘short int*’ to type ‘int*’
m_settings.add("AnalogOutOffset", static_cast<int*>(&m_analogOutConfig.offset));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:103:92: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add(gndConfigName.str().c_str(), static_cast<bool*>(&m_config.common_ground));
^
/home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp:104:92: error: invalid static_cast from type ‘gt_bool* {aka unsigned int*}’ to type ‘bool*’
m_settings.add(configName.str().c_str(), static_cast<bool*>(&m_config.common_reference));

The build then exits with:

applications/platform/acquisition-server/CMakeFiles/openvibe-acquisition-server.dir/build.make:1766: recipe for target 'applications/platform/acquisition-server/CMakeFiles/openvibe-acquisition-server.dir/__/__/__/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp.o' failed

then...
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Error while building extras

Any ideas to overcome this?

Thanks

Thomas
Posts: 17
Joined: Wed Mar 04, 2020 3:38 pm

Re: Problems compiling gtec usbamp driver

Post by Thomas »

Hi,

Looks like there is a problem with the static_cast.

An easy way to overcome this is to edit the file /home/brix07/openvibe-3.0.0-beta-src/extras/contrib/plugins/server-drivers/gtec-bcilab/src/ovasCDriverGTecGUSBampLinux.cpp and replace the static casts with C-style casts.

For example, replace:

Code: Select all

m_settings.add("Mode", static_cast<int*>(&m_config.mode));

with:

Code: Select all

m_settings.add("Mode", (int*)&m_config.mode);
Let me know how you get on.

Cheers,
Thomas

Post Reply