Skip to main content

Crate spacemouse

Crate spacemouse 

Source
Expand description

SpaceMouse Driver

Cross-platform (Windows/macOS/Linux) driver for 3Dconnexion SpaceMouse and compatible 3D-mouse devices. Accesses the device by raw HID capture (through the hidapi crate), thus doesn’t require any additional software or driver to be installed. In particular, neither 3DxWare nor spacenavd is needed.

The crate offers two layers:

  • SpaceMouse gives synchronous access to a device: scan for and open it, read events, and set its LED. The caller drives it.
  • SpaceMouseThread uses a SpaceMouse in a background thread (with auto-reconnect logic) and delivers SpaceMouseEvents to a callback.

This crate deliberately knows nothing about sensitivity, inversion, calibration or dead-zones. It always reports the device’s raw, unscaled axis readings. Data manipulation (scaling, filtering, mapping to application actions, etc.) is left entirely to the caller.

§Example

See usage examples in SpaceMouse and SpaceMouseThread.

§Linux Device Permissions

On Linux, hidraw device nodes are readable by root only by default. See README.md for instructions to allow non-root access by installing the provided udev rule.

Structs§

SpaceMouse
Synchronous access to a SpaceMouse (3D mouse) HID device.
SpaceMouseThread
Cross-platform SpaceMouse HID capture thread.

Enums§

SpaceMouseError
Errors reported by SpaceMouse.
SpaceMouseEvent
An event reported by the SpaceMouse capture loop.