SpaceTraveler support using IOKit

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

Moderator: Moderators

Post Reply
felix
Posts: 3
Joined: Wed Feb 14, 2007 10:58 am

SpaceTraveler support using IOKit

Post by felix »

Hi there,

Nice to see your support for Mac OS X, that's really great.

I've included support for the SpaceTraveler device in our Medical Applications on OSX using the IOKit.framework and the HID functions. One thing that's left is supporting the nice blue LED. Could you please provide me with some information about the HID report buffer I've to send to enable/disable the LED.

Thanks in advance,

Felix
flomotan
Moderator
Moderator
Posts: 287
Joined: Mon Jan 08, 2007 3:37 pm

Post by flomotan »

For our SpaceNavigator, the LEDs are turned on with a HID SetReport call with the following parameters:

report type = 2 (kHIDRtOutputReport)
report ID = 4
report length = 1 byte
report data = 0x00 or 0x01 (off or on)

This is called from the kernel so the API is not what you'd need in user space. In user space with the USBLib it would be something like this (untested):

buffer[0] = 0x01;
request.bmRequestType = USBmakebmRequestType(kUSBOut, kUSBClass,
kUSBInterface);
request.bRequest = kHIDRqSetReport;
request.wValue = 0x0204; // (reportType <<8>DeviceRequest(deviceInterface, &request);

I haven't tried the HIDLib but it should have a SetReport call with similar parameters.
felix
Posts: 3
Joined: Wed Feb 14, 2007 10:58 am

Post by felix »

Many thanks for the fast response. Unfortunately, it didn't work out for the SpaceTraveler. I'm using the following code, without an error:

Code: Select all

void
HIDSpaceTraveler::enableLED(bool trueOrFalse)
{
  IOHIDDeviceInterface122 ** hidDeviceInterface = getDeviceInterface();
  if (hidDeviceInterface != NULL) {
    
    UInt8 buffer[1] = {0};
    buffer[0] = (trueOrFalse) ? 0x01 : 0x00;
    IOReturn ret = (*hidDeviceInterface)->setReport(hidDeviceInterface, kIOHIDReportTypeOutput, 4, buffer, sizeof(buffer), 100, NULL, NULL, NULL);
    if (ret != kIOReturnSuccess) {
      std::cout << "error changing led state" << std::endl;
    }
  }
}
Any further hints would be greatly appreciated...

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

Post by jwick »

You have to send 3 bits for the SpaceTraveler, CadMan and SpaceMouse(0x07). Turning on/off these individual bits actually allows you to turn on/off every other LED. Some people have even suggested that this would make it easier for you to distinguish the individual buttons on the ST.

Jim
3Dx Software Development
felix
Posts: 3
Joined: Wed Feb 14, 2007 10:58 am

Post by felix »

This really makes a difference, I agree with those people. Again, many thanks and have a nice weekend.

Felix
gallsoft
Posts: 2
Joined: Sat Mar 17, 2018 1:02 am

Re: IOKit

Post by gallsoft »

flomotan wrote: Wed Feb 14, 2007 4:15 pm For our SpaceNavigator, the LEDs are turned on with a HID SetReport call with the following parameters:

report type = 2 (kHIDRtOutputReport)
report ID = 4
report length = 1 byte
report data = 0x00 or 0x01 (off or on)

This is called from the kernel so the API is not what you'd need in user space. In user space with the USBLib it would be something like this (untested):

buffer[0] = 0x01;
request.bmRequestType = USBmakebmRequestType(kUSBOut, kUSBClass,
kUSBInterface);
request.bRequest = kHIDRqSetReport;
request.wValue = 0x0204; // (reportType <<8>DeviceRequest(deviceInterface, &request);

I haven't tried the HIDLib but it should have a SetReport call with similar parameters.
Hi floman

We have implemented HID level support for SpaceNavigator and SpaceMouse Pro into our app NDI Monitor, since we have those devices here to develop with.

We now want to add similar support for the new SpaceMouse Wireless. I understand from a customer that it is sending 3 different formats of HID report and I wanted to ask if you had any documentation on the HID reports generated by 3dConnexion spacemouse devices. We need to support the devices as pure HID in order to fit our architecture.

Any information anyone has on this would be very welcome

Many thanks

Mark
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: SpaceTraveler support using IOKit

Post by ngomes »

Hi gallsoft,

The SpaceMouse Wireless has the same data scheme in the USB reports as other recent devices. See this post for the format of 7- and 13-byte reports.

Perhaps your code only caters for 7-byte report packets. We have a concatenation of all 6 DOFs in a longer (13 bytes) packet.
gallsoft
Posts: 2
Joined: Sat Mar 17, 2018 1:02 am

Re: SpaceTraveler support using IOKit

Post by gallsoft »

ngomes wrote: Mon Mar 19, 2018 5:34 am Hi gallsoft,

The SpaceMouse Wireless has the same data scheme in the USB reports as other recent devices. See this post for the format of 7- and 13-byte reports.

Perhaps your code only caters for 7-byte report packets. We have a concatenation of all 6 DOFs in a longer (13 bytes) packet.

That is great news.

We do already support 7 bytes packets (for SpaceMouse Pro), and 3 byte packets (for the older Space Navigator).

Our user testing with the SpaceMouse Wireless was seeing rather different HID reports:

Message Type A: Report 00000001 ,length = 32
HID-INPUT Report 00000001 ,length = 32:01 48 56 64 33 01 00 09 00 04 00 00 00 00 00 00 00 00 00 31 bb 81 52 00 00 00 00 00 00 00 00 00

Message Type B: Report 00000003 ,length = 96
HID-INPUT Report 00000003 ,length = 96:03 48 56 64 33 01 00 08 00 30 00 00 00 00 00 2f c6 00 00 92 17 00 00 33 6d 00 00 03 00 00 00 00 00 00 00 d2 d7 f2 fc 6d 06 00 00 00 00 00 00 00 00 00 00 00 00 93 ff 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Message Type C: Report 00000001 ,length = 13
HID-INPUT Report 00000001 ,length = 13:01 93 ff 00 00 00 00 00 00 00 00 00 00


If all we need to do is support 13 byte packets, then thats great, but I am slightly nervous, since in the testing it seemed to mostly send the 96 byte reports and the 13 byte reports didnt seem to contain much of any use.

Any ideas ?

Thanks
ngomes
Moderator
Moderator
Posts: 3321
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: SpaceTraveler support using IOKit

Post by ngomes »

HI gallsoft,
gallsoft wrote: Mon Mar 19, 2018 5:48 am Any ideas ?
Not many, regrettably.

Messages A and B are not something I've seen (or can recall) before. Message C is precisely what to expect: a 13-byte long package with ID "1" (all 6DOF axes in a single packet).

Packets with ID "1" and "3" (buttons) with 32 and 96 bytes of payload are invalid. Perhaps the system is somehow mangling the data but, as mentioned, I cannot recall seeing any of this before.
Post Reply