Skip to content

Commit

Permalink
Fixed restarting detector from TrikStudio
Browse files Browse the repository at this point in the history
  • Loading branch information
yurii-litvinov committed Mar 24, 2014
1 parent d5486f2 commit c3a8a1d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions trikControl/src/cameraLineDetectorSensorWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ void CameraLineDetectorSensorWorker::openFifos()
{
qDebug() << "opening" << mOutputFile.fileName();

if (mOutputFileDescriptor == -1) {
mOutputFileDescriptor = open(mOutputFile.fileName().toStdString().c_str(), O_SYNC | O_NONBLOCK, O_RDONLY);
if (mInputFile.isOpen()) {
mInputFile.close();
}

mOutputFileDescriptor = open(mOutputFile.fileName().toStdString().c_str(), O_SYNC | O_NONBLOCK, O_RDONLY);

if (mOutputFileDescriptor == -1) {
qDebug() << "Cannot open sensor output file " << mOutputFile.fileName();
return;
Expand Down Expand Up @@ -264,4 +266,7 @@ void CameraLineDetectorSensorWorker::deinitialize()
if (::close(mOutputFileDescriptor) != 0) {
qDebug() << mOutputFile.fileName() << ": fifo close failed: " << errno;
}

mOutputFileDescriptor = -1;
mInputFile.close();
}

0 comments on commit c3a8a1d

Please sign in to comment.