mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-08 19:29:11 +08:00
3Dconnexion devices -> Another change in logic to select device
This commit is contained in:
parent
b10d128ffd
commit
a87d83aeb1
@ -462,7 +462,9 @@ bool Mouse3DController::connect_device()
|
|||||||
{
|
{
|
||||||
if (device.second.size() == 1)
|
if (device.second.size() == 1)
|
||||||
{
|
{
|
||||||
path = device.second.front().path;
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
// path = device.second.front().path;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
vendor_id = device.first.first;
|
vendor_id = device.first.first;
|
||||||
product_id = device.first.second;
|
product_id = device.first.second;
|
||||||
break;
|
break;
|
||||||
@ -484,6 +486,12 @@ bool Mouse3DController::connect_device()
|
|||||||
product_id = device.first.second;
|
product_id = device.first.second;
|
||||||
found = true;
|
found = true;
|
||||||
hid_close(test_device);
|
hid_close(test_device);
|
||||||
|
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
|
||||||
|
std::cout << std::endl << "PASSED TEST device:" << std::endl;
|
||||||
|
std::cout << "Manufacturer id.....: " << vendor_id << " (" << std::hex << vendor_id << std::dec << ")" << std::endl;
|
||||||
|
std::cout << "Product id..........: " << product_id << " (" << std::hex << product_id << std::dec << ")" << std::endl;
|
||||||
|
std::cout << "Path................: '" << path << "'" << std::endl;
|
||||||
|
#endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if (data.interface_number == 1)
|
// if (data.interface_number == 1)
|
||||||
@ -508,11 +516,25 @@ bool Mouse3DController::connect_device()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
return false;
|
{
|
||||||
|
if ((vendor_id != 0) && (product_id != 0))
|
||||||
|
// Open the 3Dconnexion device using vendor_id and product_id
|
||||||
|
m_device = hid_open(vendor_id, product_id, nullptr);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// Open the 3Dconnexion device using the device path
|
||||||
|
m_device = hid_open_path(path.c_str());
|
||||||
|
|
||||||
// Open the 3Dconnexion device using the device path
|
// if (path.empty())
|
||||||
m_device = hid_open_path(path.c_str());
|
// return false;
|
||||||
|
//
|
||||||
|
// // Open the 3Dconnexion device using the device path
|
||||||
|
// m_device = hid_open_path(path.c_str());
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
if (m_device != nullptr)
|
if (m_device != nullptr)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user