Keil Logo Arm Logo

hid client example

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Doug Funny
Posted
25-Jun-2008 21:28 GMT
Toolset
ARM
New! hid client example

Hello,
I have bought the Keil development tool for mcb2148 and I'm trying to compile the HID client example that comes with it... However using borland c++ 6 I get lots of error messages. If anyone knows how to solve this please leave me a note.
Thanks
Doug

Read-Only
Author
Tsuneo Chinzei
Posted
26-Jun-2008 04:51 GMT
Toolset
ARM
New! RE: hid client example

I don't want to take the trouble to port the code to another development platform,
but if it has much meaning for you, these are the point.

- The code is written for MS VC++ with MFC
- The code requires HID and SetupDi- header files and library

I've heard recent C++ builder supports MFC, but not sure.
Ask it on this forum,

borland.public.cppbuilder.ms_compatibility
http://groups.google.com/group/borland.public.cppbuilder.ms_compatibility/topics



As of HID and SetupDi- header files and library,
Officially, these files are included in WinDDK.
Free WinDDK (Server 2k3 SP1 DDK) is downloaded from MS

"DDK - Windows Driver Development Kit" from MS WHDC
http://www.microsoft.com/whdc/DevTools/ddk/default.mspx
Find "Download the Windows Server 2003 SP1 DDK [236 MB ISO file]" link

OR

On the Intel Press site for the book, "USB Design by Example",
you'll find an excerpt of HID files from Win2K DDK. :-)

FromDDK.zip
http://www.intel.com/intelpress/usb/examples/ZipFiles/FromDDK.htm

Tsuneo

Read-Only
Author
Doug Funny
Posted
4-Jul-2008 15:21 GMT
Toolset
ARM
New! RE: hid client example

Tsuneo, these are the errors I get... Do you know what could cause this?

 D:\WINDDK\3790.1830\inc\mfc42\afxres.rc(152) : error RC2135 : file not found: res\help.cur
D:\WINDDK\3790.1830\inc\mfc42\afxres.rc(171) : error RC2135 : file not found: res\3dcheck.bmp
D:\WINDDK\3790.1830\inc\mfc42\afxres.rc(194) : error RC2135 : file not found: res\minifwnd.bmp
D:\WINDDK\3790.1830\inc\mfc42\afxres.rc(199) : error RC2135 : file not found: res\ntcheck.bmp
D:\WINDDK\3790.1830\inc\mfc42\afxres.rc(200) : error RC2135 : file not found: res\95check.bmp

Read-Only
Author
Per Westermark
Posted
4-Jul-2008 19:22 GMT
Toolset
ARM
New! RE: hid client example

Now, what could the probable causes be that a compiler fails to find files? Care to take a guess?

- That you don't have any files with that name on your hard drive?
- That you have the files, but that you haven't instructed the tool to process that specific directory?
- That you have the files, but have specified any access rights that forbidds the compiler from accessing them (not too common problem on Win32 machines)

So, time for you to start figuring out why you get these error messages, since we can not guess what files you have in your machine or where they are stored or where you have allowed the compiler to search...

Read-Only
Author
Doug Funny
Posted
4-Jul-2008 20:31 GMT
Toolset
ARM
New! RE: hid client example

I have the files on my machine. But I don't know where to include .bmp files. I have tried putting them on the folders that are included on the vc++ directories but that didn't work.

Read-Only
Author
Doug Funny
Posted
4-Jul-2008 20:45 GMT
Toolset
ARM
New! RE: hid client example

I figured it out, the /res folder didn't exist on the mfc so I created it and put the files there. It worked sorry about bugging you guys... and thanks !

Read-Only
Author
Tsuneo Chinzei
Posted
5-Jul-2008 02:42 GMT
Toolset
ARM
New! RE: hid client example

You seem to get into the porting trouble of MFC (Microsoft Foundation Class).
I think it is the waste of your valuable time.
Rather, split out the example code into building blocks, and ignore the GUI and framework of MFC.

The essential blocks for USB handling are,
- The SetupDi-APIs are used to specify the device, and to get the device handle.
- USB communication is done over this device handle, using File I/O, CreateFile - ReadFile - WriteFile - CloseHandle.

These code are stereotype one, and they works either in MSVC or C++ builder without modification, because these code use just the Windows APIs directly. Plug these blocks into the framework and GUI of C++ builder.

Blind porting doesn't bring you any understanding of USB handling.

Tsuneo

Read-Only
Author
Andy Neil
Posted
5-Jul-2008 13:37 GMT
Toolset
None
New! RE: Blind porting doesn't bring you any understanding of USB handling

I think the same can be said of any example code - not just USB!

Read-Only
Author
Doug Funny
Posted
8-Jul-2008 22:37 GMT
Toolset
ARM
New! RE: hid client example

Tsuneo,
I've done just what you told me to. I'm using 64 bytes repots just like you've explained on another post. Still I don't get outreports from my application. What could be the cause of this? Any ideas on what sort of test should I do?

Read-Only
Author
Doug Funny
Posted
9-Jul-2008 18:29 GMT
Toolset
ARM
New! RE: hid client example

