aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-10-22 11:28:36 +0200
committerEike Ziller <eike.ziller@qt.io>2018-10-23 09:17:35 +0000
commitb605ad61bc17f1d7f3daf900e477ffb7bbaa1417 (patch)
tree11ed43236bbc771d40f83b715deb8fa11fcee23c
parente3021b7178fd557de5e10c55db5875e0eff73b2e (diff)
iOS: Work around mismatch of USB serial and iOS device id
Currently we track connection of devices in the iOS plugin via USB, using the USB serial number as a device identifier (iosdevice.h/cpp). On the other side, iostool uses the MobileDevice framework to identify iOS devices (iosdevicemanager.h/cpp). The assumption that the two identifiers are the same seems to be no longer true with the iPhone XS devices. These have a device identifier that contains a dash that is not present in the USB serial number. As a hotfix, just remove any dashes from the identifier on the iostool side because we only use it for the lookup deviceId -> AMDeviceRef anyhow. The longer term fix should be to use MobileDevice framework for the connection tracking of devices on the iOS plugin side as well, instead on relying on questionable assumptions. Change-Id: Iac3115a1c3f43a4f9e159aaa4ded1c671c55d888 Fixes: QTCREATORBUG-21291 Reviewed-by: Jason Hihn <jhihn@gmx.com> Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
-rw-r--r--src/tools/iostool/iosdevicemanager.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp
index bfc493ad5a..53a9fd1625 100644
--- a/src/tools/iostool/iosdevicemanager.cpp
+++ b/src/tools/iostool/iosdevicemanager.cpp
@@ -423,6 +423,7 @@ public:
void requestDeviceInfo(const QString &deviceId, int timeout);
QStringList errors();
void addError(QString errorMsg);
+ QString deviceId(AMDeviceRef device);
void addDevice(AMDeviceRef device);
void removeDevice(AMDeviceRef device);
void checkPendingLookups();
@@ -654,11 +655,18 @@ void IosDeviceManagerPrivate::addError(QString errorMsg)
emit q->errorMsg(errorMsg);
}
-void IosDeviceManagerPrivate::addDevice(AMDeviceRef device)
+QString IosDeviceManagerPrivate::deviceId(AMDeviceRef device)
{
CFStringRef s = m_lib.deviceCopyDeviceIdentifier(device);
- QString devId = QString::fromCFString(s);
+ // remove dashes as a hotfix for QTCREATORBUG-21291
+ const auto id = QString::fromCFString(s).remove('-');
if (s) CFRelease(s);
+ return id;
+}
+
+void IosDeviceManagerPrivate::addDevice(AMDeviceRef device)
+{
+ const QString devId = deviceId(device);
CFRetain(device);
DeviceInterfaceType interfaceType = static_cast<DeviceInterfaceType>(lib()->deviceGetInterfaceType(device));
@@ -703,10 +711,7 @@ void IosDeviceManagerPrivate::addDevice(AMDeviceRef device)
void IosDeviceManagerPrivate::removeDevice(AMDeviceRef device)
{
- CFStringRef s = m_lib.deviceCopyDeviceIdentifier(device);
- QString devId = QString::fromCFString(s);
- if (s)
- CFRelease(s);
+ const QString devId = deviceId(device);
if (debugAll)
qDebug() << "removeDevice " << devId;
if (m_devices.contains(devId)) {