How to save the data in files?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DhN_4227681
Level 4
Level 4
First like received

Hi,

I am using the FX2LP board to capturing the image in CYUSB_LINUX(like data are giving, that we should seen in 'infile' window). After giving data, how we should store that data in file). Is their any procedure to store the data in file. (In linux ).

pastedImage_0.png

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello Dhanuja,

The control center application in the linux SDK will allow to save the file only send a file through a loopback.

I have altered the application so that you can receive data and capture it in a file.

Please find the main.cpp file attached to this response.

Replace the main.cpp with the file attached here in the gui_src folder and do a sudo make in the same folder(gui_src) so that the main.o is regenerated.

Once this is done please follow the steps in the README file (in folder cyusb_linux_1.0.5) in the SDK to install the libcyusb library and GUI application.

After installing library and the GUI application  you can capture the received data in a file by selecting the proper endpoint and file location using the in-file box.

Mention the size of data that is to be received in the "Size(bytes)" box, and then click Receive.

Let me know is this is what you needed.

Best Regards,

Yatheesh

View solution in original post

0 Likes
32 Replies
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Dhanuja,

Please choose the in-file option and select a file to log/capture the received data to a the file, then you can receive the data from the FX2LP.

Best Regards,

Yatheesh

0 Likes

Hi,

We have already try this one. 1st we created the one empty file like .hex, .jpg and after that we click on the receive button, the data will giving in the cyusb_linux but in the file, its showing the empty(0 bytes transfer).

Before this, we should select the outfile path then we should select the infile path. Without selecting the outfile path, its showing on error.

Is their any steps to do that. Please tell the procedure.

how to view the image in linux.Is their any steps to do that. Please tell the procedure.

0 Likes
lock attach
Attachments are accessible only for community members.

Hello Dhanuja,

The control center application in the linux SDK will allow to save the file only send a file through a loopback.

I have altered the application so that you can receive data and capture it in a file.

Please find the main.cpp file attached to this response.

Replace the main.cpp with the file attached here in the gui_src folder and do a sudo make in the same folder(gui_src) so that the main.o is regenerated.

Once this is done please follow the steps in the README file (in folder cyusb_linux_1.0.5) in the SDK to install the libcyusb library and GUI application.

After installing library and the GUI application  you can capture the received data in a file by selecting the proper endpoint and file location using the in-file box.

Mention the size of data that is to be received in the "Size(bytes)" box, and then click Receive.

Let me know is this is what you needed.

Best Regards,

Yatheesh

0 Likes

Hi,

Which tool is suitable for host application(GUI) in Linux. In windows we are using Microsoft visual studio.

0 Likes

Hi,

Ok, we replace the main.cpp file,

We are selecting the infile i.e empty text or hex file,but  what must be the outfile we should give?

0 Likes

Hello Dhanuja,

For linux you can make use of QT for gui applications.

If you are using the main.cpp file which I shared, to log the received data to a file you dont need to give an out file.

Just select the file in which you need to log the data in the "in-file" box, input the number of bytes to be received in the "size" box and click on receive.

For testing this you can follow the below steps.

1. Program the loopback firmware on FX2LP

2. uncheck the loopback button and send data through out endpoint, say you send 8 bytes of data.

3. select the in-file where you want to log the data.

4. enter the size of bytes to be received in the "size" box, in this case its 8 bytes 

5. uncheck the loopback button and click on receive. This will log the data previously sent to the file selected in the "in-file" box.

Best Regards,

Yatheesh

0 Likes

Hi,

Ok, i will follow this steps given above.

And, i have another doubt i.e by adding the main.cpp, shall i uninstall the cyusb_linux and then replace the main.cpp during reinstalization. or directly replace the main.cpp file in present installed cyusb_linux

and also tell,how to uninstall cyusb_linux in ubuntu

0 Likes

when i'm replacing main.cpp file in gui_src and then i trying sudo make but i'm getting error

mangoh@mangoh-vm:~/Downloads/cyusb_linux_1.0.5/gui_src$ sudo make

make: *** No rule to make target '/usr/share/qt4/mkspecs/linux-g++-64/qmake.conf', needed by 'Makefile'.  Stop.

0 Likes

Hello Dhanuja,

Try sudo make clean and then sudo make.

Let me know if this works.

If the error still persists, then you will have to install qt4 again.

Best Regards,

Yatheesh

Hi,

I am successfully installed qt4, but now i am getting this error. can you help to solve this error.

main.cpp:74:13: note:   initializing argument 1 of ‘void libusb_error(int* (*)(), const char*)’

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

             ^~~~~~~~~~~~

main.cpp: In function ‘void in_callback(libusb_transfer*)’:

main.cpp:1874:67: error: cannot convert ‘libusb_transfer_status’ to ‘int* (*)()’ for argument ‘1’ to ‘void libusb_error(int* (*)(), const char*)’

   libusb_error(transfer->status, "Transfer not completed normally");

                                                                   ^

main.cpp: In function ‘void out_callback(libusb_transfer*)’:

main.cpp:1927:67: error: cannot convert ‘libusb_transfer_status’ to ‘int* (*)()’ for argument ‘1’ to ‘void libusb_error(int* (*)(), const char*)’

   libusb_error(transfer->status, "Transfer not completed normally");

                                                                   ^

