fix(hotspot):fix error when a wirless device do not support Adhoc(#190431)

This commit is contained in:
jzxc95 2023-09-04 14:06:56 +08:00
parent 45c1d17acb
commit 6d43fd00dd
2 changed files with 6 additions and 5 deletions

View File

@ -416,7 +416,7 @@ void MobileHotspotWidget::initInterfaceInfo()
QMap<QString, bool>::Iterator iter = devMap.begin();
while (iter != devMap.end()) {
QString interfaceName = iter.key();
if (devCapMap[interfaceName] & 0x01) {
if (!(devCapMap[interfaceName] & 0x01)) {
m_interfaceComboBox->addItem(interfaceName);
}
iter++;

View File

@ -452,11 +452,12 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam
NetworkManager::WirelessDevice *wirelessDevicePtr =
qobject_cast<NetworkManager::WirelessDevice *>(connectDevice.data());
int cap = 0x01;
if (!wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::AdhocCap) {
return cap;
int cap = 0x00;
if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::AdhocCap) {
cap = cap | 0x02;
} else {
return 0x01;
}
cap = cap | 0x02;
QDBusInterface dbusInterface("org.freedesktop.NetworkManager",
connectDevice->uni(),
"org.freedesktop.NetworkManager.Device.Wireless",