You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When initializing a Se2SpaceMouse or Se3SpaceMouse device, allow custom lookup product_strings. Also, sometimes hid detects device is already open even when the device is not actually used by other processes, so maybe the runtime error here can be allowed.
For example, change the self._find_device(self) (here) to:
def _find_device(self, product_string_lookup="SpaceMouse Compact"):
"""Find the device connected to computer."""
found = False
# implement a timeout for device search
for _ in range(5):
for device in hid.enumerate():
if device["product_string"] == product_string_lookup:
# set found flag
found = True
vendor_id = device["vendor_id"]
product_id = device["product_id"]
# connect to the device
try:
self._device.open(vendor_id, product_id)
except RuntimeError:
print("device already opened")
# check if device found
if not found:
time.sleep(1.0)
else:
break
# no device found: return false
if not found:
raise OSError("No device found by SpaceMouse. Is the device connected?")
Motivation
Current implementation assumes a fixed product_string device["product_string"] == "SpaceMouse Compact"
But other devices have different production strings, e.g. https://3dconnexion.com/us/ space mouse has "3Dconnexion Universal Receiver" as product_string
The text was updated successfully, but these errors were encountered:
Proposal
When initializing a
Se2SpaceMouse
orSe3SpaceMouse
device, allow custom lookup product_strings. Also, sometimeshid
detects device is already open even when the device is not actually used by other processes, so maybe the runtime error here can be allowed.For example, change the
self._find_device(self)
(here) to:Motivation
Current implementation assumes a fixed product_string
device["product_string"] == "SpaceMouse Compact"
But other devices have different production strings, e.g. https://3dconnexion.com/us/ space mouse has
"3Dconnexion Universal Receiver"
as product_stringThe text was updated successfully, but these errors were encountered: