I'm playing around with JavaFX 3D, and I have this 3Dconnexion peripheral that's been sitting in a drawer unused for at least a year, and I want to capture its input in Java.
When I plug it in I see a new file: /dev/hidraw2
I can hexdump that file and see a bunch of binary gobbledeegook every time I touch the device. For example:
hexdump < /dev/hidraw2
0000000 0103 0300 0000 0103 0300 0000 0103 0300
0000010 0000 0001 0000 0100 0200 0000 0000 0000
0000020 0001 0000 0900 0200 0000 0000 0000 0001
0000030 0000 1400 0200 0000 0000 0000 0001 0000
This input started with three left clicks, and I can clearly see a repeating sequence of bytes there. Then I touched the 3D sensor and things get pretty murky. Other than hexdump, what are the tools of the craft that might help me figure out how to parse this?
By the way, I started by searching for Java spacenav libraries but did not find anything that works.
update: This is the output from a single tap on the top of the SpaceNavigator.
01 f8 ff 14 00 55 00 02 00 00 15 00 00 00 01 00
00 b0 ff 04 00 02 a5 ff 00 00 00 00 01 00 00 00
00 4b 00 02 65 00 fe ff 00 00 01 00 00 bd ff 00
00 02 d7 ff 08 00 00 00 01 00 00 1e 00 cd ff 02
37 00 00 00 00 00 01 00 00 f1 ff 00 00 02 b8 ff
00 00 00 00 01 00 00 2b 00 14 00 02 26 00 00 00
00 00 01 00 00 f5 ff 00 00 02 d1 ff 00 00 00 00
01 00 00 19 00 f5 ff 02 2b 00 00 00 00 00 01 00
00 eb ff 00 00 02 d9 ff 00 00 00 00 01 00 00 04
00 00 00 02 23 00 00 00 00 00 01 00 00 fe ff 00
00 02 f3 ff 00 00 00 00 01 00 00 00 00 00 00 02
09 00 00 00 00 00 01 00 00 00 00 00 00 02 ef ff
00 00 00 00 01 00 00 03 00 00 00 02 08 00 00 00
00 00 01 00 00 00 00 00 00 02 f5 ff 00 00 00 00
01 00 00 00 00 00 00 02 07 00 00 00 00 00 01 00
00 00 00 00 00 02 f7 ff 00 00 00 00 01 00 00 00
00 00 00 02 07 00 00 00 00 00 01 00 00 00 00 00
00 02 f8 ff 00 00 00 00 01 00 00 00 00 00 00 02
05 00 00 00 00 00 01 00 00 00 00 00 00 02 fc ff
00 00 00 00 01 00 00 00 00 00 00 02 00 00 00 00
00 00 01 00 00 00 00 00 00 02 00 00 00 00 00 00
01 00 00 00 00 00 00 02 00 00 00 00 00 00 01 00
00 00 00 00 00 02 00 00 00 00 00 00 01 00 00 00
00 00 00 02 00 00 00 00 00 00 01 00 00 00 00 00
00 02 00 00 00 00 00 00
Everything became much more obvious when I stumbled on the right byte length for a data frame, which was seven. This hexdump command clearly displays an incoming event on each line:
hexdump -v -e '7/1 "%02x "' -e '"\n"' </dev/hidraw2
The code I wrote to parse the stream is up on bitbucket