HID Examples

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

jwick
Moderator
Moderator
Posts: 2639
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

HID Examples

Post by jwick » Thu Jan 17, 2008 9:16 am

Edit (moderator): the sample code is no longer available from the FTP service. Please contact 3Dconnexion API Support if you need further assistance.

This postcontains examples of how to access the 3Dx device using HID.

lgriffith
Posts: 4
Joined: Thu Jan 31, 2008 9:12 am
Location: California

Post by lgriffith » Thu Jan 31, 2008 9:38 am

My application is such that I cannot use your standard SDK's and must develop a different interface technology. I have successfully created an interface module by adapting the code in your HID examples. I have added the ability to turn on and off the LED, set the axis enable state, and to to be able choose either event driven or polled data access.

The LED control function was achieved by extensive reading of many pages on the USB web site and in the Windows DDK documentation. The axes enable state function was achieved by good old fashion hacking and a lot of luck.

The functionality I have implemented so far is sufficient for my purpose but I am interested in possibly using some of the other six undefined and undocumented Report ID's. To that end, it would really be nice if you provided documentation for your devices so that we could know how to program them rather than using a guess by golly approach. In particular, the documentation of your vendor specific User Page ff00 capabilities for the SpaceNavigator would be greatly appreciated.

rodrigo.seabra
Posts: 44
Joined: Fri Apr 04, 2008 7:03 am

Post by rodrigo.seabra » Mon Jun 30, 2008 11:41 am

Hi,

In HIDTest example, the application is in a loop that gets the coordinates of translation and rotation of Spacenavigator.

In my application, I tried to adapt the same code and strategy to read the coordinates of the device, however, as my application already makes use of a main loop that updates the scene at each FRAME (use a graphics library for this purpose), my idea was inserted the read of device coordinates each update of FRAME.

The code works in parts. While the application is executed, the thread that reads the coordinates of the device lock the main application (3D scene). Reading the documentation of Windows (more precisely the functions CreateFile and ReadFile), I think I need to change some parameters of the CreateFile function, to make the handling asynchronous (do not block the execution of the application), rather than synchronous, as is in the example. So, I added the parameter FILE_FLAG_OVERLAPPED in CreateFile function.

Code: Select all

Devices[nDevices].handle = CreateFile(Devices[nDevices].pDevInterfaceDetailData->DevicePath,
												GENERIC_READ | GENERIC_WRITE,
												FILE_SHARE_READ | FILE_SHARE_WRITE,
												NULL,
												OPEN_EXISTING,
												FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED
												NULL);
In turn, using the handling asynchronous, must change the mode of operation of the function ReadFile, but I do not know for sure what to do for the reading of the coordinates of device will continue working.

Someone has some experience in the subject or any ideas to help me?

Thanks.

jwick
Moderator
Moderator
Posts: 2639
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick » Mon Jun 30, 2008 12:13 pm

