Switch for Windows to use Win32::Serialport instead of Device::Serialport
git-svn-id: https://svn.fhem.de/fhem/trunk@181 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -4,7 +4,7 @@ package main;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Time::HiRes qw(gettimeofday);
|
use Time::HiRes qw(gettimeofday);
|
||||||
use Device::SerialPort;
|
|
||||||
|
|
||||||
sub FHZ_Write($$$);
|
sub FHZ_Write($$$);
|
||||||
sub FHZ_Read($);
|
sub FHZ_Read($);
|
||||||
@@ -224,7 +224,13 @@ FHZ_Define($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log 3, "FHZ opening FHZ device $dev";
|
Log 3, "FHZ opening FHZ device $dev";
|
||||||
|
if ($^O=~/Win/) {
|
||||||
|
eval ("use Win32::SerialPort;");
|
||||||
|
my $po = new Win32::SerialPort ($dev);
|
||||||
|
}else{
|
||||||
|
eval ("use Device::SerialPort;");
|
||||||
my $po = new Device::SerialPort ($dev);
|
my $po = new Device::SerialPort ($dev);
|
||||||
|
}
|
||||||
return "Can't open $dev: $!\n" if(!$po);
|
return "Can't open $dev: $!\n" if(!$po);
|
||||||
Log 3, "FHZ opened FHZ device $dev";
|
Log 3, "FHZ opened FHZ device $dev";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user