Giter Site home page Giter Site logo

co2mon's People

Contributors

alexparamonov avatar chrisberkhout avatar darkk avatar displacer avatar dmage avatar gsauthof avatar l29ah avatar maklaut avatar self-perfection avatar vascom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

co2mon's Issues

warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Compiled on Debian

In file included from /usr/include/fcntl.h:25:0,                                                                                                        
                 from /root/co2mon/co2mond/src/main.c:23:                                                                                               
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]                             
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"                                                                           
   ^~~~~~~                                                                                                                          

Add a file for device status to datadir

Can you add a file that shows current status of the device - is it connected to usb or not, and maybe some other statuses that this device supports (mode? calibration period? malfunctioning?).

magic_table & decode_buf

Пытаюсь повторить процедуру на java (usb4java), но никак не удается получить правильные данные на выходе. Magic_table всегда разная (так должно быть?), result[4] тоже всегда разная (и не 0x0d), checksum (result[3]) тоже не сходится.
Подскажите пожалуйста, где можно узнать подробности такого странного кодирования данных, включая magic_table, Htemp99e и пр.
Где-то есть описание, либо был жесткий reverse engineering?
Спасибо.

Mac OS X

Привет. Установил из brew всё необходимое, компиляция прошла успешно. Но при запуске вижу
~/co2mon/build $ ./co2mond
Unable to connect to D-Bus: Не удалось подключиться к: No such file or directory