The Microsoft Doc is pretty good on this (http://msdn.microsoft.com/en-us/library ... S.85).aspx ).
Pass an OVERLAPPED structure to ReadFile. If you get an ERROR_IO_PENDING error, call GetOverlappedResult.

rodrigo.seabra
Posts: 44
Joined: Fri Apr 04, 2008 7:03 am

Post by rodrigo.seabra » Tue Jul 01, 2008 5:48 am

I understand. However, I tried to use:

Code: Select all

if (!ReadFile(pDev -> handle, pDev -> buf, pDev -> capabilities.InputReportByteLength, NULL, &overlapped)) {
           switch (dwError = GetLastError()) {
...
The function GetLastError returns the value "6"... What I do?

Thanks.

jwick
Moderator
Moderator
Posts: 2639
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick » Tue Jul 01, 2008 6:01 am

If you lookup that error, you will see that it is ERROR_INVALID_HANDLE. This suggests that your handle is invalid.

rodrigo.seabra
Posts: 44
Joined: Fri Apr 04, 2008 7:03 am

Post by rodrigo.seabra » Tue Jul 01, 2008 7:06 am

Right. The error is that driver of SpaceNavigator was off. After connecting the driver, the current error is: "ERROR_IO_INCOMPLETE"

Code: Select all

if (FALSE == ReadFile(pDev -> handle, pDev -> buf, pDev -> capabilities.InputReportByteLength, NULL, &overlapped)) {
				switch (dwError = GetLastError()) {
					case ERROR_HANDLE_EOF: 
						cout << "Error: EOF!" << endl;
						break;
					case ERROR_IO_PENDING:
						BOOL bPending = TRUE;
						while(bPending) {
							cout << "ReadFile is pending..." <<endl> handle, &overlapped, &ntransferred, FALSE)) {
								switch (dwError = GetLastError()) {
									case ERROR_IO_PENDING:
										cout << "pending..." << endl;
										break;
									case ERROR_IO_INCOMPLETE:
										cout << "operation incomplete..." << endl;
										break;
									cout << "GetOverlappedResult failed (%d)" << dwError << endl;
								}
							}
							else {
								cout << "ReadFile operation completed" << endl;
		                        bPending = FALSE;
							}
						}
						break;
					cout << "ReadFile failed (%d)" << dwError << endl; 
				}
In the MSDN Documentation, if parameter "bWait [in]" of function GetOverlappedResult is FALSE: "If this parameter is FALSE and the operation is still pending, the function returns FALSE and the GetLastError function returns ERROR_IO_INCOMPLETE."

What I do? I need of an event object like the example "Testing for the End of File" of documentation? If so, as I could adjust in my code? In that part of code I would read the coordinates of device?

Thanks.

jwick
Moderator
Moderator
Posts: 2639
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick » Tue Jul 01, 2008 7:21 am

I'm missing where you actually called GetOverlappedResult, but if it says the read is still pending, then it is probably still pending. The device only sends data at 60Hz.

You should not need the 3DxWare driver running. If it is running your program and the driver will be fighting over the device.

rodrigo.seabra
Posts: 44
Joined: Fri Apr 04, 2008 7:03 am

Post by rodrigo.seabra » Tue Jul 01, 2008 7:33 am

Sorry, a line is hidden.

Code: Select all

case ERROR_IO_PENDING:
						BOOL bPending = TRUE;
						while(bPending) {
							if (!GetOverlappedResult(pDev -> handle, &overlapped, &ntransferred, FALSE)) {
								switch (dwError = GetLastError()) {
									case ERROR_IO_PENDING:
										cout << "ainda pendente..." << endl;
										break;
									case ERROR_IO_INCOMPLETE:
										cout << "operação não realizada..." << endl;
										break;
									cout << "GetOverlappedResult failed (%d)" << dwError << endl;
								}
							}
							else {
								cout << "ReadFile operation completed" << endl;
		                        bPending = FALSE;
							}
						}
						break;
Did you have any suggestion?

Thanks.

bityyp
Posts: 10
Joined: Thu Sep 25, 2008 8:09 pm

Re: HID Examples

Post by bityyp » Thu Sep 25, 2008 8:16 pm

jwick wrote:This postcontains examples of how to access the 3Dx device using HID.
very well.Thanks

fred37b
Posts: 2
Joined: Mon Jun 14, 2010 10:30 am

Post by fred37b » Tue Jun 15, 2010 1:18 am

I cannot build py project, I work with visual studio 2008 and when I add the path the library (hid.lib) in this sample I have 26 error like :

"Erreur 1 error LNK2019: symbole externe non résolu _free référencé dans la fonction _main HIDTest.obj HIDTest"


May it possible I have forgotten a file to add or something else ?

shwong2002
Posts: 1
Joined: Fri Apr 19, 2013 10:34 am

Re: HID Examples

Post by shwong2002 » Fri Apr 19, 2013 10:40 am

I also cannot build the example. Using the latest DDK 8.0, when I add the include directories, I get a bunch of windows api related errors.
(see below). Anyone have suggestions on what to do?


1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(543): error C2065: '_In_opt_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(543): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(543): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(543): error C2182: '_invalid_parameter' : illegal use of type 'void'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(543): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2065: '_In_opt_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2182: '_invoke_watson' : illegal use of type 'void'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2495: '_invoke_watson' : '__declspec(noreturn)' can only be applied to function declarations or definitions
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): error C2144: syntax error : 'int' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(186): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(187): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(187): error C2144: syntax error : 'int' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(187): error C2448: '_flsbuf' : function-style initializer appears to be a function definition
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(187): error C2146: syntax error : missing ';' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(187): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(192): error C2146: syntax error : missing ';' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(192): error C2065: '_In_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(192): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(192): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(192): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(195): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(195): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(195): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(195): error C2182: 'clearerr' : illegal use of type 'void'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(195): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(197): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(197): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(197): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(197): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(199): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(199): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(199): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(199): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(205): error C2146: syntax error : missing ';' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(205): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(205): error C2144: syntax error : 'int' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(205): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(205): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(208): error C2144: syntax error : 'int' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(208): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(208): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(208): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(208): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(209): error C2144: syntax error : 'int' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(209): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(209): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(209): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(209): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(210): error C2065: '_Inout_opt_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(210): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(210): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(210): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(211): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(211): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(211): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(211): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(213): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(213): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(213): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(213): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(214): error C2065: '_MaxCount' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(214): error C3861: '_Out_z_cap_': identifier not found
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(214): error C2144: syntax error : 'char' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(214): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(214): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(219): error C2144: syntax error : 'int' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(219): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(219): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(219): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(219): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(227): error C2144: syntax error : 'char' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(227): error C2065: '_In_opt_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(227): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(227): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(227): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C2144: syntax error : 'int' should be preceded by ';'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C2143: syntax error : missing ';' before '*'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C2065: '_In_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(236): error C2065: '_Deref_out_opt_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(236): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(236): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(236): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(238): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(238): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(238): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(238): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(240): error C2065: '_Inout_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(240): error C2146: syntax error : missing ')' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(240): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(240): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(242): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(242): error C2144: syntax error : 'int' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(242): error C2448: 'fputc' : function-style initializer appears to be a function definition
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(242): error C2146: syntax error : missing ';' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(242): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(243): error C2065: '_In_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(243): error C2144: syntax error : 'int' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(243): error C2448: '_fputchar' : function-style initializer appears to be a function definition
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(243): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(244): error C2065: '_In_z_' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(244): error C2143: syntax error : missing ')' before 'const'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(244): warning C4229: anachronism used : modifiers on data are ignored
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(244): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2065: '_ElementSize' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2065: '_Count' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C3861: '_Out_bytecap_x_': identifier not found
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2144: syntax error : 'void' should be preceded by ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2448: 'fread' : function-style initializer appears to be a function definition
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2146: syntax error : missing ';' before identifier 'size_t'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2146: syntax error : missing ';' before identifier 'size_t'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2146: syntax error : missing ';' before identifier 'FILE'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(245): error C2059: syntax error : ')'
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(247): error C2065: '_ElementSize' : undeclared identifier
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(247): fatal error C1003: error count exceeds 100; stopping compilation

jonas10
Posts: 4
Joined: Thu Jun 20, 2013 5:51 am

Re: HID Examples

Post by jonas10 » Thu Jun 20, 2013 5:53 am

I have actually the same problem. Is it a probleme with the link between .h and .lib ??
Thank you

jwick
Moderator
Moderator
Posts: 2639
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: HID Examples

Post by jwick » Mon Jul 15, 2013 7:11 am

We do use overlapped IO in our drivers. Being already in a separate thread, I wouldn't think it should matter--only that thread should get blocked. If your main thread is blocking on something that only the read thread sets when it returns from the read, then you do have a problem.

Your application is set up correctly. Your application should draw as fast as it can using the last available data from the device. When new data arrives from the device that should be shared with the main loop and the main drawing loop speed should be updated. If no new data has arrived from the device, keep doing what you were doing. This way you don't slow your application down to the data rate of the device.

When the user releases the device cap, you will get an all zero event which will tell you to stop.

nedarg
Posts: 1
Joined: Fri Feb 21, 2014 1:21 pm

Re: HID Examples

Post by nedarg » Fri Feb 21, 2014 2:06 pm

Hi,

I have started hacking up one of the HID examples and got my code to output some results (refer lower in my post).

My questions is:
1) How do I turn the LED's on and off? when I write data what values should I use?

