USB Programming with Qt - c++

Is there anyway I can do USB programming in Qt? I am using Qt Creator 2.6 which is based on Qt version 5.0.0 and it is the latest Qt Creator which works with the Microsoft Visual Studio 2010 compiler.
I have the toy called "Dreamcheeky Thunder Missile Launcher" and I need to program this USB based device.
I have tried LibUSB but it messed up everything. It even renamed the device port and I had to undo everything using USBDview software. But I guess I installed it incorrectly. I followed these instructions. It is instructions for 64 bit, but I got 32 bit and since the instructions seems not to have big difference (instead the download file) I followed it. This is what I downloaded - libusb-win32-bin-1.2.6.0.zip
Whatever the API you recommend it doesn't matter, even libusb, but please be kind enough to tell me how to install it properly.
My OS is windows 7 ultimate 32 bit.

ollo's answer is out of date. TL;DR is use libusb.info. A bit of explanation:
Originally there was libusb-0.1. Later they updated the API to libusb-1.0, but since libusb-0.1 had been around so long many projects didn't bother switching (kind of like Python 2/3). libusb-0.1 was not available for Windows, but libusb-1.0 is now available for all major platforms.
libusb-win32 is a port of libusb-0.1 to Windows. You shouldn't use it for new code.
libusb.org is the old website for libusb. The latest release is from 2012 and there are no Windows downloads.
libusb.info is the current website for libusb. It contains libusb-1.0 downloads for all platforms and you should use this for new code.
To further confuse things, the sourceforge libusb-win32 mailing list is still used for libusb.info's development.

There's another good instruction for libusb here: http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/
libusb:
libusb
libusb-win32 (windows port - use this on windows!)
If you stay on windows you can use
WinUSB:
WinUSB API
Example
Installation
For windows you can use both, but if your program has to be cross-platform you should use libusb.

Related

Is there a Qt solution for detecting USB events (insertion and removal)?

As some other people already asked here some years ago, I want to be able to detect in a Qt application when a pendrive/datatraveler is plugged and when it is unplugged in my system (both in Linux Ubuntu and Embedded Linux).
I searched in SO and I noticed that most answers not only were very outdated (from 2010 for example), but all solutions somehow involved "non-Qt solutions" to these problem: either platform specific or usage of external libraries such as udev and DBus.
What I want to know first of all is if there is a specific Qt solution for this, i.e. a way to do this without requiring adding external libs or platform specific codes, and how could I use it. Preferentially it should already be available in Qt 4.8. If there is no Qt solution, then a Qt-based library would be acceptable.
Add: Search results:
USB Programming with Qt: Suggests libusb and WinUSB API
Detecting USB notification in Qt on windows: Windows only
How do I detect usb drive insertion in Linux?: Suggests libudev
How to get USB notifications under linux / Qt?: Suggests DBus
How to know when a new USB storage device is connected in Qt?: Windows only
How to detect USB device disconnect under Linux/Qt/C++: Linux only, suggests HAL, DeviceKit and udev
Is there a C++ cross platform USB library?: Suggests libusbx
As already pointed out, Qt itself does not provide such a module. There is however a user-made class called QDeviceWatcher. I have no experience with it personally and it is not updated regularly but you could give it a try.
You can find the forum post here and the git repository here.
No such API in Qt, but you can go on with some platform-wise implementations of libusb, which is quite awesome.
Just one more tip:
libusbx was a fork of libusb, a library that provides generic access to USB devices.
As of 2014.01.26, this project has been fully merged back into libusb and is being discontinued.
Since there will be no further releases of libusbx, you are strongly encouraged to switch to using libusb. -----from https://web.archive.org/web/20150519101032/http://libusbx.org/

Programming for Windows Phone 8 (and beyond) on GNU/ Linux