co2mon.c:(.text+0x114): undefined reference to `hid_get_device_info'

Ошибка при попытке собрать под Orange Pi Zero2.
OS: Ubuntu 20.04 (4.9.170.7)

root@orangepizero2:~/co2mon/build# cmake ..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for one of the modules 'hidapi-libusb;hidapi'
-- Looking for libusb_strerror
-- Looking for libusb_strerror - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /root/co2mon/build
root@orangepizero2:~/co2mon/build# make
Scanning dependencies of target co2mon
[ 25%] Building C object libco2mon/CMakeFiles/co2mon.dir/src/co2mon.c.o
/root/co2mon/libco2mon/src/co2mon.c: In function ‘co2mon_open_device’:
/root/co2mon/libco2mon/src/co2mon.c:59:39: warning: implicit declaration of function ‘hid_get_device_info’ [-Wimplicit-function-declaration]
   59 |         struct hid_device_info *hdi = hid_get_device_info(dev);
      |                                       ^~~~~~~~~~~~~~~~~~~
/root/co2mon/libco2mon/src/co2mon.c:59:39: warning: initialization of ‘struct hid_device_info *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
[ 50%] Linking C static library libco2mon.a
[ 50%] Built target co2mon
Scanning dependencies of target co2mond
[ 75%] Building C object co2mond/CMakeFiles/co2mond.dir/src/main.c.o
[100%] Linking C executable co2mond
/usr/bin/ld: ../libco2mon/libco2mon.a(co2mon.c.o): in function `co2mon_open_device':
co2mon.c:(.text+0x114): undefined reference to `hid_get_device_info'
collect2: error: ld returned 1 exit status
make[2]: *** [co2mond/CMakeFiles/co2mond.dir/build.make:85: co2mond/co2mond] Error 1
make[1]: *** [CMakeFiles/Makefile2:142: co2mond/CMakeFiles/co2mond.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Выход из hibernate

После выхода из hibernate получаю многократно повторяющееся сообщение в лог от ядра, пока не переткну девайс:

usb 4-1.4: usbfs: process 326 (monitor_loop) did not claim interface 0 before use

Пре пететыке у меня co2mond перезапускается автоматически — через правила udev и systemd-сервис.

Build on Debian jessie

CMakeError.txt
CMakeOutput.txt

Please, help me build co2mon on Debian jessie.
I'm having next error during cmake run:

chudsaviet@co2mon:~/co2mon/build$ cmake ..
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- checking for one of the modules 'hidapi-libusb;hidapi'
CMake Error at /usr/share/cmake-3.0/Modules/FindPkgConfig.cmake:425 (message):
None of the required 'hidapi-libusb;hidapi' found
Call Stack (most recent call first):
libco2mon/CMakeLists.txt:7 (pkg_search_module)

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- checking for one of the modules 'hidapi-libusb;hidapi'
CMake Error at /usr/share/cmake-3.0/Modules/FindPkgConfig.cmake:425 (message):
None of the required 'hidapi-libusb;hidapi' found
Call Stack (most recent call first):
co2mond/CMakeLists.txt:5 (pkg_search_module)

-- Configuring incomplete, errors occurred!
See also "/home/chudsaviet/co2mon/build/CMakeFiles/CMakeOutput.log".
See also "/home/chudsaviet/co2mon/build/CMakeFiles/CMakeError.log".

CmakeOutput and CMakeError are attached.

Packages libusb-dev, libusb-1-0-0-dev and libhidapi-dev are installed.
CMake is 3.0.7, also tried 3.7 from sid.

Images description

Из названия файла я понял что:
graph-co2-1h.png - часовой график СО2
graph-temp-1h.png - часовой график температуры

Можете пояснить суть картинок graph-6d-1h.png и graph-56-1h.png ?

error message humanization

If co2mond has never beed runned and CntR/Tamb are absent it gives could not convert string to float instead of clean error message:

% cat /etc/collectd/collectd.conf.d/co2mon.conf 
LoadPlugin python
<Plugin python>
	ModulePath "/home/sergio/co2mon/graph/collectd"
	LogTraces true
	Interactive false
	Import "co2mon"
</Plugin>
collectd: Unhandled python exception in read callback: ValueError: could not convert string to float: 
collectd: Traceback (most recent call last):
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 26, in read_callback#012    co2 = [read_metric('CntR')]
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 12, in read_metric#012    return float(v)
collectd: ValueError: could not convert string to float: 
collectd: read-function of plugin `python.co2mon' failed. Will suspend it for 40.000 seconds.
collectd: Unhandled python exception in read callback: ValueError: could not convert string to float: 
collectd: Traceback (most recent call last):
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 26, in read_callback#012    co2 = [read_metric('CntR')]
collectd:   File "/home/sergio/co2mon/graph/collectd/co2mon.py", line 12, in read_metric#012    return float(v)
collectd: ValueError: could not convert string to float: 
collectd: read-function of plugin `python.co2mon' failed. Will suspend it for 80.000 seconds.

Unexpected data from device (data[4] = fb, want 0x0d)

It seems there is new revision of ZGm053U hardware with new protocol, bought at dadget.ru. Doesn't works with apps from dadget.ru, but works with latest windows software from http://www.zyaura.com/

...
Unexpected data from device (data[4] = fa, want 0x0d)
Unexpected data from device (data[4] = fb, want 0x0d)
Unexpected data from device (data[4] = fa, want 0x0d)
Unexpected data from device (data[4] = ff, want 0x0d)
Unexpected data from device (data[4] = f9, want 0x0d)
Unexpected data from device (data[4] = f9, want 0x0d)
Unexpected data from device (data[4] = fc, want 0x0d)
Unexpected data from device (data[4] = fd, want 0x0d)
Unexpected data from device (data[4] = f9, want 0x0d)
Unexpected data from device (data[4] = fa, want 0x0d)
...

Does anyone have the same problems? Is there any chance to implement new protocol?

Wrong libco2mon.so install path

On x86_64 system libco2mon.so installed into /usr/lib instead of /usr/lib64.
Cmake should catch -DLIB_INSTALL_DIR directive for proper lib install path.

Arm compilation

Hi, so in default PKGBUILD arch=('i686' 'x86_64'), but i wanted to use it on raspberry pi archlinux arm os.
So i

  1. changed arch=('i686' 'x86_64' 'armv7h') in PKGBUILD
  2. install clang (cmake print some error with gcc)
  3. CC=/usr/bin/clang CXX=/usr/bin/clang++ makepkg -si (rm -rf src/co2mon/build/ if you mess up with command on first try)

There will be a lot of errors in the process, for example about clang: warning: argument unused during compilation: '-fstack-clash-protection'
but in the end it works ¯\_(ツ)_/¯
hope this helps someone)

-P option crashes when run from a systemd service

Logs looked like this:

Oct 13 19:15:29 hostname systemd[1]: Started Polling daemon for masterkit co2monitor.
Oct 13 19:15:29 hostname co2mond[31973]: co2mond: signal(SIGPIPE, SIG_IGN): Success
Oct 13 19:15:29 hostname systemd[1]: co2mon.service: Main process exited, code=exited, status=1/FAILURE
Oct 13 19:15:29 hostname systemd[1]: co2mon.service: Failed with result 'exit-code'.

The same command was working outside of systemd and it took me a while to figure out that it wasn't a resource authorization issue.

It was failing at co2mond/src/main.c:692.

Adding IgnoreSIGPIPE=no to the service definition avoids the problem.

Maybe there's a more graceful way to handle the signal(SIGPIPE, SIG_IGN) response with systemd's default behavior.

MT8957s device via com port

Hello. I'm a little off topic.
In official programs under Windows OS for the MT8957s device, there is a setting "from where to read device data - from "usb" or from "com port"".
In this project, you will be able to read data only from USB.

Please help me find a way to read (and decrypt) data from the com port of this device.
I do not know the port settings, but it is there).

All this is necessary in order for the device to be located far from the computer and the data from the com port could be read by the esp module, for example, and sent to the smart home (home assistant)

photo_2023-03-19_12-40-38

cmake mac os None of the required 'hidapi-libusb;hidapi' found

Почитал закрытый таск по mac os, попробовал:
brew install libusb
brew install hidapi
осталась ошибка

$ cmake ..
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Checking for one of the modules 'hidapi-libusb;hidapi'
CMake Error at /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPkgConfig.cmake:646 (message):
None of the required 'hidapi-libusb;hidapi' found
Call Stack (most recent call first):
libco2mon/CMakeLists.txt:7 (pkg_search_module)

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Checking for one of the modules 'hidapi-libusb;hidapi'
CMake Error at /usr/local/Cellar/cmake/3.6.3/share/cmake/Modules/FindPkgConfig.cmake:646 (message):
None of the required 'hidapi-libusb;hidapi' found
Call Stack (most recent call first):
co2mond/CMakeLists.txt:5 (pkg_search_module)

Missing install target in Makefile

Are you plan add install target to make command? So it can be installed to system, avaivaible to all users and can be packaged for different distributives.

Raspberry pi compilation error

Пытаюсь скомпилировать под raspbery pi но не находит библиотеки:

pi@raspberrypi ~/co2mon/build $ cmake ..
-- checking for module 'libusb-1.0'
-- package 'libusb-1.0' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
CMakeLists.txt:8 (pkg_check_modules)

-- checking for module 'glib-2.0>=2.40'
-- package 'glib-2.0>=2.40' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
CMakeLists.txt:9 (pkg_check_modules)

-- checking for module 'gio-2.0'
-- package 'gio-2.0' not found
CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
CMakeLists.txt:10 (pkg_check_modules)

-- Configuring incomplete, errors occurred!

Устанавливал:
sudo apt-get install libusb-dev
sudo apt-get install libusb-1.0-0 libudev0 pm-utils

co2mond may get stuck and stop report values

Today I've noticed that co2mond failed to read data and got frozed. I had to restart it to get device readings again

янв 09 01:30:43 Valhalla co2mond[603]: Tamb        24.1625
янв 09 01:30:45 Valhalla co2mond[603]: CntR        653
янв 09 01:30:48 Valhalla co2mond[603]: Tamb        24.2875
янв 09 01:30:50 Valhalla co2mond[603]: CntR        653
янв 09 01:30:56 Valhalla co2mond[603]: hid_read_timeout: trasferred 0 bytes, expected 8 bytes
янв 09 01:30:56 Valhalla co2mond[603]: Error while reading data from device
янв 09 03:02:40 Valhalla systemd[1]: Stopping Polling daemon for masterkit co2monitor...
янв 09 03:02:40 Valhalla systemd[1]: Stopped Polling daemon for masterkit co2monitor.
янв 09 03:02:40 Valhalla systemd[1]: Started Polling daemon for masterkit co2monitor.
янв 09 03:02:40 Valhalla co2mond[24224]: Tamb        23.3500
янв 09 03:02:41 Valhalla co2mond[24224]: CntR        593
янв 09 03:02:43 Valhalla co2mond[24224]: Tamb        23.3500
янв 09 03:02:46 Valhalla co2mond[24224]: CntR        593

As I can see in sources co2mond should try to reconnect to device in case of reading failure but somehow it have not happened.

I've noticed this issue just once during 2 months of using binary compiled from df58994, so it might occur really seldom.

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.