HID Examples

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

Moderator: Moderators

Posts: 2803
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Re: HID Examples

Post by jwick » Mon Feb 24, 2014 1:32 am

The SpaceMouse Wireless is much more complicated than most devices. It is two different products and thus ProductIDs; the nano receiver and the device itself. I would start off with just the device itself, with the USB cable attached. Then you basically have a SpaceNavigator.

The SpaceMouse Wireless doesn't use its LEDs when it is running off the battery (wireless). That would use too much power. When connected by the USB cable, you can turn the LEDs on/off with a two byte packet. The first byte is a 4. The second byte is a 0 to turn them off. Anything bit (I use 0xff) to turn them on.

The 0x17 packet is the battery report. A 97 (61h) means you have 97% of your battery remaining.

I'd ignore all that and concentrate on getting and using the button data and the axis data. The SpaceMouse Wireless delivers axis data in one packet. All the other devices split the translation and rotation data. If you intend to support all 3Dx devices, you should take that into account.

Posts: 262
Joined: Mon Jul 12, 2010 5:58 pm

Re: HID Examples

Post by Hypersonic » Mon Feb 24, 2014 3:47 pm

Looking at HIDTest.cpp it seems all pre-wireless devices used 13byte packets.
1st byte: 01 transation axis packet, 02 rotation axis packet, 03 button packet.
For axis packets there are 6 byte pairs: least significant byte followed by most significant byte for each pair. I wasn't sure whether the byte pairs were signed or not until I saw this line:

Code: Select all

printf( "Device %d, all 6 DOF: T: (%d, %d, %d) R: (%d, %d, %d)\n", index, 
						pDev->allDOFs[0], pDev->allDOFs[1], pDev->allDOFs[2], pDev->allDOFs[3], pDev->allDOFs[4], pDev->allDOFs[5]);
If they were unsigned it would use %u instead of %d http://www.cplusplus.com/reference/cstdio/printf/

Logical min/max -350/350 I suppose are the values that you'd actually see outputted.
Phsycial min/max -1400/1400 is a bit confusing, my guess is while it's able to output these values, anything past +/- 350 is unreliable so just clamp those?

Post Reply