Fix of 3DConnexion 3D SpaceMouse Jumpy Pan moves on Linux

Also improved error reporting on Linux about the 3DConnexion device
access issues.
This commit is contained in:
Vojtech Bubnik 2020-12-15 14:26:33 +01:00
parent d59f345fbb
commit aa8f97fce2

View file

@ -346,7 +346,6 @@ bool Mouse3DController::State::apply(const Mouse3DController::Params &params, Ca
if (params.swap_yz) if (params.swap_yz)
rot = Vec3d(rot.x(), -rot.z(), rot.y()); rot = Vec3d(rot.x(), -rot.z(), rot.y());
camera.rotate_local_around_target(Vec3d(rot.x(), - rot.z(), rot.y())); camera.rotate_local_around_target(Vec3d(rot.x(), - rot.z(), rot.y()));
break;
} else { } else {
assert(input_queue_item.is_buttons()); assert(input_queue_item.is_buttons());
switch (input_queue_item.type_or_buttons) { switch (input_queue_item.type_or_buttons) {
@ -895,7 +894,10 @@ bool Mouse3DController::connect_device()
if (device.second.size() == 1) { if (device.second.size() == 1) {
#if defined(__linux__) #if defined(__linux__)
hid_device* test_device = hid_open(device.first.first, device.first.second, nullptr); hid_device* test_device = hid_open(device.first.first, device.first.second, nullptr);
if (test_device != nullptr) { if (test_device == nullptr) {
BOOST_LOG_TRIVIAL(error) << "3DConnexion device cannot be opened: " << device.second.front().path <<
" You may need to update /etc/udev/rules.d";
} else {
hid_close(test_device); hid_close(test_device);
#else #else
if (device.second.front().has_valid_usage()) { if (device.second.front().has_valid_usage()) {
@ -940,10 +942,13 @@ bool Mouse3DController::connect_device()
break; break;
} }
#endif // __linux__ #endif // __linux__
else {
BOOST_LOG_TRIVIAL(error) << "3DConnexion device cannot be opened: " << data.path <<
" You may need to update /etc/udev/rules.d";
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
else
std::cout << "-> NOT PASSED" << std::endl; std::cout << "-> NOT PASSED" << std::endl;
#endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT #endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
}
} }
if (found) if (found)