Git Product home page Git Product logo

Comments (4)

Jaharmi avatar Jaharmi commented on June 27, 2024 1

Since reporting the issue, I was able to get this to work:

  1. Tried to compile hidapi directly on macOS Catalina, which I couldn't get to work.
  2. Compiled hidapi on macOS Mojave, which installed it to /usr/local/lib.
  3. I was able to use hidapi and this module on Mojave to control a Blynclight. Yay!
  4. Copied that and installed the hidapi files to the same location on macOS Catalina.
  5. I was able to use this module on Catalina to control a Blynclight.
  6. Profit!

So, it seems like the problem is either with a) what the MacPorts port command produced or b) with the location where it was installed. MacPorts installs under /opt.

Assuming it compiled correctly, I'm wondering if the /opt location is or can be searched for the library. I'm not sure how to check — or set — that for libraries (like PATH for executables).

From MacPorts:

$ ls -1 /opt/local/lib/ | grep hid
libhidapi.0.dylib
libhidapi.a
libhidapi.dylib

What I copied from macOS Mojave:

$ ls -1 /usr/local/lib/ | grep hid
libhidapi.0.dylib
libhidapi.a
libhidapi.dylib
libhidapi.la

Update: I found these references:

The MacPorts path of /opt is not in the list, per the Stackoverflow article. I'm still not sure how to / if it's possible to add a path for ctypes.util.find_library to search.

Update 2: Also found something that appears similar:

I will keep looking to find a way to add /opt.

from blynclight.

JnyJny avatar JnyJny commented on June 27, 2024

The error in your traceback comes from ctypes.util.find_library failing to find the installed hidapi library.

import ctypes.util

print(ctypes.util.find_library('hidapi'))

I'm not familiar with port so I don't know how it manages the files it installs.

from blynclight.

JnyJny avatar JnyJny commented on June 27, 2024

Thanks for all the detailed information on what you had to do to get BlyncLight running!

I'll dig into find_library and see if I can improve how the shared library is located.

from blynclight.

JnyJny avatar JnyJny commented on June 27, 2024

So looking at the code for ctypes.util.macholib.dylib I found an environment variable you can set to help find_library .. uh.. find the library.

$ export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib

I tested this on my macOS 10.15.5 installation after installing Mac Ports:

$ which port
/opt/local/bin/port
$ brew uninstall hidapi
...
$ blync -a
<blows up>
$ sudo port install hidapi
...
$ blync -a
<still blows up, expected>
$ export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib
$ blync -a
Number of available lights: 1
                 KEY:ID:VALUE
                path:00:IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/TRP0@7/IOPP/PXSX@0/IOPP/pci-bridge@2/IOPP/pci1b21,1242@0/AppleUSBXHCIPCI@00000000/AppleUSB20XHCIPort@00300000/Blynclight Plus@00300000/IOUSBHostInterface@0/AppleUserUSBHostHIDDevice
           vendor_id:00:0x2c0d
          product_id:00:0x10
      release_number:00:0x100
      product_string:00:Blynclight Plus
          usage_page:00:0xff00
               usage:00:0x1
    interface_number:00:0x0

Add that to your shell's profile script and you should be able to skip copying things to /usr/local.

from blynclight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.