Skip to content

Commit 8816ff2

Browse files
authored
Merge pull request #639 from deXol/develop
Fix device disconnecting issue, when other HID device removed
2 parents 814a6b8 + fbeae7e commit 8816ff2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/MPManager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,26 @@ void MPManager::usbDeviceAdded(QString path, bool isBLE, bool isBT)
164164

165165
void MPManager::usbDeviceRemoved(QString path)
166166
{
167+
bool isMpDisconnected = false;
167168
auto it = devices.find(path);
168169
if (it != devices.end())
169170
{
170171
qDebug() << "Disconnecting: " << path;
171172
emit mpDisconnected(it.value());
172173
delete it.value();
173174
devices.remove(path);
175+
isMpDisconnected = true;
174176
}
175177
else
176178
{
177179
qDebug() << path << " is not connected.";
178180
}
179-
checkUsbDevices();
181+
182+
if (isMpDisconnected && devices.isEmpty())
183+
{
184+
qDebug() << "Check if other MP device is connected ";
185+
checkUsbDevices();
186+
}
180187
}
181188

182189
MPDevice* MPManager::getDevice(int at)

0 commit comments

Comments
 (0)