Makefile:233: recipe for target 'main.o' failed

make: *** [main.o] Error 1

0 Likes

Hello Dhanuja,

Looks like you are using a older verion of libusb.

Please install the latest one.

Thanks,

Yatheesh

0 Likes

Hello Dhanuja,

Please refer the correct answer in this community thread Error compiling cyusb_linux_1.0.5 on Ubuntu 18.04 (again but different?)  where a similar issue is resolved.

Best Regards,

Yatheesh

thankyou for reply,

I am successfully solved above problem,and after follow the steps to make and ./install.sh (in cyusb_linux_1.0.5 ).then successfully installed but when i try to give a infile in cyusb_linux  but it's shows error like "cannot select infile when outfile is blank".

Whatever you gave main.cpp file that i replaced in gui_src,but i'm getting error.

0 Likes

I have another doubt i.e by adding the main.cpp.Before adding the main.cpp file in gui_src which you gave, Shall i uninstall the previous cyusb_linux and then replace the main.cpp in gui_src,during reinstalization. or directly replace the main.cpp file in present installed cyusb_linux

and also tell,how to uninstall cyusb_linux in ubuntu.

0 Likes

Hello Dhanuja,

You don't need to uninstall cyusb_linux, you can just replace the main.cpp file in the gui_src folder and do a sudo make, once this is successful, follow the steps mentioned in the README file which you followed while installing the cyusb_linux.

If the above is not successful, you can try to uninstall cyusb_linux by using the below command in the terminal:

unlink "/dev/shm/cyusb_linux"

and then restart the PC.

Best Regards,

Yatheesh

0 Likes

hi

I am trying to unlink "/dev/shm/cyusb_linux" but i'm getting

unlink: cannot unlink 'dev/shm/cyusb_linux': No such file or directory

0 Likes

Hello Dhanuja,

In that case, you can proceed with the installation.

Best Regards,

Yatheesh

0 Likes

I completed the installation,but when i try to give a infile in cyusb_linux  but it's shows error like "cannot select infile when outfile is blank".

please help me how to solve this problem

0 Likes

hello,

Please tell me how to uninstall cyusb_linux in pc,because I want reinstall the cyusb_linux

0 Likes

Hello Dhanuja,

Please make sure that you are using the main.cpp which i had given, also you can try a sudo make clean in the main package and then sudo make for re-installing it.

Best Regards,

Yatheesh

0 Likes

Hi

I am using same file,which you have giving main.cpp file,but i'm gettingmain (2).pnglin (2).png

Hello Dhanuja,

Please click on receive button in the GUI and check the terminal if its printing "receive clicked".

I have altered the main.cpp to print "receive clicked" in the terminal when the receive button is clicked.

If "receive clicked" is not reported in the terminal, then the main.cpp which I have given in not running. If that is the case, in the gui_src folder please delete main.cpp and main.o, and then replace it with the file which I gave and do a sudo make clean and sudo make in the folder and re-install the gui by following the steps mentioned in the SDK.

Best Regards,

Yatheesh

Hi,

I tried everything which you have gave, but i am facing the same previous problem.rcve (2).png

0 Likes

Hello Dhanuja,

Did you see "receive clicked" printed on the terminal (not the gui) when you clicked the receive button in the gui?

Best Regards,

Yatheesh

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

i am using this command "sudo rm -rf /usr/local/bin/cyusb_linux" for uninstalling the cyusb_linux and i replace the main.cpp file what you have gave and installed successfully.

In terminal, i am receiving the value and also i select the infile path to save the data, but the saved data and obtained terminal data are different. I tried in  .hex , .txt, and .jpeg

pastedImage_1.png

0 Likes

Hello,

The terminal will display the data in hex and in the file it is saved in Ascii. Please try sending Ascii characters using the "send" option in the GUI and receiving the data directly to a file.

Best Regards,

Yatheesh

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

Now, i am getting the same value in terminal window and saved file and we saw the saved file in irfanview, we are getting the distorted image. I have a doubt on cyusb_linux version? Presently, i am using the cyusb_linux version is 1.0.5. Is their any problem in firmware side or cyusb_linux driver side?

0 Likes

Hello Dhanuja,

cyusb_linux_1.0.5 is the latest version. Please refer to the release notes for known problems and limitations in the SDK.

You will need to develop your own host application for capturing image the image from the FX2LP device. Please refer to the cyusb_linux_programmers_guide in the cyusb_linux_1.0.5->docs folder, where application level APIs are documented.

Thanks,

Yatheesh

0 Likes
lock attach
Attachments are accessible only for community members.

Hi,

Can i change anything in this code to get a proper image.

0 Likes
user_4644856
Level 1
Level 1
First like received First like given

Thanks for this thread guys, I found how to solve my problem here

0 Likes

Hi,

Your getting the proper image in this configuration thread?. But we are not getting the proper image in this configuration.

0 Likes

Hello Dhanuja,

Please check if the firmware and the host application you are using is receiving the data properly from the image sensor and converting it into a image.

Thanks,

Yatheesh

0 Likes