New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spacenav: init package and module #94234
Conversation
Supports 3D input devices such as 3Dconnexion Spacemouse.
Builds Blender with support for 3D input devices such as 3Dconexxsion Spacemouse. Patched Blender to recognize the device-ID of the wireless Spacemouse that I bought in 2020. Has to be upstreamed to Blender separately. Enabled by default even though the feature is obscure because enabling has low impact (small dependency) while enabling manually has larger impact (have to compile Blender which takes a long time.)
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Oh dear. I applied those suggestions that Github offered me but it seems they were only drafts and not actually working. Sorry, haven't seen this workflow on Github before with being offered changes to adopt, didn't have a workflow for testing/evaluating them beyond a quick eyeball. Closing this PR because the review process is a bit overwhelming with all the advanced Github features and bot reviews :) |
I just got a SpacePilot Pro, and am interested in helping you test (and could implement a NixOS module too), we'll see if I can find the time to do so :) |
I don't know if there is a better way to suggest changes, but I have a couple of commits on top of yours, at https://github.com/KoviRobi/nixpkgs/commits/spacenav-nixpkgs. I reopened this, as this work is still based you yours, but I can close this and create a new PR if you want. If you want to fold my changes into yours, you should be able to do (I think)
failing that, you can just |
This runs the driver for 3D mice such as Space Navigator, Space Pilot or Space mouse.
I have also added a service, which is currently run as root :( but I couldn't get it working otherwise. It also turns out it works as a joystick out of the box, if you disable the mouse functionality, in which case you can just use the joystick input for OpenSCAD, though sadly not for blender. |
That's awesome @KoviRobi! I've pulled your commits onto this branch. If my Git-fu is lacking in some respect feel free to open a new PR from a branch of your own and we can close this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me
case 0x256F: // 3Dconnexion | ||
switch (product_id) { | ||
case 0xC62E: // plugged in | ||
- case 0xC62F: // wireless |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this somewhere upstream in blender, and could we fetchpatch
from there?
wantedBy = [ "multi-user.target" ]; | ||
partOf = [ "multi-user.target" ]; | ||
serviceConfig = { | ||
ExecStart = "${pkgs.spacenavd}/bin/spacenavd -d"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I played with this, I opened 3 issues:
- feature request: way to specify custom configuration file FreeSpacenav/spacenavd#8
This allows specifying a custom config file. We currently don't seem to configure anything? - feature request: log via syslog() instead of custom log FreeSpacenav/spacenavd#9
This introduces-l syslog
, which we should probably set, to properly capture log output - feature request: make file socket configurable FreeSpacenav/spacenavd#10
Thespnav.sock
socket currently is hardcoded, and I'm not sure about its permissions. Did you verify this works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did manage to get spacenav working with this, but it's worth pointing out that spacenav joystick support is in Linux out of the box, and you can disable the annoying mouse movements with this:
services.xserver.inputClassSections = [
''
Identifier "3Dconnexion SpacePilot PRO "
MatchProduct "3Dconnexion SpacePilot PRO "
Driver "evdev"
Option "Ignore" "on"
'' ];
But blender doesn't support mouse navigation (openscad does).
- The config file is something which we could potentially capture with nix, but given it's got a gui configurator and it's very floating-point not easy to calculate you just have to try and see what works, we do definitely want to support that.
- Good idea
- I did verify, it works (when it's launched as root, I couldn't make it work non root though :( )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this could use some documentation, maybe the inputClassSection even a NixOS option.
Can you add some module documentation, like it's done with the nextcloud module?
The config file is something which we could potentially capture with nix, but given it's got a gui configurator and it's very floating-point not easy to calculate you just have to try and see what works, we do definitely want to support that.
So you want to give this some cooking first?
I did verify, it works (when it's launched as root, I couldn't make it work non root though :( )
GUI applications need to be launched as root? Or the spacenav daemon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spacenav daemon needs to be root -- though you do need write permissions to the /etc/spnav.conf, which currently I think requires a chown.
Also, because my brain is a vegetable today, I forgot your first point, the OP did say they tried to get their patch accepted upstream, not sure if they have heard anything back from them.
I'll have a think about the config file, what I meant though is that it might not be applicable to be captured by nix, as the user might want to change it too often/faster than recompiling the system/with the gui rather than just picking values.
I'll try and remember to look at this in a couple of days when I am more functional, thanks for taking a look at this PR though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to no clear separation between user-wanted config and "state/calibration data" would indeed be a problem - let's iterate on that at a later point :-)
These three issues are duplicates of each other: |
And there is a version bump for spnavcfg too:
|
Can you also add the |
For posterity: This has been implemented in #118617. |
Motivation for this change
This PR adds hardware support for the 3Dconnexion Spacemouse (https://www.youtube.com/watch?v=4WBTJhXpnsc) to nixpkgs in general and Blender in particular.
Specifically,
spacenavd
,libspnav
,spnavcfg
.spacenavSupport
to Blender (enabled by default);This works great for me! However I have to start
spacenavd
manually as root. (I tried writing a NixOS module to operate that but my first attempt hasn't worked and I'm a bit of a systemd n00b.)Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)