cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor

Getting a compile error from Install.sh script in FX3 SDK. In main.cpp. Looks disturbing, should be ok?

Loading the SDK on a Raspberry PI 4-B with Raspbian OS:

root@raspberrypi:/home/pi/Documents/FX3SDK/cyusb_linux_1.0.5/lib# uname -a

Linux raspberrypi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux

I previously loaded 'LIBUSB' when working with the FTDI device, if that matters?

Here is copy of shell and snippet of main.cpp, looks as if caller to function and function both declare parm1 as int, but compiler

says trying to convert from int to int*(*)()?

root@raspberrypi:/home/pi/Documents/FX3SDK/cyusb_linux_1.0.5# ./install.sh

Your current directory is /home/pi/Documents/FX3SDK/cyusb_linux_1.0.5. This is where the cyusb_suite software will be installed...

g++ -fPIC -o lib/libcyusb.o -c lib/libcyusb.cpp

g++ -shared -Wl,-soname,libcyusb.so -o lib/libcyusb.so.1 lib/libcyusb.o -l usb-1.0 -l rt

cd lib; ln -sf libcyusb.so.1 libcyusb.so

rm -f lib/libcyusb.o

rm -f moc_controlcenter.cpp

rm -f ui_controlcenter.h

rm -f controlcenter.o main.o fx2_download.o fx3_download.o streamer.o moc_controlcenter.o

rm -f *~ core *.core

/usr/lib/arm-linux-gnueabihf/qt4/bin/uic controlcenter.ui -o ui_controlcenter.h

g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o controlcenter.o controlcenter.cpp

g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp

main.cpp: In function :

main.cpp:133:17: error: invalid conversion from 'int' to 'int* (*)()' [-fpermissive]

libusb_error(r, "Error in 'get_active_config_descriptor' ");

                                  ^

In file included from /usr/include/c++/8/cerrno:42,

from /usr/include/c++/8/ext/string_conversions.h:44,

from /usr/include/c++/8/bits/basic_string.h:6400,

from /usr/include/c++/8/string:52,

from /usr/include/qt4/QtCore/qstring.h:54,

from /usr/include/qt4/QtCore/qobject.h:48,

from /usr/include/qt4/QtCore/qiodevice.h:46,

from /usr/include/qt4/QtCore/qxmlstream.h:45,

from /usr/include/qt4/QtCore/QtCore:3,

from main.cpp:11:

main.cpp:74:30: note: initializing argument 1 of

static void libusb_error(int errno, const char *detailedText)

                               ^

snippet main.cpp code in ~/cyusb_linux_1.0.5/gui_src:

static void libusb_error(int errno, const char *detailedText)

{

char msg[30];

char tbuf[60];


memset(msg,'\0',30);

memset(tbuf,'\0',60);

QMessageBox mb;

if ( errno == LIBUSB_ERROR_IO )

strcpy(msg, "LIBUSB_ERROR_IO");

else if ( errno == LIBUSB_ERROR_INVALID_PARAM )

strcpy(msg, "LIBUSB_ERROR_INVALID_PARAM" );

else if ( errno == LIBUSB_ERROR_ACCESS )

strcpy(msg, "LIBUSB_ERROR_ACCESS");

else if ( errno == LIBUSB_ERROR_NO_DEVICE )

strcpy(msg, "LIBUSB_ERROR_NO_DEVICE");

else if ( errstatic void libusb_error(int errno, const char *detailedText)

{

char msg[30];

char tbuf[60];


memset(msg,'\0',30);

memset(tbuf,'\0',60);

QMessageBox mb;

if ( errno == LIBUSB_ERROR_IO )

strcpy(msg, "LIBUSB_ERROR_IO");

else if ( errno == LIBUSB_ERROR_INVALID_PARAM )

strcpy(msg, "LIBUSB_ERROR_INVALID_PARAM" );

else if ( errno == LIBUSB_ERROR_ACCESS )

strcpy(msg, "LIBUSB_ERROR_ACCESS");

else if ( errno == LIBUSB_ERROR_NO_DEVICE )

strcpy(msg, "LIBUSB_ERROR_NO_DEVICE");

else if ( errno == LIBUSB_ERROR_NOT_FOUND )

strcpy(msg, "LIBUSB_ERROR_NOT_FOUND");

else if ( errno == LIBUSB_ERROR_BUSY )

strcpy(msg, "LIBUSB_ERROR_BUSY");

else if ( errno == LIBUSB_ERROR_TIMEOUT )

strcpy(msg, "LIBUSB_ERROR_TIMEOUT");

else if ( errno == LIBUSB_ERROR_OVERFLOW )

strcpy(msg, "LIBUSB_ERROR_OVERFLOW");

else if ( errno == LIBUSB_ERROR_PIPE )

strcpy(msg, "LIBUSB_ERROR_PIPE");

else if ( errno == LIBUSB_ERROR_INTERRUPTED )

strcpy(msg, "LIBUSB_ERROR_INTERRUPTED");

else if ( errno == LIBUSB_ERROR_NO_MEM )

strcpy(msg, "LIBUSB_ERROR_NO_MEM");

else if ( errno == LIBUSB_ERROR_NOT_SUPPORTED )

strcpy(msg, "LIBUSB_ERROR_NOT_SUPPORTED");

else if ( errno == LIBUSB_ERROR_OTHER )

strcpy(msg, "LIBUSB_ERROR_OTHER");

else strcpy(msg, "LIBUSB_ERROR_UNDOCUMENTED");


sprintf(tbuf,"LIBUSB_ERROR NO : %d, %s",errno,msg);

mb.setText(tbuf);

mb.setDetailedText(detailedText);

mb.exec();

return;

}


static void update_devlist()

{

int i, r, num_interfaces, index = 0;

char tbuf[60];

struct libusb_config_descriptor *config_desc = NULL;


mainwin->listWidget->clear();


for ( i = 0; i < num_devices_detected; ++i ) {

h = cyusb_gethandle(i);

sprintf(tbuf,"VID=%04x,PID=%04x,BusNum=%02x,Addr=%d",

cyusb_getvendor(h), cyusb_getproduct(h),

cyusb_get_busnumber(h), cyusb_get_devaddr(h));

mainwin->listWidget->addItem(QString(tbuf));

r = cyusb_get_active_config_descriptor (h, &config_desc);

if ( r ) {

libusb_error(r, "Error in 'get_active_config_descriptor' ");

return;

}




root@raspberrypi:/home/pi/Documents/FX3SDK/cyusb_linux_1.0.5/lib# uname -a

Linux raspberrypi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux


0 Likes
Reply
1 Solution
Moderator
Moderator

Hi,

Please replace all the instances of errno in gui_src/main.cpp to _errno.

You can also have a look at marked correct answer in the thread: EZ-USB-FX3 SDK for Linux fails to compile

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
Reply
1 Reply
Moderator
Moderator

Hi,

Please replace all the instances of errno in gui_src/main.cpp to _errno.

You can also have a look at marked correct answer in the thread: EZ-USB-FX3 SDK for Linux fails to compile

Regards,

Hemanth

Hemanth

View solution in original post

0 Likes
Reply