LED control via HID

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

Moderator: Moderators

sschaefer
Posts: 4
Joined: Thu Dec 10, 2009 6:03 am

LED control via HID

Post by sschaefer »

Hi,

I am able to get the rotation and translation values from the SpaceNavigator via HID and to rezero it with the 7-0 packet, but i am wondering which HID-packet is turning on the LED?

Thanks in advance !!
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

2 byte packet 4, 0 turns off the LEDs. 4, 1 turns them on.
sschaefer
Posts: 4
Joined: Thu Dec 10, 2009 6:03 am

Post by sschaefer »

Thanks for your quick answer... it works. :)
Tiwen
Posts: 4
Joined: Thu Feb 25, 2010 4:59 pm

Post by Tiwen »

Hi,
i changed in the HIDRezero example

Code: Select all

			pFeatureBuf[0] = RPTID_FEAT_REZERO_DEVICE,
			pFeatureBuf[1] = 0x00;
to

Code: Select all

			pFeatureBuf[0] = 0x04,
			pFeatureBuf[1] = 0x00;
to switch of the LED, but i get the error
SendRezeroCommand: error from HidD_SetFeature (0x17)
(wrong CRC)
and i am wondering what i have done wrong. Any suggestions?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

That looks reasonable. Do you have a SpaceNavigator? Have you successfully opened it?
Tiwen
Posts: 4
Joined: Thu Feb 25, 2010 4:59 pm

Post by Tiwen »

Yes, i have a SpaceNavigator, and i successfully created a library to query the hid device.
I can rezero the device with this source without problem an i have only changed this singe byte in the code.
I also tried to send 4,0 and 4,1 with DeviceIoControl (IOCTL_HID_SET_FEATURE), same error ...
and same error on other computers (Windows XP and Windows 7 64Bit).

The Spacenavigator has no problems with other Software/Drivers.
For example the driver from RBC9 is able to control the LED.

Any idea?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

That's the packet the 3DxWare driver uses to set the LEDs.
The error seems to indicate that the error is somewhere else. The packet is probably fine.
Tiwen
Posts: 4
Joined: Thu Feb 25, 2010 4:59 pm

Post by Tiwen »

Thanks for the fast response jwick, but i have no clue where there could be an error.
Does anybody have a simple working example that controls the LED with HidD_SetFeature or DeviceIoControl?
(a modified HIDRezero would be perfect)

Thanks in advance
sschaefer
Posts: 4
Joined: Thu Dec 10, 2009 6:03 am

Post by sschaefer »

Hi Tiwen, I had the same problem. HidD_SetFeature didn't work for me either (except for the callibration). I used WriteFile instead:

Code: Select all

HidDevice *pDev = waitListItems[index];

//turn LED on
pDev->buf[0] = 0x04;
pDev->buf[1] = 0x01;			
WriteFile(pDev->handle, pDev->buf, pDev->capabilities.OutputReportByteLength, &nwrite, FALSE);

//turn LED off			
pDev->buf[0] = 0x04;
pDev->buf[1] = 0x00;
WriteFile(pDev->handle, pDev->buf, pDev->capabilities.OutputReportByteLength, &nwrite, FALSE);
Tiwen
Posts: 4
Joined: Thu Feb 25, 2010 4:59 pm

Post by Tiwen »

Great, that works :D
Thanks
romani
Posts: 1
Joined: Fri May 17, 2013 12:14 am
Contact:

Re: LED control via HID

Post by romani »

I have a SpaceNavigator, and i successfully created a library to query the hid device.
I can re zero the device with this source without problem an i have only changed this singe byte in the code.
I also tried to send 4,0 and 4,1 with DeviceIoControl (IOCTL_HID_SET_FEATURE), same error ..
and same error on other computers (Windows XP and Windows 7 64Bit).
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: LED control via HID

Post by jwick »

romani wrote:I have a SpaceNavigator, and i successfully created a library to query the hid device.
I can re zero the device with this source without problem an i have only changed this singe byte in the code.
I also tried to send 4,0 and 4,1 with DeviceIoControl (IOCTL_HID_SET_FEATURE), same error ..
and same error on other computers (Windows XP and Windows 7 64Bit).
It's not a feature report. Just write it to the device.
sayala
Posts: 3
Joined: Wed Jul 24, 2013 11:50 am

Re: LED control via HID

Post by sayala »

I am planning to use SiSetLED function to turn off/on LED on space navigator. with the following defines

#define LED_ON 0x00010001
#define LED_OFF 0x00010000

How do i find out the current LED state on space navigator? Is it the return value of SiSetLED function?
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: LED control via HID

Post by jwick »

sayala wrote:I am planning to use SiSetLED function to turn off/on LED on space navigator. with the following defines

#define LED_ON 0x00010001
#define LED_OFF 0x00010000

How do i find out the current LED state on space navigator? Is it the return value of SiSetLED function?
The return value of SiSetLEDs is just success or failure. We don't provide a way to get the state of the device LEDs. You can look into the user's configuration to see if they have turned them on/off. It's best not to mess with their preferences though.
sayala
Posts: 3
Joined: Wed Jul 24, 2013 11:50 am

Re: LED control via HID

Post by sayala »

what should be the input values for SiSetLED function? The following values not working

#define LED_ON 0x00010001
#define LED_OFF 0x00010000

SiSetLEDs(m_pscs->devHdl, LED_ON);
Post Reply