2) What does the vendor specific data mean? and when I read data what does a value of 0x61 mean in relation to the UsageID 0x17.
UsagePage: 65280 (Vender-defined 0xFF00)
UsageID 0x17
UsagePage: 65280 (Vender-defined 0xFF00)
UsageID 0x1b

3) Feature Value Capabilities are all vendor data, when I read/write data what do the data values mean and how should I interact with it?


Thanks in advance.


====[Next Device]============================================
********* DevicePath: \\?\hid#vid_256f&pid_c62f#8&c7ea5a2&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000
Device Description: HID-compliant device
Device Is Active
Device Manufacturer String is '3Dconnexion'
Device Product String is 'SpaceMouse Wireless Receiver'
Device Serial Number is unknown

Capabilities:
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 8 (Multi-axis Controller 0x08)
InputReportByteLength: 13
OutputReportByteLength: 2
FeatureReportByteLength: 8
NumberLinkCollectionNodes: 18
NumberInputButtonCaps: 3
NumberInputValueCaps: 7
NumberInputDataIndices: 11
NumberOutputButtonCaps: 1
NumberOutputValueCaps: 0
NumberOutputDataIndices: 1
NumberFeatureButtonCaps: 0
NumberFeatureValueCaps: 11
NumberFeatureDataIndices: 11
---
Input Button Caps:
UsagePage: 9 (Button 0x09)
UsageID: 3 (Button 3 Tertiary)
UsagePage: 65280 (Vender-defined 0xFF00)
UsageID: 0x17
UsagePage: 65280 (Vender-defined 0xFF00)
UsageID: 0x1B
---
Output Button Caps:
UsagePage: 8 (LEDs 0x08)
UsageID: 4 (Compose 0x04)
Bit Field 0x2 Link Usage: 0 Link Usage Page: 9
------
Input Value Caps:

