Fix for TEMPerHUM, TEMPer2

This commit is contained in:
shakemid 2017-09-28 23:05:09 +09:00
parent a6e0aeaf6a
commit afb701dfdd
7 changed files with 32 additions and 14 deletions

View file

@ -1,16 +1,29 @@
PCSensor / TEMPer2 driver for Linux/Solaris
PCSensor / TEMPer driver for Linux/Solaris
====
![TEMPer](images/New_TEMPer_6.jpg)
A CLI tool for PCsensor TEMPer USB thermometer. http://www.pcsensor.com/
This is based on PCSensor v. 1.0.1 by Juan Carlos Perez, introduced at https://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/
This is based on PCSensor v1.0.1 by Juan Carlos Perez, introduced at https://relavak.wordpress.com/2009/10/17/temper-temperature-sensor-linux-driver/
Support device 0c45:7401 known as Gold TEMPer. (image above)
Supported devices:
- 0c45:7401 with 1 temperature sensor (Gold TEMPer)
- Tested with TEMPerV1.4
![Gold TEMPer](images/goldtemper.jpg)
- 0c45:7401 with 2 temperature sensors (TEMPer2)
- Tested with TEMPer2_M12_V1.3
![TEMPer2](images/temper2.jpg)
- 0c45:7402 with temperature and humidity sensors (TEMPerHUM)
- Tested with TEMPer1F_H1_V1.4
![TEMPerHUM](images/temperhum.jpg)
I have worked on,
- Change libusb-0.1 -> libusb-1.0 (to be able to build on Solaris)
- Support TEMperHUM
- Support multiple devices
- Add Munin plugin http://munin-monitoring.org/
- Some code cleanups, fix indents, typos, ...
@ -35,16 +48,21 @@ $ make
# Usage
```
$ sudo ./pcsensor
2017-08-31T19:00:35 0 internal 27.38
2017-08-31T19:00:35 0 external 101.45
2017-08-31T19:00:35 1 internal 27.31
2017-08-31T19:00:35 1 external 101.45
2017-09-26T20:49:24 0 temperature 31.69 C
2017-09-26T20:49:24 1 temperature 32.12 C
2017-09-26T20:49:24 2 temperature 33.44 C
2017-09-26T20:49:24 2 humidity 62.63 %
...
```
libusb_detach_kernel_driver does not seem to work on Solaris. Thus, it looks necessary to unload hid driver manually.
Are there any better solutions? (See pcsensor.sh)
# Example
Munin graph sample
![Munin](images/munin-temper-day.png)
Original document below
====

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
images/goldtemper.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
images/munin-temper-day.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/temper2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
images/temperhum.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View file

@ -16,9 +16,9 @@
cp pcsensor /usr/local/bin/
Make symlink:
cp munin-plugin/temper /path/to/munin/lib/plugins/
cd /path/to/munin/etc/plugins/
ln -s /path/to/munin/lib/plugins/temper .
cp munin-plugin/temper /opt/munin/lib/plugins/
cd /opt/munin/etc/plugins/
ln -s /opt/munin/lib/plugins/temper .
=head1 ENVIRONMENT VARIABLES
@ -142,11 +142,11 @@ fetch() {
local i ret
i=0
while [ "$i" -le "$retry" ];
while [ "$i" -le "$retry" ]
do
"$pcsensor" | awk '$2 == '"$device"' { print $3".value", $4 }'
ret=$?
if [ "$ret" -eq 0 ];then
if [ "$ret" -eq 0 ]; then
break
fi