forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user