Skip to content

Commit

Permalink
openmv: Prevent re-entrancy in drive serial number search.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwagyeman committed Nov 28, 2024
1 parent eb94a63 commit bd65546
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plugins/openmv/tools/driveserialnumber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ QString serialPortDriveSerialNumber(const QString &portName)
// QStringList()
// << QStringLiteral("-Command")
// << QString(QStringLiteral("(Get-PnpDeviceProperty -InstanceId (Get-WmiObject Win32_SerialPort | Where-Object { $_.DeviceID -eq '%1' }).PNPDeviceId | Where-Object { $_.KeyName -eq 'DEVPKEY_Device_Parent' }).Data")).arg(QString(portName))));
// process.runBlocking(timeout, Utils::EventLoopMode::On);
// process.runBlocking(timeout, Utils::EventLoopMode::Off);

// if(process.result() == Utils::ProcessResult::FinishedWithSuccess)
// {
Expand All @@ -78,7 +78,7 @@ QString driveSerialNumber(const QString &drivePath)
QStringList()
<< QStringLiteral("-Command")
<< QString(QStringLiteral("(Get-Disk -Number (Get-Partition -DriveLetter '%1').DiskNumber).SerialNumber")).arg(QString(drivePath).remove(QStringLiteral(":")).remove(QStringLiteral("/")))));
process.runBlocking(timeout, Utils::EventLoopMode::On);
process.runBlocking(timeout, Utils::EventLoopMode::Off);

if(process.result() == Utils::ProcessResult::FinishedWithSuccess)
{
Expand All @@ -97,7 +97,7 @@ QString driveSerialNumber(const QString &drivePath)
<< QStringLiteral("-J")
<< QStringLiteral("-o")
<< QStringLiteral("MOUNTPOINT,NAME,SERIAL")));
process.runBlocking(timeout, Utils::EventLoopMode::On);
process.runBlocking(timeout, Utils::EventLoopMode::Off);

if(process.result() == Utils::ProcessResult::FinishedWithSuccess)
{
Expand Down Expand Up @@ -144,7 +144,7 @@ QString driveSerialNumber(const QString &drivePath)
process.setCommand(Utils::CommandLine(Utils::FilePath::fromString(QStringLiteral("system_profiler")), QStringList()
<< QStringLiteral("SPUSBDataType")
<< QStringLiteral("-json")));
process.runBlocking(timeout, Utils::EventLoopMode::On);
process.runBlocking(timeout, Utils::EventLoopMode::Off);

if(process.result() == Utils::ProcessResult::FinishedWithSuccess)
{
Expand Down Expand Up @@ -172,7 +172,7 @@ QString driveSerialNumber(const QString &drivePath)
<< QStringLiteral("list")
<< QStringLiteral("-plist")
<< diskName));
process.runBlocking(timeout, Utils::EventLoopMode::On);
process.runBlocking(timeout, Utils::EventLoopMode::Off);

if (process.stdOut().contains(QString(QStringLiteral("<string>%1</string>")).arg(drivePath)))
{
Expand Down

0 comments on commit bd65546

Please sign in to comment.