Skip to content

SpaceMouse Compact found, but "Failed to open device(Linux) #32

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

Open
FANMOSHENG opened this issue Nov 21, 2024 · 2 comments
Open

SpaceMouse Compact found, but "Failed to open device(Linux) #32

FANMOSHENG opened this issue Nov 21, 2024 · 2 comments

Comments

@FANMOSHENG
Copy link

I encountered an issue while trying to use my SpaceMouse Compact with the pyspacemouse library. The device is detected, but it fails to open, resulting in the following traceback:

Traceback (most recent call last):
  File "/home/ur5/.local/lib/python3.8/site-packages/pyspacemouse/pyspacemouse.py", line 183, in open
    self.device.open()
  File "/home/ur5/.local/lib/python3.8/site-packages/easyhid/easyhid.py", line 134, in open
    raise HIDException("Failed to open device")
easyhid.easyhid.HIDException: Failed to open device

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ur5/Desktop/test/spacemouse.py", line 4, in <module>
    success = pyspacemouse.open()
  File "/home/ur5/.local/lib/python3.8/site-packages/pyspacemouse/pyspacemouse.py", line 899, in open
    new_device.open()
  File "/home/ur5/.local/lib/python3.8/site-packages/pyspacemouse/pyspacemouse.py", line 185, in open
    raise Exception("Failed to open device") from e
Exception: Failed to open device

Any idea where it come from ? Thank you.

@dexin-wang
Copy link

same problem, have you solved?

@dexin-wang
Copy link

已解决,都是中国人就不写英文了。

(1) 默认情况下,普通用户可能没有权限访问 HID 设备,可以通过设置 udev 规则解决:

cd /etc/udev/rules.d
sudo touch 99-spacemouse.rules
sudo gedit 99-spacemouse.rules

在新建的99-spacemouse.rules中添加以下内容

SUBSYSTEM=="input", GROUP="input", MODE="0660"
KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c62b", MODE="0666"

idVendor 和 idProduct 的值可以通过运行以下命令找到:

lsusb

找到类似 Bus 001 Device 013: ID 256f:c652 3Dconnexion 3Dconnexion Universal Receiver 的设备,这里的 256fVendor IDc652Product ID

(2) 重新加载 udev 规则:

sudo udevadm control --reload-rules
sudo udevadm trigger

(3) 断开并重新连接 SpaceMouse Wireless
确保当前用户属于 input 组:

sudo usermod -a -G input $USER

(4) 注销并重新登录ubuntu

原文链接:https://blog.csdn.net/qq_40081208/article/details/144306644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants