Subject: | Add parameter to choose device |
Date: | Mon, 21 Jan 2013 22:58:36 +0100 |
To: | bug-Device-USB-PCSensor-HidTEMPer [...] rt.cpan.org |
From: | Paul Muster <paul [...] muster.dyndns.info> |
Hello, Magnus,
I have two TEMPer sensors connected to one system. With udev there are
great options to assign symlinks to the devices so I can differentiate
between them:
KERNEL=="hidraw[1,3]", KERNELS=="1-2.1.1", SYMLINK+="thermUSB0"
KERNEL=="hidraw[1,3]", KERNELS=="1-2.1.4", SYMLINK+="thermUSB1"
Now I'd like to get the temperature from exactly /dev/thermUSB1.
I'd like to call e.g. temp.pl with e.g. "-d /dev/thermUSB1" to get the
value from only(!) this sensor.
Can this be implemented? Please tell me how I can support you on this
(e.b. beta-testing).
Thanks & kind regards
Paul
temp.pl
#! /usr/bin/perl
use 5.010;
use strict;
use warnings;
use Carp;
use Device::USB;
use Device::USB::PCSensor::HidTEMPer::Device;
use Device::USB::PCSensor::HidTEMPer::NTC;
use Device::USB::PCSensor::HidTEMPer::TEMPer;
use Device::USB::PCSensor::HidTEMPer::TEMPer2;
use lib;
use Device::USB::PCSensor::HidTEMPer;
my $pcsensor = Device::USB::PCSensor::HidTEMPer->new();
my @devices = $pcsensor->list_devices();
foreach my $device ( @devices )
{
say $device->internal()->celsius();
}