intellimouse-ctl icon indicating copy to clipboard operation
intellimouse-ctl copied to clipboard

Error on MacOS: `OSError: open failed`

Open jonhiggs opened this issue 3 years ago • 9 comments

I'm having issues running this in MacOS 12.2.1.

$ intellimouse-ctl list
0. ProIntelliMouse @ "DevSrvsID:4295139340"
$ intellimouse-ctl get --dpi 0
Traceback (most recent call last):
  File "/usr/local/bin/intellimouse-ctl", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/intellimouse_ctl/__init__.py", line 119, in main
    with _connected_devices()[namespace.index] as device:
  File "/usr/local/lib/python3.9/site-packages/intellimouse/intellimouse.py", line 33, in __enter__
    self._device.open_path(self._path)
  File "hid.pyx", line 125, in hid.device.open_path
OSError: open failed

jonhiggs avatar Mar 22 '22 07:03 jonhiggs

Hi, thanks for your bug report! I think this might be a dupe of #10. Does the problem resolve itself when you run with sudo?

paw-eloquent-safe avatar Mar 23 '22 19:03 paw-eloquent-safe

Nope. Same error with sudo.

jonhiggs avatar Mar 24 '22 02:03 jonhiggs

Nope. Same error with sudo.

Have you tried giving accesibillity and/or input monitoring rights to your Python install and Terminal?

Like so: signal-2022-03-24-07-50-04-543.png (This screen shot is from Catalina, the UI might have changed a bit, but the same principal should still apply)

paw-eloquent-safe avatar Mar 24 '22 06:03 paw-eloquent-safe

I did some digging and I think it might be related to the following issue https://github.com/libusb/hidapi/issues/344, which is related to https://github.com/k-visscher/intellimouse-ctl/issues/10.

Please let me know if allowing input monitoring fixes your issue? (you might be thinking: "huh but a mouse isn't a keyboard?!" and you'd be right, however the IntelliMouse's (Classic/Pro) have two interfaces one being a HID mouse and the other a HID keyboard, the interface that's being used for writing/reading the settings, is unfortunately the keyboard one.)

paw-eloquent-safe avatar Mar 24 '22 18:03 paw-eloquent-safe

I really appreciate the support, but unfortunately it still isn't working. I've given iTerm and /usr/local/bin/intellimouse-ctl "Accessibility" and "Input Monitoring", but I got the same error. I then tried Terminal instead of iTerm after giving it the same permissions, but the problem remained. I'm using Python from Homebrew which might be contributing to the problem. After dereferencing the symlinks for the python interpreter in the shebang of intellimouse-ctl, I arrived at /usr/local/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/bin/python3.9. I tried to give that "Accessibility" and "Input Monitoring" permissions, but the UI had greyed out those files preventing me from doing so. I tried to install intellimouse-ctl again using the system pip3 at /usr/bin/pip3 but that was broken for other reasons -- possibly because I'm using python from Homebrew, as mentioned earlier.

I have a Debian box next to me. I think I'll just use that to set it up. I assume the settings are saved to the mouse and will travel between machines.

Thanks again for your help.

jonhiggs avatar Mar 24 '22 22:03 jonhiggs

Ah, I got it to work with the one combination I didn't try: sudo with all the accessibility permissions. Thanks. 👍

jonhiggs avatar Mar 24 '22 22:03 jonhiggs

I've tried intellimouse-ctl on both MacOS and Linux, installed using pip. Setting the permissions and using sudo worked on MacOS, but I'm getting the exact same error on Pop!_OS Linux. I don't think this is the same as the Mac issue, but it's still not able to get the device settings

File "hid.pyx", line 142, in hid.device.open_path
OSError: open failed
» intellimouse-ctl list                                                                                                                                               130 ↵
0. ProIntelliMouse @ "3-3.4.1:1.1"

nathansgithub avatar Jun 23 '22 00:06 nathansgithub

@nathansgithub

I've tried intellimouse-ctl on both MacOS and Linux, installed using pip. Setting the permissions and using sudo worked on MacOS, but I'm getting the exact same error on Pop!_OS Linux. I don't think this is the same as the Mac issue, but it's still not able to get the device settings

File "hid.pyx", line 142, in hid.device.open_path
OSError: open failed
» intellimouse-ctl list                                                                                                                                               130 ↵
0. ProIntelliMouse @ "3-3.4.1:1.1"

Thanks for your bug report!

Could you please try one of the following commands:

# classic intellimouse
sudo sh -c 'echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"045e\", ATTR{idProduct}==\"0823\", MODE=\"0666\"" >> /etc/udev/rules.d/z21_persistent-local.rules'

or

# pro intellimouse
sudo sh -c 'echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"045e\", ATTR{idProduct}==\"082a\", MODE=\"0666\"" >> /etc/udev/rules.d/z21_persistent-local.rules'

then

sudo udevadm control --reload-rules && reboot

then once you're rebooted something like:

intellimouse-ctl get --dpi 0

Let me know if that worked for you! ;)

paw-eloquent-safe avatar Jun 26 '22 22:06 paw-eloquent-safe

Thanks @k-visscher! It's working after I added that udev rule.

nathansgithub avatar Jun 27 '22 14:06 nathansgithub