PDA

View Full Version : Communicating with a USB device in Qt?



N3wb
19th December 2009, 01:00
Is there any kind of USB library for Qt that simplifies communication with an HID or CDC USB device?

I have a microcontroller that I am trying to communicate with (a PIC18F4550) over USB, and I think that using either the HID or CDC would be the easiest, but I'm not really sure how to do this.

Appreciate any advice you might have :D

squidge
19th December 2009, 02:10
Which OS?

Cross platform? No.

Linux? Well there is libusb.
Embedded Linux? There's QtExtended.

N3wb
19th December 2009, 20:21
Sorry, I meant to say that I'm using Windows. And no, it doesn't need to be cross platform.

Tanuki-no Torigava
20th December 2009, 04:04
Check WinAPI reference (http://msdn.microsoft.com/en-us/library/aa476426.aspx). Suer you can find different sources as well.

Regards,
-- tanuki

squidge
20th December 2009, 10:20
I have a microcontroller that I am trying to communicate with (a PIC18F4550) over USB, and I think that using either the HID or CDC would be the easiest, but I'm not really sure how to do this.The typical way on Windows would be to write a device driver for that device, and then communicate with that. Most people doing this seem to use a virtual serial port driver for the task as you can then just open the driver and use normal file I/O.

N3wb
20th December 2009, 18:32
Up until now I've been using an RS-232 to USB converter, but now I'm thinking about going the HID route. Someone recommended that I use CDC, but I kind of feel like that's a half step forward from RS-232 and that I might as well make the move to the USB standard.

An HID device would not require me writing a driver, correct?

squidge
20th December 2009, 20:46
In that case, maybe this page will be useful for you: http://www.alanmacek.com/usb/

caodungviet
3rd May 2011, 11:30
thank you so much!