diff --git a/ChangeLog b/ChangeLog index 99e7826a..febb71aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19290,3 +19290,7 @@ 2019-12-03 Fred Gleason * Fixed a bug in rdgpimon(1) that caused GPIO cart displays to fail to accurately reflect current state. +2019-12-04 Fred Gleason + * Fixed a bug in ripcd(8) that caused input and output counts to + be calculated incorrectly for Software Authority protocol devices + containing holes in the input and/or output lists. diff --git a/ripcd/swauthority.cpp b/ripcd/swauthority.cpp index a8de5163..28692ac8 100644 --- a/ripcd/swauthority.cpp +++ b/ripcd/swauthority.cpp @@ -255,7 +255,7 @@ void SoftwareAuthority::DispatchCommand() QString section=line_in.lower().replace(">>",""); // - // Startup Sequence. Get the input and output lists. + // Startup Sequence. Get initial GPIO states and the input and output lists. // if(section=="login successful") { sprintf(buffer,"gpistat %d\x0D\x0A",swa_card); // Request GPI States @@ -305,7 +305,6 @@ void SoftwareAuthority::DispatchCommand() delete q; return; } - swa_inputs++; f0=line_in.split("\t",QString::KeepEmptyParts); name=f0[1]; if(f0.size()>=7) { @@ -330,6 +329,9 @@ void SoftwareAuthority::DispatchCommand() QString().sprintf("MATRIX=%d,",swa_matrix)+ QString().sprintf("NUMBER=%d",f0[0].toInt()); } + if(f0[0].toInt()>swa_inputs) { + swa_inputs=f0[0].toInt(); + } delete q; q=new RDSqlQuery(sql); delete q; @@ -357,7 +359,6 @@ void SoftwareAuthority::DispatchCommand() } return; } - swa_outputs++; f0=line_in.split("\t",QString::KeepEmptyParts); name=f0[1]; if(f0.size()>=6) { @@ -382,6 +383,9 @@ void SoftwareAuthority::DispatchCommand() QString().sprintf("MATRIX=%d,",swa_matrix)+ QString().sprintf("NUMBER=%d",f0[0].toInt()); } + if(f0[0].toInt()>swa_outputs) { + swa_outputs=f0[0].toInt(); + } delete q; q=new RDSqlQuery(sql); delete q;