Bookmark:
Configuração do Network Manager via DBus: como configurar o modo ad hoc
Se estiver usando iwconfig
para "ativar o Wi-Fi através da linha de comando", pode fazer o mode Ad-Hoc
.
Citações de man iwconfig
Example :
iwconfig eth0 mode Managed <-- often wlan0 not the0
iwconfig eth0 mode Ad-Hoc Freudian ... eth0
Geralmente quanto mais baixo e mais profundo se vai, mais trabalho manual intensivo o esforço se torna, derrotando todo o conceito e a lógica da automação e dos computadores.
No entanto, para usar o DBus, a maneira "mais fácil" pode estar na GUI de D-Feet
ou qdbus
, conforme descrito aqui e usado abaixo .. Observe que os tipos de argumento são limitados na entrada de linha de comando para métodos de qdbus
e, assim, o comando gdbus
ou D-Feet
talvez seja necessário.
Para obter os valores de argumentos corretos para os métodos exigidos, observe a influência de iwconfig
, como acima, ou de um Gerenciador de Rede da GUI em funcionamento com:
dbus-monitor --system "interface='org.freedesktop.NetworkManager'"
enquanto altera o paramemter de modo entre Ad Hoc e Infraestrutura. Isso fornecerá as pistas necessárias para a configuração diretamente no DBus.
Assim,
qdbus --system --literal org.freedesktop.NetworkManager
lista
/
/org
/org/freedesktop
/org/freedesktop/NetworkManager
/org/freedesktop/NetworkManager/AccessPoint
/org/freedesktop/NetworkManager/AccessPoint/1385
...
/org/freedesktop/NetworkManager/ActiveConnection
/org/freedesktop/NetworkManager/ActiveConnection/58
/org/freedesktop/NetworkManager/AgentManager
/org/freedesktop/NetworkManager/DHCP4Config
/org/freedesktop/NetworkManager/DHCP4Config/45
/org/freedesktop/NetworkManager/Devices
/org/freedesktop/NetworkManager/Devices/0
/org/freedesktop/NetworkManager/Devices/1 <- my wireless device
/org/freedesktop/NetworkManager/IP4Config
/org/freedesktop/NetworkManager/IP4Config/44
/org/freedesktop/NetworkManager/Settings
/org/freedesktop/NetworkManager/Settings/0
/org/freedesktop/NetworkManager/Settings/1
...
/org/freedesktop/NetworkManager/Settings/5
/org/freedesktop/NetworkManager/Settings/6
e
qdbus --system --literal org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager/Devices/1 \
org.freedesktop.DBus.Properties.GetAll \
org.freedesktop.NetworkManager.Device.Wireless \
| sed -e 's/, "/,\n"/g'
fornece as propriedades sem fio com o modo em negrito :
[Argument: a{sv} {"HwAddress" = [Variant(QString): "74:F0:6D:4B:8E:9B"], "PermHwAddress" = [Variant(QString): "74:F0:6D:4B:8E:9B"], "Mode" = [Variant(uint): 2], "Bitrate" = [Variant(uint): 28900], "ActiveAccessPoint" = [Variant: [ObjectPath: /org/freedesktop/NetworkManager/AccessPoint/1395]], "WirelessCapabilities" = [Variant(uint): 127]}]
Os métodos pertinentes em negrito de
qdbus --system --literal org.freedesktop.NetworkManager /org/freedesktop/NetworkManager
são
method QString org.freedesktop.DBus.Introspectable.Introspect() method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface) method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface, QString propname) method void org.freedesktop.DBus.Properties.Set(QString interface, QString propname, QDBusVariant value) method QDBusObjectPath org.freedesktop.NetworkManager.ActivateConnection(QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specific_object) method QDBusObjectPath org.freedesktop.NetworkManager.AddAndActivateConnection(QDBusRawType::a{sa{sv}} connection, QDBusObjectPath device, QDBusObjectPath specific_object, QDBusObjectPath& active_connection) method void org.freedesktop.NetworkManager.DeactivateConnection(QDBusObjectPath active_connection) method void org.freedesktop.NetworkManager.Enable(bool enable) method QDBusObjectPath org.freedesktop.NetworkManager.GetDeviceByIpIface(QString iface) method QList org.freedesktop.NetworkManager.GetDevices() method QDBusRawType::a{ss} org.freedesktop.NetworkManager.GetPermissions() method void org.freedesktop.NetworkManager.SetLogging(QString level, QString domains) method void org.freedesktop.NetworkManager.Sleep(bool sleep) method uint org.freedesktop.NetworkManager.state() property read bool org.freedesktop.NetworkManager.NetworkingEnabled property readwrite bool org.freedesktop.NetworkManager.WimaxEnabled property read bool org.freedesktop.NetworkManager.WimaxHardwareEnabled property readwrite bool org.freedesktop.NetworkManager.WirelessEnabled property read bool org.freedesktop.NetworkManager.WirelessHardwareEnabled property readwrite bool org.freedesktop.NetworkManager.WwanEnabled property read bool org.freedesktop.NetworkManager.WwanHardwareEnabled property read QList org.freedesktop.NetworkManager.ActiveConnections property read QString org.freedesktop.NetworkManager.Version property read uint org.freedesktop.NetworkManager.State signal void org.freedesktop.NetworkManager.CheckPermissions() signal void org.freedesktop.NetworkManager.DeviceAdded(QDBusObjectPath) signal void org.freedesktop.NetworkManager.DeviceRemoved(QDBusObjectPath) signal void org.freedesktop.NetworkManager.PropertiesChanged(QVariantMap) signal void org.freedesktop.NetworkManager.StateChanged(uint)
e de
qdbus --system --literal org.freedesktop.NetworkManager /org/freedesktop/NetworkManager/Devices/1
são
method QString org.freedesktop.DBus.Introspectable.Introspect() method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface) method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface, QString propname) method void org.freedesktop.DBus.Properties.Set(QString interface, QString propname, QDBusVariant value) method void org.freedesktop.NetworkManager.Device.Disconnect() method QList<QDBusObjectPath> org.freedesktop.NetworkManager.Device.Wireless.GetAccessPoints() property read bool org.freedesktop.NetworkManager.Device.FirmwareMissing property read bool org.freedesktop.NetworkManager.Device.Managed property read QDBusObjectPath org.freedesktop.NetworkManager.Device.ActiveConnection property read QDBusObjectPath org.freedesktop.NetworkManager.Device.Dhcp4Config property read QDBusObjectPath org.freedesktop.NetworkManager.Device.Dhcp6Config property read QDBusObjectPath org.freedesktop.NetworkManager.Device.Ip4Config property read QDBusObjectPath org.freedesktop.NetworkManager.Device.Ip6Config property read QDBusRawType::(uu) org.freedesktop.NetworkManager.Device.StateReason property read QString org.freedesktop.NetworkManager.Device.Driver property read QString org.freedesktop.NetworkManager.Device.Interface property read QString org.freedesktop.NetworkManager.Device.IpInterface property read QString org.freedesktop.NetworkManager.Device.Udi property read uint org.freedesktop.NetworkManager.Device.Capabilities property read uint org.freedesktop.NetworkManager.Device.DeviceType property read uint org.freedesktop.NetworkManager.Device.Ip4Address property read uint org.freedesktop.NetworkManager.Device.State property read QDBusObjectPath org.freedesktop.NetworkManager.Device.Wireless.ActiveAccessPoint property read QString org.freedesktop.NetworkManager.Device.Wireless.HwAddress property read QString org.freedesktop.NetworkManager.Device.Wireless.PermHwAddress property read uint org.freedesktop.NetworkManager.Device.Wireless.Bitrate property read uint org.freedesktop.NetworkManager.Device.Wireless.Mode property read uint org.freedesktop.NetworkManager.Device.Wireless.WirelessCapabilities signal void org.freedesktop.NetworkManager.Device.StateChanged(uint, uint, uint) signal void org.freedesktop.NetworkManager.Device.Wireless.AccessPointAdded(QDBusObjectPath) signal void org.freedesktop.NetworkManager.Device.Wireless.AccessPointRemoved(QDBusObjectPath) signal void org.freedesktop.NetworkManager.Device.Wireless.PropertiesChanged(QVariantMap)