--Input Value capabilities for index 0 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 1 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 2 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 3 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 4 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 5 -----
UsagePage: 1 (Generic Desktop Controls 0x01)
UsageID: 1 (Pointer 0x01)
LinkCollection: 1
LinkUsage: 0
LinkUsagePage: 1
BitSize: 16
ReportCount: 1
LogicalMin = -350, LogicalMax = 350
PhysicalMin = -1400, PhysicalMax = 1400

--Input Value capabilities for index 6 -----
UsagePage: 6 (Generic Device Controls 0x06)
UsageID: 23 (2DO - 0x17)
LinkCollection: 4
LinkUsage: 0
LinkUsagePage: 8
BitSize: 8
ReportCount: 1
LogicalMin = 0, LogicalMax = 100
PhysicalMin = 0, PhysicalMax = 1
------
Feature Value Caps:

--Feature Value capabilities for index 0 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x5)
LinkCollection: 7
LinkUsage: 58
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 1 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x6)
LinkCollection: 8
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 2 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x7)
LinkCollection: 9
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 3 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x8)
LinkCollection: 10
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 7
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 4 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x9)
LinkCollection: 11
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 7
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 5 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0xa)
LinkCollection: 12
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 7
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 6 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0xb)
LinkCollection: 13
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 7 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x13)
LinkCollection: 14
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 8 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x18)
LinkCollection: 15
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 1
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 9 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x19)
LinkCollection: 16
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 4
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

--Feature Value capabilities for index 10 -----
UsagePage: 65280 (Vender-defined 0xFF00)
(Vender-defined UsageID 0x1a)
LinkCollection: 17
LinkUsage: 0
LinkUsagePage: 65280
BitSize: 8
ReportCount: 7
LogicalMin = -128, LogicalMax = 127
PhysicalMin = 0, PhysicalMax = 1

Post Reply