I am currently working on a hardware device which is a HID class and would like to interact directly with libhid and/or libusb. Unfortunately, as soon as I statically link libhid the module won’t appear in vcvrack - no matter if there is any libhid functions used or not.
Just in case it might be relevant. How are you adding it to the make
?
EDIT: just wondering if compiling from source as a “module” with a blank panel, and a .cpp
layer to make a .o
file … replace it with a .o
from the library plus an interface in the build?
# static added later, no help
FLAGS += -I dep/hidapi/hidapi -I dep/libusb/libusb -static
# Add .cpp files to the build
SOURCES += $(wildcard src/*.cpp)
SOURCES += dep/hidapi/linux/hid.cpp
# Added later on, because HIDAPI was crashing directly.
SOURCES += dep/libusb/libusb/core.c
SOURCES += dep/libusb/libusb/descriptor.c
SOURCES += dep/libusb/libusb/hotplug.c
SOURCES += dep/libusb/libusb/io.c
SOURCES += dep/libusb/libusb/strerror.c
SOURCES += dep/libusb/libusb/sync.c
SOURCES += dep/libusb/libusb/os/linux_netlink.c
SOURCES += dep/libusb/libusb/os/linux_usbfs.c
SOURCES += dep/libusb/libusb/os/linux_udev.c
SOURCES += dep/libusb/libusb/os/threads_posix.c
From what I can gather, the only added source should be the header file. And then the lib file should be included as a bin. E.G. libc.so
→ -lc
, liblo.so
→ -llo
. You shouldn’t have to compile the library if you have the -dev
package for it.
So -lhid -lusb
need adding as flags, maybe something else for the library path, and sources maybe for the header files.
Of note is ModScript/Makefile at main · Simon-L/ModScript · GitHub as this worked after the sudo apt install liblo-dev libluajit-5.1-dev
.
I’ve tried that before, afaik with the same effects (module no longer listed in module browser)