Since the VideoLAN programmers do write Windows 8/RT/Phone apps using Linux based operating systems and GCC I was wondering, whether there is some progress in regard to how to program for Windows in a Linux environment, where Windows is used only for testing. How easy/ hard is it, to program a Windows RT (modern UI whatever)/ Windows Phone 8 application on Linux?
I imagine a situation, where you use tools such as Git, Emacs/ VIM, GCC, Mono etc. to do the job. How about submitting the app without Visual Studio?
I ask, because Microsoft open-sourced so much stuff now, using Linux based OS for development could (should?) become feasible while developing apps for their systems. Does anybody have some behind the scenes information on this? It is very hard to find some relevant info.
Note I edited this question to be more "straight to the point"
Links:
This is the VLC Kickstarter page: https://www.kickstarter.com/projects/1061646928/vlc-for-the-new-windows-8-user-experience-metro
I'm a software engineer at Microsoft so I think I could give you some insights on this.
From a testing perspective, you should definitely have a Windows machine to test against. You can install Windows 8 as a VM using Virtual Box or something similar. You could also remote into a Windows machine if you have access to one.
Visual Studio can't be installed in Linux, as you know, but there are other C#/ASP.NET/etc. IDE's that you can use natively on Linux. Look into Wine for Linux: http://www.winehq.org/about/. It may help you somewhat.
As an aside, developing applications for Windows will be getting easier in the coming months. As was announce at MS Build, Microsoft is moving towards a universal app store that will make your app run on all Windows devices: PC, tablet, phone, and Xbox. This doesn't help with developing apps on Linux, but if you're a Windows developer, you might want to keep your eyes open about the new universal-style apps.

Is there a downloadable distribution of Thrift for Windows?

I've been reading quite a bit about Thrift and it looks like a technology I'd really like to use. I'm having all sorts of trouble building the Windows distribution. I know a patch exists to build a Windows version, however I have not had much luck with this either.
Does anyone know of a pre-built distribution for Windows?
Or any suggestions on how to get the latest version of Thrift built (without turning my Windows machine into a pseudo *nix box).
Thanks
Rich
Thrift 0.8 now has VS projects for both the compiler and C++ library. Get the snapshot release or the latest off of SVN
http://thrift.apache.org/download/
Edit: 0.8 has been officially released and the source is available as a tarball on the download page.
Edit2: The SVN trunk now has a cross-platform sample project under thrift/contrib/transport-sample
I ported the client part of Thrift to Windows C++ for my own open-source project. It should be easily usable in other Win32 or WinCE projects.
http://peoplesnote.codeplex.com - src\Evernote API\Thrift
Yes there is, just download the exe from here:
http://thrift.apache.org/download/
exe listed for download there is standalone executable, no installation is needed.
I have used it to generate Smalltalk code, did not test other languages.

porting kde application to windows

hy
I'm trying to port a KDE application to windows
my problem is finding a suitable KDE SDK for windows, i can't include any k-headers (kapplication.h kaction.h ....) and I haven't even got to the libs
is there a guide for doing things like this
KDE 4 is intended to natively support windows so it should be less of a "porting" effort and more of a "getting it to compile as-is" effort (though there will likely be a few minor changes). You should be able to find the relevant information on the KDE on Windows site. Specifically, there is a porting section in their wiki for ensuring KDE apps run under windows.

What tools do you use to profile (native)C++ on Windows?

How do Window's programmers profile their native C++ code?
On Unix/Linux you have gprof [thanks Evan] & valgrind (I personally used this one, although it's not a real profiler), and recently I'm on Mac and Solaris, which means I moved to dTrace. Now when I've had the need to profile on Windows in the past, like at my previous job, I used Intel's vtune, which is great, however it's commercial, and I don't have a license for private use, so I'm left wondering what's the standard (free is better) tool windows programmers commonly use?
Thanks in advance
You should give Xperf a try - it's a new system wide performance tool that can drill down to a particular application and what exactly it's doing inside itself as well as what's it's asking of the OS.
It's freely available on the Windows SDK for Windows Server 2008 and .NET Framework 3.5 ISO:
Install the SDK by downloading the ISO image, or using the Web based
installer.
Find the xperf MSI in the SDK's "bin" directory. It will be named
xperf_x86.msi, xperf_x64.msi, or
xperf_ia64.msi, depending on the
architecture for which you install the
SDK.
You can then install the xperf tools from the MSI directly, or copy
the xperf MSI file to another location
and install it from there. For
example, you could keep the MSI files
on a USB key.
Source: Pigs Can Fly blog on MSDN.com
Just verified that the xperf msi will not install except on windows Vista or Windows 2007.
-Adam
I got AMD Code Analyst. It's free, and you don't need an AMD CPU ;)
It's a little basic compared to something like Intel's VTune, but the price is right.
This link talks about Linux, but I use the same technique in MSVC and in C#.