FreeSpacenav / spacenavd

Free user-space driver for 6-dof space-mice.
http://spacenav.sourceforge.net
GNU General Public License v3.0
279 stars 55 forks source link

FreeBSD USB support and build fixes #51

Closed RealDeuce closed 2 years ago

RealDeuce commented 2 years ago

Only tested with SP1 USB Hard-codes a bunch of the HID stuff, ignoring the report descriptor completely

Also, rename usb_device_info → sn_usb_device_info since usb_device_info is part of the FreeBSD USB HID interface.

Finally, honour existing CC, INSTALL, CFLAGS, and LDFLAGS in the Makefile.

Tested with FreeCAD and Blender, seems to work fine.

jtsiomb commented 2 years ago

Well spacenavd always worked on FreeBSD, so "initial port" is a bit inaccurate, but USB support was planned for ages and never completed, so thank you for the contribution. I will try to review your changes as soon as possible.

jtsiomb commented 2 years ago

Thank you, this is in a perfectly fine condition to be merged minus a couple style details here and there, which I'll just go ahead and fix myself.

Edit: for future reference, if you wish to continue hacking this:

Give me half an hour to fix these, and continue from master HEAD if you wish

RealDeuce commented 2 years ago

Thanks for updating it for me. If you're shooting for strict C89, I should likely remove the inttypes.h stuff as well. I'll do a separate PR.

RealDeuce commented 2 years ago

Actually, it turns out that FreeBSD no longer has standard size-based types outside of stdint.h, and since this is a platform-specific file, it seems like using stdint.h (which appears to be C89 compliant, and is available on all supported FreeBSD versions) is a lesser evil than relying on a short to be 16 bits.

jtsiomb commented 2 years ago

Yes, sized types are very useful, and most UNIX systems had them in one shape or form before C99 (usually in inttypes.h or sys/types.h). I'm not so much concerned about strict C89 compliance at the library level, if the C99 features are generally available to most C89 compilers, and the differences can be worked out with preprocessor conditions, that's fine with me.