I wonder if this specific example doesn't work with vc++ 2008 express edition. Maybe it was compiled with some earlier version of the software, but all I know is that it doesn't work, the closest I've got for the example were linker errors.

Read-Only
Author
Tsuneo Chinzei
Posted
11-Jul-2008 09:00 GMT
Toolset
ARM
New! RE: hid client example

"I wonder if this specific example doesn't work with vc++ 2008 express edition."

Unfortunately, Express edition doesn't support MFC. Just .Net FrameWork.

Tsuneo

Read-Only
Author
Andy Neil
Posted
5-Jul-2008 13:29 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

My C++ Builder v5 - which is pretty old now - supports MFC...

Read-Only
Author
Doug Funny
Posted
6-Jul-2008 18:44 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

Ok I'll tell you guys what I have done so far... Since where I work people are experienced with BC++ I have to use the compiler to make my application. With that said what I did was, there's a tool on the BC called "Visual C++ project conversion utility" so I used it on the HID example code from Keil. So I got an application that works fine for HID. But here comes the problem, I followed Tsuneo steps to make 64 bits in and out reports, on the arm everything works fine. I've got a sniffer looking at the packages that were being exchanged and I only get in reports. Out reports dont work with my application. How do I know that? I wrote code on the arm so it would set a led when outreport was received, then I used my sniffer to send out reports and the led was set.

Read-Only
Author
Per Westermark
Posted
9-Jul-2008 19:02 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

"I wonder if this specific example doesn't work with vc++ 2008 express edition."

To my knowledge, the Express edition doesn't have support for MFC. It was at least missing in a previous version of the Express edition that I looked at.

Read-Only
Author
Doug Funny
Posted
9-Jul-2008 20:14 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

Bummer huh, subscription of the standard version costs something like U$1200.
Also I can't get Tsuneo's idea of separating the software into blocks to work on bcb 6 with 64 byte reports, using 8 bit report works fine.

Read-Only
Author
Doug Funny
Posted
10-Jul-2008 22:14 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

Does anybody know a software to test my win application? Not a sniffer but something that would emulate the hid device?

Read-Only
Author
Tsuneo Chinzei
Posted
11-Jul-2008 09:16 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

"Does anybody know a software to test my win application?"

Win application?
Do you mean something like HID device emulator?

For HID device test, this app will work.

On Ms.Axelson's "The HID Page",
SimpleHIDWrite
http://www.lvr.com/files/SimpleHIDWrite3.zip

Tsuneo

Read-Only
Author
Tsuneo Chinzei
Posted
11-Jul-2008 10:35 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

"Also I can't get Tsuneo's idea of separating the software into blocks to work on bcb 6 with 64 byte reports, using 8 bit report works fine."

8 bit report?
Isn't it 8 byte report?

Anyway, start with the working one.
What do you change from the "8 bit" report to 64 byte one, the device side and the host side.

Tsuneo

Read-Only
Author
Doug Funny
Posted
5-Aug-2008 19:53 GMT
Toolset
None
New! RE: I've heard recent C++ builder supports MFC

On the device I did exacly what you've said on another thread and on the host I changed the report sizes to 64 bytes.

Read-Only
Author
F Y
Posted
31-Oct-2008 02:05 GMT
Toolset
ARM
New! RE: hid client example

I'd like to document everything I did to get the HID Client to build, all in one spot.

I have installed
* Visual C++ 6.0
* Visual Studio C++ 2005 Express Edition
* Windows WDK, my version is 6001.18002.

For my case, both versions of Visual C++ DID need to be installed.
================================
1. INSTALL WINDOWS WDK
To start off with, you need to download the Windows Driver Kit - WDK (formerly known as the DDK).

Follow the instructions under "show/hide steps."
http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx?lc=1033

Unless you enjoy burning one-time-use CD's, install UltraISO to extract the ISO file. Install to the default directory for simplicity.
================================
2. INSTALL VISUAL STUDIO C++ EXPRESS EDITION. This should be free off the internet.
================================
3. Open up the C:\Keil\ARM\Utilities\HID_Client\HIDClient.sln file. This will automatically open up the project in Visual Studio.
================================
4. Now you need to add some new include paths.
In Visual Studio, select Tools->Options->Projects and Solutions -> VC++ Directories.
Under the "Show directories for:", select include files, then you'll need to add:

C:\WinDDK\6001.18002\inc\ddk
C:\WinDDK\6001.18002\inc\api
C:\WinDDK\6001.18002\inc\mfc42


Under "library files," you'll need to add:

C:\WinDDK\6001.18002\lib\atl\i386
C:\WinDDK\6001.18002\lib\mfc\i386
C:\WinDDK\6001.18002\lib\wxp\i386
C:\Program Files\Microsoft Visual Studio\VC98\MFC\Lib


The last one is a Visual C++ 6.0 path.
================================
5. Copy some resource files.
I needed to copy some contents of the following VC++ path into my project directory

copy C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\Res\*.* c:\Keil\ARM\Utilities\HID_Client\res


================================
6. Build and execute.
================================
Good luck.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings