Giter Site home page Giter Site logo

Comments (3)

Sencudra avatar Sencudra commented on September 18, 2024

@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:

  1. First, download the source code from the hidapi repository. All the instructions on how to build a standalone package from the source code are available there.
  2. Install the libudev-dev and libusb-1.0-0-dev packages as it is said in the instructions provided in the repository's BUILD.md.
  3. Build and install the standalone package according to the instructions in the BUILD.cmake.md file.
  4. Once hidapi is installed, you can build co2mon. To do so, adjust the CMake file in the repository to use the standalone package. Replace pkg_search_module(HIDAPI REQUIRED hidapi-libusb hidapi) with find_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 :)

from co2mon.

d8rt8v avatar d8rt8v commented on September 18, 2024

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

from co2mon.

nickolay avatar nickolay commented on September 18, 2024

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.

from co2mon.

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.