Compiling hidtool in VS2008 (C++)

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
figureouturself
Posts: 2
Joined: Mon Aug 17, 2009 6:37 am

Compiling hidtool in VS2008 (C++)

Post by figureouturself » Sat Oct 03, 2009 4:23 pm

I have a project in Visual Studio 2008, in C++, that draws some text to a window using OpenGL. My device has an accelerometer in it. I'd like to retrieve the information via USB and display that on the screen.I'm using the hid-data example as the base for reading from a V-USB device. I can compile and run hidtool as a command line program using MinGW, and it works fine, but how do I port it to C++ in VS2008? Preferably without using libusb-win32.

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Compiling hidtool in VS2008 (C++)

Post by maxi » Sat Oct 03, 2009 5:06 pm

I did something very similar a while back using the hid-data example and OpenGL to display a simple oscilloscope trace. I compiled it with VC 2005 Express but 2008 should be fine too! There should be no need for libusb-win32 however you will need some elements of the MS DDK. At the time I just downloaded the entire DDK (it's a BIG download) but have since learned that all that is required are a few Kb's worth of header files that you probably already have on your system if you installed MinGW. Here's a couple of links you might find useful. The second refers to PIC Micros but if you scroll down the page a bit you will find links to the neccessary files.

http://www.lvr.com/hidpage.htm

http://www.alanmacek.com/usb/

Hope it helps.

figureouturself
Posts: 2
Joined: Mon Aug 17, 2009 6:37 am

Re: Compiling hidtool in VS2008 (C++)

Post by figureouturself » Sat Oct 03, 2009 6:35 pm

Thanks for the reply. I'll have a look into those. I don't mind big downloads, I just leave them on overnight but if MinGW already has them, all the better. Just in case though, is that the Windows Driver Kit (quick search on Google said the DDK was superseded by the WDK)?

maxi
Rank 3
Rank 3
Posts: 122
Joined: Fri Jul 24, 2009 6:13 pm

Re: Compiling hidtool in VS2008 (C++)

Post by maxi » Sat Oct 03, 2009 7:05 pm

Well I'm not entirely sure but looking at Jan's page mentioned above, it looks like WDK should also work. That said, if you can get the example to compile with MinGW then you will already have the header files. On my system they are located in C:\MinGW\include\ddk

I might also point out that you will most likely receive compiler error/warnings about things like strcmp which you need to replace with _strcmpi IIRC. My advice would be just try to compile it and tackle each thing it complains about until it works :wink:

<edit>For more accurate, up-to-date and complete info see: http://forums.obdev.at/viewtopic.php?f=8&t=3388</edit>

Post Reply