Skip to content

Commit de102c9

Browse files
committed
Apply emergency force-closing to both sudden disconnects and configs without complete mamestop for all ports
1 parent dc536fd commit de102c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

qhookermain.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ void qhookerMain::run()
9292
serialPort[portNum].write("E");
9393
serialPort[portNum].waitForBytesWritten(500);
9494
serialPort[portNum].close();
95+
printf("Force-closed port no. %d (%04X:%04X @ %s) - was opened incidentally without a corresponding close command.\n",
96+
portNum+1, validDevices.at(portNum).vendorIdentifier(), validDevices.at(portNum).productIdentifier(), serialPort[portNum].portName().toLocal8Bit().constData());
9597
}
9698

9799
delete settings;
@@ -345,8 +347,13 @@ bool qhookerMain::GameStarted(const QString &input)
345347
}
346348

347349
for(int portNum = 0; portNum < validDevices.count(); ++portNum)
348-
if(serialPort[portNum].isOpen())
350+
if(serialPort[portNum].isOpen()) {
351+
serialPort[portNum].write("E");
352+
serialPort[portNum].waitForBytesWritten(500);
349353
serialPort[portNum].close();
354+
printf("Force-closed port no. %d (%04X:%04X @ %s) - was opened incidentally without a corresponding close command.\n",
355+
portNum+1, validDevices.at(portNum).vendorIdentifier(), validDevices.at(portNum).productIdentifier(), serialPort[portNum].portName().toLocal8Bit().constData());
356+
}
350357

351358
delete settings;
352359
settingsMap.clear();

0 commit comments

Comments
 (0)