Open archywelker opened 1 year ago
@archywelker I had the same error, and it might be because of the version of the libhidapi-dev
package you have installed. You can check this by running dpkg --list | grep hid
. In my case, I had version 0.11.2-1 installed using apt-get, but the latest one is 0.13.1. And hid_get_device_info
is pretty new API and available since 0.13. So, just update the package to the latest version, and you should be good to go!
Personally, I'm a newbie with all this apt-get
and cmake
stuff, and I didn't succeed in installing the latest version of the libhidapi-dev
package, anything newer than version 0.11.2-1. So, I decided to build libhidapi-dev
from source. Here are the steps to do it:
libudev-dev
and libusb-1.0-0-dev
packages as it is said in the instructions provided in the repository's BUILD.md.pkg_search_module(HIDAPI REQUIRED hidapi-libusb hidapi)
withfind_package(hidapi REQUIRED)
. Then replace target_link_libraries(co2mon ${HIDAPI_LIBRARIES})
with target_link_libraries(co2mon PRIVATE hidapi::hidapi)
.Without doubt not the best way, but it worked for me :)
Solution by @Sencudra worked but i get an error
root@ubuntu:~/co2mon/build/co2mond# ./co2mond
hid_open: error
Unable to open CO2 device
hid_open: error
Yet i have my sensor plugged in
root@ubuntu:~/co2mon/build/co2mond# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 04d9:a052 Holtek Semiconductor, Inc. USB-zyTemp
Bus 001 Device 002: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Update:
It works using sudo ./co2mond
Note that the dependency was introduced recently in #47 to auto-detect whether a decoding step is necessary.
You might find it easier to build from an older revision (git checkout f47ec3d7e72ad4b8bc163a515b6e66bd94a6b02e
) and run co2mond -n
if your device requires so.
Ошибка при попытке собрать под Orange Pi Zero2. OS: Ubuntu 20.04 (4.9.170.7)