Closed bkcrisler closed 5 years ago
Dang that's the same problem as the libhidapi solution that I jettisoned for PyUSB. Thank you for report and resolution. I'll update the README with Linux and macOS best practices for install libusb and then think about how to automate getting it installed.
Seems like there also a problem with the permissions. Its more to do with libusb:
`
from blynclight import BlyncLight light = BlyncLight.first_light() red, blue, green = (255, 0, 0), (0, 255, 0), (0, 0, 255) light.color = green Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.7/site-packages/blynclight/blynclight.py", line 190, in setattr super().setattr(name, value) File "/usr/local/lib/python3.7/site-packages/blynclight/blynclight.py", line 312, in color self.update_device() File "/usr/local/lib/python3.7/site-packages/blynclight/blynclight.py", line 386, in update_device self._timeout) File "/usr/local/lib/python3.7/site-packages/usb/core.py", line 1034, in ctrl_transfer self._ctx.managed_claim_interface(self, interface_number) File "/usr/local/lib/python3.7/site-packages/usb/core.py", line 102, in wrapper return f(self, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/usb/core.py", line 167, in managed_claim_interface self.backend.claim_interface(self.handle, i) File "/usr/local/lib/python3.7/site-packages/usb/backend/libusb1.py", line 811, in claim_interface _check(self.lib.libusb_claim_interface(dev_handle.handle, intf)) File "/usr/local/lib/python3.7/site-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
This is raised on a different thread here:
Thanks, that is definitely a permission problem. Can you post the output of the terminal command "groups"? Maybe I can see what group you need to be in to access the light.
I have the same issue, here is my groups
output:
staff com.apple.sharepoint.group.1 everyone localaccounts _appserverusr admin _appserveradm _lpadmin
com.apple.access_screensharing access_bpf com.apple.sharepoint.group.2 _appstore _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_ssh
Just a quick note that I'm working on this but have nothing to show for it yet.
Out of curiosity, what level macOS are you using? I started running into this problem when I updated to Mojave and haven't had time to debug it sufficiently.
This is Python 3.6.4, pyusb 1.0.2, Mac 10.14.4
So it looks like I'll need to go back to hidapi since pyusb has no plans to make this work on macOS. To be fair, it's not a PyUSB problem, it's an "Apple not playing well with open source" problem (AFAICT).
I've just pushed changes to how USB devices are accessed by the blynclight module. For macOS, Linux and Windows you'll need to install the hidapi library. The easiest way to do that for macOS is using brew
:
$ brew install hidapi
I've tested specifically with version 0.8.0-rc1
of hidapi.
Give it a try and let me know what trouble you run into.
Closing this issue as solved... for now.
this update worked ... thanks a lot!
Great news! Thank you for the feedback, that means a lot to me.
Thanks for all your hard work @JnyJny . I seem to be having the same error
bash-3.2$ python antfs_list.py Driver available: [<class 'ant.base.driver.SerialDriver'>, <class 'ant.base.driver.USB2Driver'>, <class 'ant.base.driver.USB3Driver'>] Aborted Stop Traceback (most recent call last): File "antfs_list.py", line 93, in <module> main() File "antfs_list.py", line 81, in main a = Listener() File "antfs_list.py", line 36, in __init__ Application.__init__(self) File "/Users/justin/anaconda3/lib/python3.6/site-packages/ant/fs/manager.py", line 107, in __init__ self._node = Node() File "/Users/justin/anaconda3/lib/python3.6/site-packages/ant/easy/node.py", line 55, in __init__ self.ant = Ant() File "/Users/justin/anaconda3/lib/python3.6/site-packages/ant/base/ant.py", line 46, in __init__ self._driver = find_driver() File "/Users/justin/anaconda3/lib/python3.6/site-packages/ant/base/driver.py", line 272, in find_driver if driver.find(): File "/Users/justin/anaconda3/lib/python3.6/site-packages/ant/base/driver.py", line 159, in find usb.core.find(idVendor=cls.ID_VENDOR, idProduct=cls.ID_PRODUCT) File "/Users/justin/anaconda3/lib/python3.6/site-packages/usb/core.py", line 1297, in find raise NoBackendError('No backend available') usb.core.NoBackendError: No backend available bash-3.2$
I tried $ brew install hidapi
to no avail. Any suggestions? macOS Mojave 10.14.4 macbook pro 2017
Whoa. First off it appears that antfs_list.py
uses PyUSB which is a different method of accessing USB devices than used by HID API, so installing hidapi
probably (for sure) isn't going to solve this problem. I develop on a Mac and around the Mojave timeframe I started having trouble with PyUSB and I switched to HID API to communicate with USB devices. I did some searching and I'm guessing that this is from the openant
project; I didn't see any issues for MacOS there. A casual inspection of the code seems to indicate the author is mostly developing for a Linux environment, so might not be aware of MacOS related problems with USB devices.
Take a look at the PyUSB FAQ and see if this helps
Thanks for the quick feedback... will do.
Justin
`>>> from blynclight import BlyncLight
Issue is resolved by:
brew install libusb
since they PyUSB won't work properly without libusb