[−][src]Crate co2mon
A driver for the Holtek (ZyAura ZG) CO₂ USB monitors.
The implementation was tested using a TFA-Dostmann AIRCO2TROL MINI sensor.
Example usage
let sensor = Sensor::open_default()?; let reading = sensor.read_one()?; println!("{:?}", reading);
Permissions
On Linux, you need to be able to access the USB HID device. For that, you
can save the following udev
rule to /etc/udev/rules.d/60-co2mon.rules
:
ACTION=="add|change", SUBSYSTEMS=="usb", ATTRS{idVendor}=="04d9", ATTRS{idProduct}=="a052", MODE:="0666"
Then reload the rules and trigger them:
# udevadm control --reload
# udevadm trigger
Note that the udev
rule above makes the device accessible to every local user.
Features
The serde
feature enables serialization and deserialization support for
the Reading
and SingleReading
structs.
References
The USB HID protocol is not documented, but was reverse-engineered before.
Structs
OpenOptions | Sensor open options. |
Reading | A reading consisting of temperature (in °C) and CO₂ concentration (in ppm) values. |
Sensor | Sensor driver struct. |
Enums
Error | A possible error value when opening the sensor or taking a reading. |
SingleReading | A single sensor reading. |
Type Definitions
Result | A specialized |