Comments (15)
I'm investigating this, it's possibly a bug in how I'm calling nope looks like hidapi.write
hid_open
(fingers crossed).
from blynclight.
I couldn't recreate the bug on my machine with my lights, but I'm hoping I found the problem and pushed a revision to PyPI (0.6.4 0.7.1). If you could install that and give me some feedback that would be awesome.
from blynclight.
Well crap. I was hoping that would fix the problem obviously.
What's happening in the stack trace you provided is pretty straightforward:
- The BlyncLight object is instantiated but the
handle
property isn't initialized until it's first use (as designed) - The first write to the device accesses the
handle
property - The handle property method calls
hidapi.hid_open(vender_id, product_id, None)
- When the library returns None/NULL we raise the LookupError.
I was accidentally passing the 'path' attribute as the third argument to hid_open
when it was expecting None or the device's serial number. That was a bug for sure on my part, but not the problem you are encountering. So hid_open is failing for some other reason. The duh is implied I guess.
One thing that stuck out to me and I can't explain is the empty 'path' attribute in your blync -a
output. I had just removed that attribute from the output of the report since it can be annoyingly long under MacOS and it didn't seem very helpful. I just added it back into the output for version 0.7.2 (which I just pushed to PyPI).
On my Mac 10.10.5 installation with hidapi 0.9.0 I get the following output:
BlyncLights :2
ID:KEY :VALUE
00:path :IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/TRP0@7/IOPP/PXSX@0/IOPP/pci-bridge@0/IOPP/pci1b73,1100@0/AppleUSBXHCIFL1100@01000000/AppleUSB20XHCIPort@01100000/Blynclight Plus@01100000/IOUSBHostInterface@0/AppleUserUSBHostHIDDevice
00:vendor_id :0x2c0d
00:product_id :0x10
00:release_number :0x100
00:product_string :Blynclight Plus
00:usage_page :0xff00
00:usage :0x1
00:interface_number:0x0
ID:KEY :VALUE
01:path :IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/TRP0@7/IOPP/PXSX@0/IOPP/pci-bridge@2/IOPP/pci1b21,1242@0/AppleUSBXHCIPCI@00000000/AppleUSB20XHCIPort@00300000/Blynclight@00300000/IOUSBHostInterface@0/AppleUserUSBHostHIDDevice
01:vendor_id :0x2c0d
01:product_id :0x1
01:release_number :0x100
01:product_string :Blynclight
01:usage_page :0xff00
01:usage :0x1
01:interface_number:0x0
If I wrote some C tools for debugging this problem, would you be able to compile and run them? If not I'll figure something else out. It would be great if you could install the new version and respond back with the blync -a
output too!
from blynclight.
I read about some sort of "IOExplorer" tool in the Apple Developer Tools bundle, but haven't pursed it yet.
Just for grins, I just published 0.8.0 to PyPI. I removed my ctypes interface to hidapi (blynclight.hid) and replaced it with hidapi which has two virtues: somebody else is (actively) maintaining it and they are tracking hidapi. Give it a shot, if the error was somewhere in my hid implementation this change may fix the problem. Fingers crossed.
from blynclight.
How did you install hidapi
on your Mac? MacPorts, brew or something else?
from blynclight.
I installed hidapi
via brew install hidapi
. Checking the new version!
from blynclight.
Just installed the latest version from the GitHub repo (via pip install .
) - not sure if the PyPI release would be different, but seems like the error is the same. I wouldn't exclude the fact that something is wrong with hidapi
.
from blynclight.
Ok, I think I've been able to recreate this problem. I suspect that you have another application running that has an open file descriptor for the light; Teams or Skype or something else maybe? The lights can only be opened by one application at a time.
from blynclight.
Hmm... interesting. Definitely do not see another application that would be using the light. I will need to dig into this a bit to see if I can identify how to get a list of applications using a USB device. Updated to the latest version and ran blync -a
, and getting this output:
BlyncLights :1
ID:KEY :VALUE
00:path :
00:vendor_id :0xe53
00:product_id :0x2517
00:release_number :0x100
00:product_string :Blynclight
00:usage_page :0xff00
00:usage :0x1
00:interface_number:0x0
Empty path here. The weird thing about the light is that it works fine with blync
on another machine, that is on the same macOS version, using the same hidapi
release.
If I wrote some C tools for debugging this problem, would you be able to compile and run them? If not I'll figure something else out. It would be great if you could install the new version and respond back with the blync -a output too!
Sure, I can test with C tools - new to HID APIs, but can figure things out.
from blynclight.
I wonder if this has something to do with macOS restrictions. Will have to dig into this a bit later, but I would not exclude that there is something here natively in the OS blocking HID path access.
from blynclight.
Thanks for the pointer, following the rabbit hole led to this commit which indicates a known limitation: https://github.com/claui/python-fido2/commit/79173f8d2ce55d26543b8b1af03bc2eda6f8a413
I'm curious how your blynclight is connected ( hub connected to a hub connected to a hub to the Mac )? If it's a long chain can you shorten the chain to consequently shorten the generated path length ?
from blynclight.
I get this sort of error if I have the Embrava software open or if I have been controlling the device in an active Python interpreter. Once I closed ptpython
(in one Terminal tab), I'm able to use the CLI tool in another tab.
from blynclight.
@JnyJny @Jaharmi I did connect it through a hub, but on another Mac it's connected through the same hub and it works with no issues. The interesting part is that I do not see any other application that obviously is using the light. I need to see if there is an alternative way to get the path to the device outside the blync
CLI. If you folks have any suggestions, I am happy to try them!
from blynclight.
Bingo - pulling the latest version from PyPI did it, and it now works properly 🙏 Thank you @JnyJny! Excited to see the source code that you publish for 0.8.0.
from blynclight.
That is great news!
from blynclight.
Related Issues (20)
- Commands to Light Not Processing HOT 17
- Support PyUSB & HIDAPI
- ear HOT 1
- pip3 install in editable mode doesn't work HOT 1
- Flash not working HOT 3
- Installing on a Raspberry Pi HOT 20
- Control from iOS shortcut application HOT 3
- ImportError: failed to locate hidapi shared object on macOS Catalina HOT 4
- ImportError after Pip update to v0.8.0 HOT 9
- ship a command line interface and driver script HOT 1
- [QUESTION] Source of COMMAND_LENGTH HOT 3
- RFE: add a udev rule to docs HOT 6
- Candle flicker effect command-line interface.
- Light not recognized. HOT 5
- MacOSX - usb.core.NoBackendError: No backend available when calling BlyncLight.available_lights() HOT 14
- Add an effects package. HOT 1
- Create a simple API server and ship in scripts directory.
- Python version testing with tox
- Relax version requirements for Python from only 3.7 to 3.5 or better HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynclight.