commit ed1467af7d077592c807918a63209e8fc548d648
parent b7e7219cba00a2bf3639e3af0c7d2c3ccfc7f517
Author: amin <dev@aminmesbah.com>
Date: Sat, 15 Jan 2022 07:36:58 +0000
Update readme and add license
FossilOrigin-Name: f5dbcd886c7d1387f0415ded1a5bc048520e46cc899fdac4e0516901f66f0f76
Diffstat:
A | LICENSE | | | 24 | ++++++++++++++++++++++++ |
M | README.md | | | 109 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- |
2 files changed, 132 insertions(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/README.md b/README.md
@@ -1,5 +1,112 @@
-Put the udev rules in /etc/udev/rules.d/, then reload the rules with:
+# CO2MiniMon
+
+This Linux program reads temperature and relative CO2 concentration data from a
+[CO2Mini][1] sensor and writes the values to temporary files. I use it to
+display the data in [i3status][2].
+
+
+### Setup
+
+Put the udev rules file in `/etc/udev/rules.d/`, then reload the rules with:
```
# udevadm control --reload-rules && udevadm trigger
```
+
+Then, when you plug in the device, `/dev/co2minix` will be created as a symlink
+to the appropriate `/dev/hidrawx`.
+
+Build and run:
+
+```
+$ ./build.sh
+$ ./out/release/co2minimon
+```
+
+The 2 output files specified in the source code should be created and
+continually updated with the latest values.
+
+
+### Device Support
+
+There are different versions of this device, frequently called the CO2Mini or
+the RAD-0301.
+
+Some versions use a crappy encryption scheme as a detterent to getting the data
+out. For some wonderful and informative reading on this subject, see
+[Reverse-Engineering a low-cost USB CO₂ monitor][3].
+
+For whatever reason, my device doesn't seem to engage in these encryption
+shenanigans, so I can just get the data by decoding the very simple
+[protocol][4].
+
+My device has model number `ZGm053UKA`, and Linux reports the following data
+for it:
+
+```
+# lsusb --verbose -d 04d9:a052
+
+Bus 001 Device 020: ID 04d9:a052 Holtek Semiconductor, Inc. USB-zyTemp
+Device Descriptor:
+ bLength 18
+ bDescriptorType 1
+ bcdUSB 1.10
+ bDeviceClass 0
+ bDeviceSubClass 0
+ bDeviceProtocol 0
+ bMaxPacketSize0 8
+ idVendor 0x04d9 Holtek Semiconductor, Inc.
+ idProduct 0xa052 USB-zyTemp
+ bcdDevice 2.00
+ iManufacturer 1 Holtek
+ iProduct 2 USB-zyTemp
+ iSerial 3 2.00
+ bNumConfigurations 1
+ Configuration Descriptor:
+ bLength 9
+ bDescriptorType 2
+ wTotalLength 0x0022
+ bNumInterfaces 1
+ bConfigurationValue 1
+ iConfiguration 0
+ bmAttributes 0x80
+ (Bus Powered)
+ MaxPower 100mA
+ Interface Descriptor:
+ bLength 9
+ bDescriptorType 4
+ bInterfaceNumber 0
+ bAlternateSetting 0
+ bNumEndpoints 1
+ bInterfaceClass 3 Human Interface Device
+ bInterfaceSubClass 0
+ bInterfaceProtocol 0
+ iInterface 0
+ HID Device Descriptor:
+ bLength 9
+ bDescriptorType 33
+ bcdHID 1.10
+ bCountryCode 0 Not supported
+ bNumDescriptors 1
+ bDescriptorType 34 Report
+ wDescriptorLength 53
+ Report Descriptors:
+ ** UNAVAILABLE **
+ Endpoint Descriptor:
+ bLength 7
+ bDescriptorType 5
+ bEndpointAddress 0x81 EP 1 IN
+ bmAttributes 3
+ Transfer Type Interrupt
+ Synch Type None
+ Usage Type Data
+ wMaxPacketSize 0x0008 1x 8 bytes
+ bInterval 10
+Device Status: 0x0000
+ (Bus Powered)
+```
+
+[1]: https://www.co2meter.com/products/co2mini-co2-indoor-air-quality-monitor
+[2]: https://i3wm.org/i3status/
+[3]: https://hackaday.io/project/5301/logs?sort=oldest
+[4]: http://co2meters.com/Documentation/Other/AN_RAD_0301_USB_Communications_Revised8.pdf