diff options
| author | Michael Biebl <biebl@debian.org> | 2016-01-20 16:26:51 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-01-20 16:26:51 +0100 |
| commit | 494f296a3baab08522617b24b1f126d8f9a17502 (patch) | |
| tree | c8ef32fb0dd1c4ff35a0b38e787abb58692de0cd /examples/python/dbus | |
| parent | 54f6333410ffd570e62717d9e77c5c987175e397 (diff) | |
Imported Upstream version 1.1.90 upstream/1.1.90
Diffstat (limited to 'examples/python/dbus')
| -rw-r--r-- | examples/python/dbus/Makefile.am | 8 | ||||
| -rw-r--r-- | examples/python/dbus/Makefile.in | 26 | ||||
| -rwxr-xr-x | examples/python/dbus/add-wifi-eap-connection.py (renamed from examples/python/dbus/add-system-wifi-connection.py) | 4 | ||||
| -rwxr-xr-x | examples/python/dbus/add-wifi-psk-connection.py | 56 | ||||
| -rwxr-xr-x | examples/python/dbus/create-bond.py | 114 | ||||
| -rwxr-xr-x | examples/python/dbus/nm-state.py | 25 | ||||
| -rwxr-xr-x | examples/python/dbus/vpn.py | 4 | ||||
| -rwxr-xr-x | examples/python/dbus/wifi-active-ap.py | 66 | ||||
| -rwxr-xr-x | examples/python/dbus/wifi-hotspot.py | 112 |
9 files changed, 392 insertions, 23 deletions
diff --git a/examples/python/dbus/Makefile.am b/examples/python/dbus/Makefile.am index dd77f1e9..0a89dc56 100644 --- a/examples/python/dbus/Makefile.am +++ b/examples/python/dbus/Makefile.am @@ -2,7 +2,8 @@ EXTRA_DIST = \ nm-state.py \ add-connection.py \ add-connection-compat.py \ - add-system-wifi-connection.py \ + add-wifi-eap-connection.py \ + add-wifi-psk-connection.py \ vpn.py \ update-secrets.py \ list-connections.py \ @@ -11,4 +12,7 @@ EXTRA_DIST = \ get-active-connection-uuids.py \ list-devices.py \ update-ip4-method.py \ - is-wwan-default.py + is-wwan-default.py \ + wifi-hotspot.py \ + create-bond.py \ + wifi-active-ap.py diff --git a/examples/python/dbus/Makefile.in b/examples/python/dbus/Makefile.in index 023e52d8..1fcfd9cd 100644 --- a/examples/python/dbus/Makefile.in +++ b/examples/python/dbus/Makefile.in @@ -146,7 +146,6 @@ BLUEZ5_LIBS = @BLUEZ5_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CKDB_PATH = @CKDB_PATH@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ @@ -158,8 +157,6 @@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@ -DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@ DBUS_LIBS = @DBUS_LIBS@ DBUS_SYS_DIR = @DBUS_SYS_DIR@ DEFS = @DEFS@ @@ -169,6 +166,7 @@ DHCPCD_PATH = @DHCPCD_PATH@ DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ DLLTOOL = @DLLTOOL@ DNSMASQ_PATH = @DNSMASQ_PATH@ +DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -223,16 +221,13 @@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ IPTABLES_PATH = @IPTABLES_PATH@ -IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@ -IWMX_SDK_LIBS = @IWMX_SDK_LIBS@ KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ LCOV = @LCOV@ LD = @LD@ LDFLAGS = @LDFLAGS@ +LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ +LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ LIBDL = @LIBDL@ -LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ -LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ -LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBM = @LIBM@ @@ -269,6 +264,8 @@ NEWT_LIBS = @NEWT_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ +NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ +NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ NM_MICRO_VERSION = @NM_MICRO_VERSION@ NM_MINOR_VERSION = @NM_MINOR_VERSION@ @@ -297,7 +294,6 @@ POLKIT_LIBS = @POLKIT_LIBS@ POSUB = @POSUB@ PPPD_PATH = @PPPD_PATH@ PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -PPPOE_PATH = @PPPOE_PATH@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ RANLIB = @RANLIB@ @@ -312,6 +308,8 @@ SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ +SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ +SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ @@ -372,6 +370,7 @@ mkdir_p = @mkdir_p@ nmbinary = @nmbinary@ nmconfdir = @nmconfdir@ nmdatadir = @nmdatadir@ +nmlibdir = @nmlibdir@ nmrundir = @nmrundir@ nmstatedir = @nmstatedir@ oldincludedir = @oldincludedir@ @@ -379,6 +378,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -398,7 +398,8 @@ EXTRA_DIST = \ nm-state.py \ add-connection.py \ add-connection-compat.py \ - add-system-wifi-connection.py \ + add-wifi-eap-connection.py \ + add-wifi-psk-connection.py \ vpn.py \ update-secrets.py \ list-connections.py \ @@ -407,7 +408,10 @@ EXTRA_DIST = \ get-active-connection-uuids.py \ list-devices.py \ update-ip4-method.py \ - is-wwan-default.py + is-wwan-default.py \ + wifi-hotspot.py \ + create-bond.py \ + wifi-active-ap.py all: all-am diff --git a/examples/python/dbus/add-system-wifi-connection.py b/examples/python/dbus/add-wifi-eap-connection.py index ff390821..4085ac31 100755 --- a/examples/python/dbus/add-system-wifi-connection.py +++ b/examples/python/dbus/add-wifi-eap-connection.py @@ -17,14 +17,14 @@ # Copyright (C) 2011 Red Hat, Inc. # -import dbus +import dbus, uuid def path_to_value(path): return dbus.ByteArray("file://" + path + "\0") s_con = dbus.Dictionary({ 'type': '802-11-wireless', - 'uuid': '7371bb78-c1f7-42a3-a9db-5b9566e8ca07', + 'uuid': str(uuid.uuid4()), 'id': 'My Wifi'}) s_wifi = dbus.Dictionary({ diff --git a/examples/python/dbus/add-wifi-psk-connection.py b/examples/python/dbus/add-wifi-psk-connection.py new file mode 100755 index 00000000..60cb2af9 --- /dev/null +++ b/examples/python/dbus/add-wifi-psk-connection.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2015 Red Hat, Inc. +# + +import dbus, uuid + +s_con = dbus.Dictionary({ + 'type': '802-11-wireless', + 'uuid': str(uuid.uuid4()), + 'id': 'My-WPA-PSK'}) + +s_wifi = dbus.Dictionary({ + 'ssid': dbus.ByteArray("best-wifi"), + 'mode': 'infrastructure', +}) + +s_wsec = dbus.Dictionary({ + 'key-mgmt': 'wpa-psk', + 'auth-alg': 'open', + 'psk': 'super-secret-password', +}) + +s_ip4 = dbus.Dictionary({'method': 'auto'}) +s_ip6 = dbus.Dictionary({'method': 'ignore'}) + +con = dbus.Dictionary({ + 'connection': s_con, + '802-11-wireless': s_wifi, + '802-11-wireless-security': s_wsec, + 'ipv4': s_ip4, + 'ipv6': s_ip6 + }) + + +bus = dbus.SystemBus() + +proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings") +settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings") + +settings.AddConnection(con) + diff --git a/examples/python/dbus/create-bond.py b/examples/python/dbus/create-bond.py new file mode 100755 index 00000000..41ffabe8 --- /dev/null +++ b/examples/python/dbus/create-bond.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2015 Red Hat, Inc. +# + +# +# This example configures a Bond from ethernet devices and activates it +# +# NetworkManager D-Bus API: +# https://developer.gnome.org/NetworkManager/1.0/spec.html +# + +import dbus, sys, uuid +from dbus.mainloop.glib import DBusGMainLoop +import gobject + +DBusGMainLoop(set_as_default=True) + +def add_connection(con): + bus = dbus.SystemBus() + proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings") + settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings") + return settings.AddConnection(con) + +def create_bond(bond_name): + bond_opts = dbus.Dictionary({'mode': '4'}) + s_bond = dbus.Dictionary({'options': bond_opts}) + s_con = dbus.Dictionary({ + 'type': 'bond', + 'uuid': str(uuid.uuid4()), + 'id': bond_name, + 'interface-name': bond_name, + 'autoconnect': False, + 'autoconnect-slaves': 1}) + s_ip4 = dbus.Dictionary({'method': 'auto'}) + s_ip6 = dbus.Dictionary({'method': 'ignore'}) + + con = dbus.Dictionary({ + 'bond': s_bond, + 'connection': s_con, + 'ipv4': s_ip4, + 'ipv6': s_ip6}) + print "Creating bond connection: %s" % bond_name + return add_connection(con) + +def create_slave(device, master): + slave_name = 'bond-' + master + '-slave-' + device + s_wired = dbus.Dictionary({'duplex': 'full'}) + s_con = dbus.Dictionary({ + 'type': '802-3-ethernet', + 'uuid': str(uuid.uuid4()), + 'id': slave_name, + 'interface-name': device, + 'autoconnect': False, + 'master': master, + 'slave-type': 'bond'}) + + con = dbus.Dictionary({ + '802-3-ethernet': s_wired, + 'connection': s_con}) + print "Creating slave connection: %s" % slave_name + add_connection(con) + +def usage(): + print "Usage: %s <bond_name> <ifname1> ..." % sys.argv[0] + sys.exit(0) + + +if len(sys.argv) < 3: + usage() + +# Create bond master and slave connections +bond_name = sys.argv[1] +bond_path = create_bond(bond_name) +for ifname in sys.argv[2:]: + create_slave(ifname, bond_name) + +# Activate the bond +bus = dbus.SystemBus() +proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager") +manager = dbus.Interface(proxy, "org.freedesktop.NetworkManager") +ac = manager.ActivateConnection(bond_path, "/", "/") +print "Activating bond: %s (%s)" % (bond_name, ac) + +# Monitor the active bond connection +loop = gobject.MainLoop() +def properties_changed(props): + if 'State' in props: + if props['State'] == 2: + print "Succesfully connected" + loop.quit() + if props['State'] == 3 or props['State'] == 4: + print "Bond activation failed" + loop.quit() + +obj = bus.get_object("org.freedesktop.NetworkManager", ac) +iface = dbus.Interface(obj, "org.freedesktop.NetworkManager.Connection.Active") +iface.connect_to_signal("PropertiesChanged", properties_changed) + +loop.run() diff --git a/examples/python/dbus/nm-state.py b/examples/python/dbus/nm-state.py index 94fa6309..176090f7 100755 --- a/examples/python/dbus/nm-state.py +++ b/examples/python/dbus/nm-state.py @@ -34,11 +34,29 @@ device_states = { 0: "Unknown", 110: "Deactivating", 120: "Failed" } +connectivity_states = { 0: "Unknown", + 1: "Activating", + 2: "Activated", + 3: "Deactivating", + 4: "Deactivated" } + +nm_state = { 0: "Unknown", + 10: "Asleep", + 20: "Disconnected", + 30: "Disconnecting", + 40: "Connecting", + 50: "Connected-Local", + 60: "Connected-Site", + 70: "Connected-Global" } + bus = dbus.SystemBus() proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager") manager = dbus.Interface(proxy, "org.freedesktop.NetworkManager") +# Get overall NM connection state +print("NetworkManager state is: '%s'" % nm_state[manager.state()]) + # Get device-specific state devices = manager.GetDevices() for d in devices: @@ -73,9 +91,4 @@ for a in active: con_details = con_iface.GetSettings() con_name = con_details['connection']['id'] - if state == 2: # activated - print "Connection '%s' is activated" % con_name - else: - print "Connection '%s' is activating" % con_name - - + print "Connection '%s' is %s" % (con_name, connectivity_states[state].lower()) diff --git a/examples/python/dbus/vpn.py b/examples/python/dbus/vpn.py index 59773a61..d60e470e 100755 --- a/examples/python/dbus/vpn.py +++ b/examples/python/dbus/vpn.py @@ -102,11 +102,11 @@ def get_wifi_device_path(): def activate_connection(connection_path, device_path): def reply_handler(opath): - print "Success: device activating" + print "Success: device activating" sys.exit(0) def error_handler(*args): - print "Error activating device: %s" % args + sys.stderr.write("Error activating device: %s\n" % args) sys.exit(1) bus = dbus.SystemBus() diff --git a/examples/python/dbus/wifi-active-ap.py b/examples/python/dbus/wifi-active-ap.py new file mode 100755 index 00000000..3b17c6f1 --- /dev/null +++ b/examples/python/dbus/wifi-active-ap.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2015 Red Hat, Inc. +# + +# +# This example starts or stops a wifi hotspot +# +# Configuration settings are described at +# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# + +import dbus, sys, time + +bus = dbus.SystemBus() +service_name = "org.freedesktop.NetworkManager" +proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager/Settings") +settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings") + +if len(sys.argv) != 2: + print "Usage: %s <ifname>" % sys.argv[0] + sys.exit(0) + +# Get the device object path based on interface name +iface = sys.argv[1] +proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager") +nm = dbus.Interface(proxy, "org.freedesktop.NetworkManager") +devpath = nm.GetDeviceByIpIface(iface) + +# Get a proxy to the wifi device and get the active access point's object path +proxy = bus.get_object(service_name, devpath) +props = dbus.Interface(proxy, "org.freedesktop.DBus.Properties") +active_ap_path = props.Get("org.freedesktop.NetworkManager.Device.Wireless", "ActiveAccessPoint") +if active_ap_path == "/": + print "%s is not currently associated" % sys.argv[1] + sys.exit(0) + +# Get the active access point's SSID and BSSID +ap_proxy = bus.get_object(service_name, active_ap_path) +ap_props = dbus.Interface(ap_proxy, "org.freedesktop.DBus.Properties") +raw_ssid = ap_props.Get("org.freedesktop.NetworkManager.AccessPoint", "Ssid") +bssid = ap_props.Get("org.freedesktop.NetworkManager.AccessPoint", "HwAddress") + +# Convert the SSID from a byte array to a string, assuming ASCII encoding +ssid = "" +for c in raw_ssid: + ssid = ssid + chr(c) + +print "%s is associated to '%s' (%s)" % (sys.argv[1], ssid, bssid) + +sys.exit(0) + diff --git a/examples/python/dbus/wifi-hotspot.py b/examples/python/dbus/wifi-hotspot.py new file mode 100755 index 00000000..10958af8 --- /dev/null +++ b/examples/python/dbus/wifi-hotspot.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2010 - 2012 Red Hat, Inc. +# + +# +# This example starts or stops a wifi hotspot +# +# Configuration settings are described at +# https://developer.gnome.org/NetworkManager/1.0/ref-settings.html +# + +import dbus, sys, time + +our_uuid = '2b0d0f1d-b79d-43af-bde1-71744625642e' + +s_con = dbus.Dictionary({ + 'type': '802-11-wireless', + 'uuid': our_uuid, + 'id': 'Test Hotspot'}) + +s_wifi = dbus.Dictionary({ + 'ssid': dbus.ByteArray("My Hotspot"), + 'mode': "ap", + 'band': "bg", + 'channel': dbus.UInt32(1)}) + +s_wsec = dbus.Dictionary({ + 'key-mgmt': 'wpa-psk', + 'psk': 'great password'}) + +s_ip4 = dbus.Dictionary({'method': 'shared'}) +s_ip6 = dbus.Dictionary({'method': 'ignore'}) + +con = dbus.Dictionary({ + 'connection': s_con, + '802-11-wireless': s_wifi, + '802-11-wireless-security': s_wsec, + 'ipv4': s_ip4, + 'ipv6': s_ip6 + }) + +def usage(): + print "Usage: %s <ifname> [up|down]" % sys.argv[0] + sys.exit(0) + +bus = dbus.SystemBus() +service_name = "org.freedesktop.NetworkManager" +proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager/Settings") +settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings") + +if len(sys.argv) != 3: + usage() + +iface = sys.argv[1] +proxy = bus.get_object(service_name, "/org/freedesktop/NetworkManager") +nm = dbus.Interface(proxy, "org.freedesktop.NetworkManager") +devpath = nm.GetDeviceByIpIface(iface) + +# Find our existing hotspot connection +connection_path = None +for path in settings.ListConnections(): + proxy = bus.get_object(service_name, path) + settings_connection = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings.Connection") + config = settings_connection.GetSettings() + if config['connection']['uuid'] == our_uuid: + connection_path = path + break + +# If the hotspot connection didn't already exist, add it +if not connection_path: + connection_path = settings.AddConnection(con) + +# Now start or stop the hotspot on the requested device +proxy = bus.get_object(service_name, devpath) +device = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Device") +operation = sys.argv[2] +if operation == "up": + acpath = nm.ActivateConnection(connection_path, devpath, "/") + proxy = bus.get_object(service_name, acpath) + active_props = dbus.Interface(proxy, "org.freedesktop.DBus.Properties") + + # Wait for the hotspot to start up + start = time.time() + while time.time() < start + 10: + state = active_props.Get("org.freedesktop.NetworkManager.Connection.Active", "State") + if state == 2: # NM_ACTIVE_CONNECTION_STATE_ACTIVATED + print "Access point started" + sys.exit(0) + time.sleep(1) + print "Failed to start access point" +elif operation == "down": + device.Disconnect() +else: + usage() + +sys.exit(0) + |