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

spnavd: open the logfile if verbose and not daemonized #42

Closed osresearch closed 3 years ago

osresearch commented 3 years ago

When running in the foreground with -d, there is no output generated to the logfile specified with -l. This patch ensures that logging happens.

jtsiomb commented 3 years ago

logfile is never null unless the user explicitly specified -l syslog, so this is almost equivalent to making spnavd log to a file whenever verbose is chosen, which makes no sense.

Sending log messages to the terminal when not running as a daemon is intentional, although I could see how if someone explicitly specified -l <some log file> together with -d the expectation would be to use the logfile. If you wish to change this to add a variable "the user explicitly specified a log file", maybe force_logfile or something similar, and base the invocation of start_logfile on that (and certainly not on verbose) then I will merge it.

jtsiomb commented 3 years ago

Since I got no answer, I implemented the necessary changes myself. Let me know if there's anything else wrong with the logfile handling.

osresearch commented 3 years ago

Sorry about not writing back! Thanks for making the change -- that will work fine for my use case. My expectation was that if run with -d that the log messages would be written to stdout, although I can fake that with -d -l /dev/tty.

(Everything is working fine for me now with a SpacePilot Pro and Blender 2.93, as long as the device is plugged in and the daemon started before Blender is executed. The LCD on the device doesn't work, but that is a much larger project...)

jtsiomb commented 3 years ago

Sorry about not writing back! Thanks for making the change -- that will work fine for my use case. My expectation was that if run with -d that the log messages would be written to stdout, although I can fake that with -d -l /dev/tty.

They should have been written to stdout/stderr, but there was a regression which I also fixed in the latest commit.

(Everything is working fine for me now with a SpacePilot Pro and Blender 2.93, as long as the device is plugged in and the daemon started before Blender is executed. The LCD on the device doesn't work, but that is a much larger project...)

I implemented LCD contro for the original spacepilotl in a separate project, mostly as a proof of concept: https://github.com/jtsiomb/3dxdisp. I never bothered to merge it in spacenavd because frankly I have no idea what would be useful to show on the display. Also I don't have any of the newer models with the higher resolution display, so I can't even attempt to do anything with those at the moment.