2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

OWX_SER: fix pt_execute correctly handling undefined $writedata and $numread

git-svn-id: https://svn.fhem.de/fhem/trunk@5854 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-05-13 22:15:47 +00:00
parent 21aae23fb5
commit a05199420b

View File

@ -148,7 +148,7 @@ sub pt_alarms () {
########################################################################################
sub pt_execute($$$$$$$) {
my ($thread, $self, $hash, $context, $reset, $address, $writedata, $numread) = @_;
my ($thread, $self, $hash, $context, $reset, $dev, $writedata, $numread) = @_;
PT_BEGIN($thread);
@ -160,13 +160,10 @@ sub pt_execute($$$$$$$) {
$self->reset() if ($reset);
my $dev = $address;
my $data = $writedata;
$writedata = "" unless defined $writedata;
my $select;
my $res2 = "";
my ($i,$j,$k);
#-- has match ROM part
if( $dev ){# command => EXECUTE,
# context => $context,
@ -188,13 +185,13 @@ sub pt_execute($$$$$$$) {
for(my $i=0;$i<8;$i++){
$rom_id[$i]=hex(substr($dev,2*$i,2));
}
$select=sprintf("\x55%c%c%c%c%c%c%c%c",@rom_id).$data;
$select=sprintf("\x55%c%c%c%c%c%c%c%c",@rom_id).$writedata;
#-- has no match ROM part, issue skip ROM command (0xCC:)
} else {
$select="\xCC".$data;
$select="\xCC".$writedata;
}
#-- has receive data part
if( $numread >0 ){
if( $numread ){
#$numread += length($data);
for( my $i=0;$i<$numread;$i++){
$select .= "\xFF";