Qt demo app (C++) that talks to a USB device

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

If any of you folks need a demo app using Qt that does USB transfers over a device, you can use the one attached to this post.

   

 

   

This project is compiled with MinGW and so CyAPI was also recompiled accordingly. The source project for that is in the CyAPI_lib_cpp folder and a simple makefile is included with that (you may need to modify that to make it work on your PC).

The Qt app itself is very simple -- it lists out all devices attached to cyusb3.sys and then enumerates the endpoints in a ComboBox. When you then click the "transfer data" button, it reads/writes 1 packet from/to the device.

   

 

   

Note that this is a very crude demo project. It's probably has bugs and is not good for production use as-is.

0 Likes
1 Solution
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

检查有没有在头文件中声明,但在程序中未使用的头文件,删除或注释即可

或者申明了变量但是没有实现

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

One update to the code:

   

 

   

The transfer buffer should be declared as UCHAR xferBuffer[...] and not UCHAR * xferBuffer[..]. An unfortunate typo on my part!

0 Likes
Anonymous
Not applicable

hi, thank you for your project. i have a problem with your project.when i run make in the project folder in cmd, the result is:

   

the system cannot find the pass specified.
can you attach Qt  .pro directly?
thanks again

0 Likes
lock attach
Attachments are accessible only for community members.
Sui_2021
Level 1
Level 1
First reply posted Welcome!

您好,我下载您的demo运行的时候,在window10环境qtcreator,编译器2010下运行,编译总是提示mainwindow.obj:-1: error: LNK2019: 无法解析的外部符号 "public: bool __thiscall CCyUSBDevice::Open(unsigned char)" (?Open@CCyUSBDevice@@QAE_NE@Z),该符号在函数 "public: void __thiscall MainWindow::listItemClicked(class QListWidgetItem *)" (?listItemClicked@MainWindow@@QAEXPAVQListWidgetItem@@@Z) 中被引用等问题,想问下如何解决

0 Likes
YiZ_31
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

检查有没有在头文件中声明,但在程序中未使用的头文件,删除或注释即可

或者申明了变量但是没有实现

0 Likes