Revert "[wpa_supplicant] Cumulative patch from c4e90da6d"
This reverts commit 39bc25d3a79c1375de430a7918d949c1a86f70c6.
Test: Compilation
Change-Id: Iae7670429466958911b5296cb1359bceecc0b03e
Exempt-From-Owner-Approval: Revert since it's breaking the build
diff --git a/wpa_supplicant/examples/dbus-listen-preq.py b/wpa_supplicant/examples/dbus-listen-preq.py
index 337519f..5ac9859 100755
--- a/wpa_supplicant/examples/dbus-listen-preq.py
+++ b/wpa_supplicant/examples/dbus-listen-preq.py
@@ -1,6 +1,5 @@
#!/usr/bin/python
-from __future__ import print_function
import dbus
import sys
import time
@@ -13,24 +12,21 @@
WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface"
def usage():
- print("Usage: %s <ifname>" % sys.argv[0])
- print("Press Ctrl-C to stop")
+ print "Usage: %s <ifname>" % sys.argv[0]
+ print "Press Ctrl-C to stop"
def ProbeRequest(args):
if 'addr' in args:
- print('%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['addr']),
- end=' ')
+ print '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['addr']),
if 'dst' in args:
- print('-> %.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['dst']),
- end=' ')
+ print '-> %.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['dst']),
if 'bssid' in args:
- print('(bssid %.2x:%.2x:%.2x:%.2x:%.2x:%.2x)' % tuple(args['dst']),
- end=' ')
+ print '(bssid %.2x:%.2x:%.2x:%.2x:%.2x:%.2x)' % tuple(args['dst']),
if 'signal' in args:
- print('signal:%d' % args['signal'], end=' ')
+ print 'signal:%d' % args['signal'],
if 'ies' in args:
- print('have IEs (%d bytes)' % len(args['ies']), end=' ')
- print('')
+ print 'have IEs (%d bytes)' % len(args['ies']),
+ print ''
if __name__ == "__main__":
global bus
diff --git a/wpa_supplicant/examples/dpp-qrcode.py b/wpa_supplicant/examples/dpp-qrcode.py
index b468d15..e2a00c9 100644
--- a/wpa_supplicant/examples/dpp-qrcode.py
+++ b/wpa_supplicant/examples/dpp-qrcode.py
@@ -24,19 +24,19 @@
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError as error:
- print("Could not find wpa_supplicant: ", error)
+ except OSError, error:
+ print "Could not find wpa_supplicant: ", error
return None
if len(ifaces) < 1:
- print("No wpa_supplicant control interface found")
+ print "No wpa_supplicant control interface found"
return None
for ctrl in ifaces:
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception as e:
+ except Exception, e:
pass
return None
@@ -55,27 +55,27 @@
continue
if not uri.startswith('DPP:'):
continue
- print("Found DPP bootstrap info URI:")
- print(uri)
+ print "Found DPP bootstrap info URI:"
+ print uri
wpas = wpas_connect()
if not wpas:
- print("Could not connect to wpa_supplicant")
- print('')
+ print "Could not connect to wpa_supplicant"
+ print
continue
res = wpas.request("DPP_QR_CODE " + uri);
try:
id = int(res)
except ValueError:
- print("QR Code URI rejected")
+ print "QR Code URI rejected"
continue
- print("QR Code URI accepted - ID=%d" % id)
- print(wpas.request("DPP_BOOTSTRAP_INFO %d" % id))
+ print "QR Code URI accepted - ID=%d" % id
+ print wpas.request("DPP_BOOTSTRAP_INFO %d" % id)
del wpas
def dpp_display(curve):
wpas = wpas_connect()
if not wpas:
- print("Could not connect to wpa_supplicant")
+ print "Could not connect to wpa_supplicant"
return
res = wpas.request("STATUS")
addr = None
@@ -93,18 +93,18 @@
try:
id = int(res)
except ValueError:
- print("Failed to generate bootstrap info URI")
+ print "Failed to generate bootstrap info URI"
return
- print("Bootstrap information - ID=%d" % id)
- print(wpas.request("DPP_BOOTSTRAP_INFO %d" % id))
+ print "Bootstrap information - ID=%d" % id
+ print wpas.request("DPP_BOOTSTRAP_INFO %d" % id)
uri = wpas.request("DPP_BOOTSTRAP_GET_URI %d" % id)
- print(uri)
- print("ID=%d" % id)
+ print uri
+ print "ID=%d" % id
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_M,
border=3)
qr.add_data(uri, optimize=5)
qr.print_ascii(tty=True)
- print("ID=%d" % id)
+ print "ID=%d" % id
del wpas
def main():
diff --git a/wpa_supplicant/examples/p2p-nfc.py b/wpa_supplicant/examples/p2p-nfc.py
index 889ac8b..91eba28 100644
--- a/wpa_supplicant/examples/p2p-nfc.py
+++ b/wpa_supplicant/examples/p2p-nfc.py
@@ -37,7 +37,7 @@
success_file = None
def summary(txt):
- print(txt)
+ print txt
if summary_file:
with open(summary_file, 'a') as f:
f.write(txt + "\n")
@@ -53,12 +53,12 @@
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError as error:
- print("Could not find wpa_supplicant: ", error)
+ except OSError, error:
+ print "Could not find wpa_supplicant: ", error
return None
if len(ifaces) < 1:
- print("No wpa_supplicant control interface found")
+ print "No wpa_supplicant control interface found"
return None
for ctrl in ifaces:
@@ -66,10 +66,10 @@
if ifname not in ctrl:
continue
try:
- print("Trying to use control interface " + ctrl)
+ print "Trying to use control interface " + ctrl
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception as e:
+ except Exception, e:
pass
return None
@@ -160,30 +160,30 @@
if (data == None):
summary("Could not get handover request carrier record from wpa_supplicant")
return
- print("Handover request carrier record from wpa_supplicant: " + data.encode("hex"))
+ print "Handover request carrier record from wpa_supplicant: " + data.encode("hex")
datamsg = nfc.ndef.Message(data)
message.add_carrier(datamsg[0], "active", datamsg[1:])
global include_wps_req
if include_wps_req:
- print("Handover request (pre-WPS):")
+ print "Handover request (pre-WPS):"
try:
- print(message.pretty())
- except Exception as e:
- print(e)
+ print message.pretty()
+ except Exception, e:
+ print e
data = wpas_get_handover_req_wps()
if data:
- print("Add WPS request in addition to P2P")
+ print "Add WPS request in addition to P2P"
datamsg = nfc.ndef.Message(data)
message.add_carrier(datamsg[0], "active", datamsg[1:])
- print("Handover request:")
+ print "Handover request:"
try:
- print(message.pretty())
- except Exception as e:
- print(e)
- print(str(message).encode("hex"))
+ print message.pretty()
+ except Exception, e:
+ print e
+ print str(message).encode("hex")
client = nfc.handover.HandoverClient(llc)
try:
@@ -194,7 +194,7 @@
summary("Handover connection refused")
client.close()
return
- except Exception as e:
+ except Exception, e:
summary("Other exception: " + str(e))
client.close()
return
@@ -217,41 +217,41 @@
client.close()
return
- print("Received message")
+ print "Received message"
try:
- print(message.pretty())
- except Exception as e:
- print(e)
- print(str(message).encode("hex"))
+ print message.pretty()
+ except Exception, e:
+ print e
+ print str(message).encode("hex")
message = nfc.ndef.HandoverSelectMessage(message)
summary("Handover select received")
try:
- print(message.pretty())
- except Exception as e:
- print(e)
+ print message.pretty()
+ except Exception, e:
+ print e
for carrier in message.carriers:
- print("Remote carrier type: " + carrier.type)
+ print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.p2p":
- print("P2P carrier type match - send to wpa_supplicant")
+ print "P2P carrier type match - send to wpa_supplicant"
if "OK" in wpas_report_handover(data, carrier.record, "INIT"):
success_report("P2P handover reported successfully (initiator)")
else:
summary("P2P handover report rejected")
break
- print("Remove peer")
+ print "Remove peer"
client.close()
- print("Done with handover")
+ print "Done with handover"
global only_one
if only_one:
- print("only_one -> stop loop")
+ print "only_one -> stop loop"
global continue_loop
continue_loop = False
global no_wait
if no_wait:
- print("Trying to exit..")
+ print "Trying to exit.."
global terminate_now
terminate_now = True
@@ -283,33 +283,33 @@
def process_request(self, request):
self.ho_server_processing = True
clear_raw_mode()
- print("HandoverServer - request received")
+ print "HandoverServer - request received"
try:
- print("Parsed handover request: " + request.pretty())
- except Exception as e:
- print(e)
+ print "Parsed handover request: " + request.pretty()
+ except Exception, e:
+ print e
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
found = False
for carrier in request.carriers:
- print("Remote carrier type: " + carrier.type)
+ print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.p2p":
- print("P2P carrier type match - add P2P carrier record")
+ print "P2P carrier type match - add P2P carrier record"
found = True
self.received_carrier = carrier.record
- print("Carrier record:")
+ print "Carrier record:"
try:
- print(carrier.record.pretty())
- except Exception as e:
- print(e)
+ print carrier.record.pretty()
+ except Exception, e:
+ print e
data = wpas_get_handover_sel()
if data is None:
- print("Could not get handover select carrier record from wpa_supplicant")
+ print "Could not get handover select carrier record from wpa_supplicant"
continue
- print("Handover select carrier record from wpa_supplicant:")
- print(data.encode("hex"))
+ print "Handover select carrier record from wpa_supplicant:"
+ print data.encode("hex")
self.sent_carrier = data
if "OK" in wpas_report_handover(self.received_carrier, self.sent_carrier, "RESP"):
success_report("P2P handover reported successfully (responder)")
@@ -324,22 +324,22 @@
for carrier in request.carriers:
if found:
break
- print("Remote carrier type: " + carrier.type)
+ print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.wsc":
- print("WSC carrier type match - add WSC carrier record")
+ print "WSC carrier type match - add WSC carrier record"
found = True
self.received_carrier = carrier.record
- print("Carrier record:")
+ print "Carrier record:"
try:
- print(carrier.record.pretty())
- except Exception as e:
- print(e)
+ print carrier.record.pretty()
+ except Exception, e:
+ print e
data = wpas_get_handover_sel_wps()
if data is None:
- print("Could not get handover select carrier record from wpa_supplicant")
+ print "Could not get handover select carrier record from wpa_supplicant"
continue
- print("Handover select carrier record from wpa_supplicant:")
- print(data.encode("hex"))
+ print "Handover select carrier record from wpa_supplicant:"
+ print data.encode("hex")
self.sent_carrier = data
if "OK" in wpas_report_handover_wsc(self.received_carrier, self.sent_carrier, "RESP"):
success_report("WSC handover reported successfully")
@@ -352,12 +352,12 @@
found = True
break
- print("Handover select:")
+ print "Handover select:"
try:
- print(sel.pretty())
- except Exception as e:
- print(e)
- print(str(sel).encode("hex"))
+ print sel.pretty()
+ except Exception, e:
+ print e
+ print str(sel).encode("hex")
summary("Sending handover select")
self.success = True
@@ -396,7 +396,7 @@
success = False
if len(tag.ndef.message):
for record in tag.ndef.message:
- print("record type " + record.type)
+ print "record type " + record.type
if record.type == "application/vnd.wfa.wsc":
summary("WPS tag - send to wpa_supplicant")
success = wpas_tag_read(tag.ndef.message)
@@ -419,7 +419,7 @@
global p2p_sel_data
tag.ndef.message = str(p2p_sel_data)
success_report("Tag write succeeded")
- print("Done - remove tag")
+ print "Done - remove tag"
global only_one
if only_one:
global continue_loop
@@ -428,7 +428,7 @@
return p2p_sel_wait_remove
def wps_write_p2p_handover_sel(clf, wait_remove=True):
- print("Write P2P handover select")
+ print "Write P2P handover select"
data = wpas_get_handover_sel(tag=True)
if (data == None):
summary("Could not get P2P handover select from wpa_supplicant")
@@ -440,14 +440,14 @@
p2p_sel_data = nfc.ndef.HandoverSelectMessage(version="1.2")
message = nfc.ndef.Message(data);
p2p_sel_data.add_carrier(message[0], "active", message[1:])
- print("Handover select:")
+ print "Handover select:"
try:
- print(p2p_sel_data.pretty())
- except Exception as e:
- print(e)
- print(str(p2p_sel_data).encode("hex"))
+ print p2p_sel_data.pretty()
+ except Exception, e:
+ print e
+ print str(p2p_sel_data).encode("hex")
- print("Touch an NFC tag")
+ print "Touch an NFC tag"
clf.connect(rdwr={'on-connect': rdwr_connected_p2p_write})
@@ -456,11 +456,11 @@
summary("Tag connected: " + str(tag))
if tag.ndef:
- print("NDEF tag: " + tag.type)
+ print "NDEF tag: " + tag.type
try:
- print(tag.ndef.message.pretty())
- except Exception as e:
- print(e)
+ print tag.ndef.message.pretty()
+ except Exception, e:
+ print e
success = p2p_tag_read(tag)
if only_one and success:
global continue_loop
@@ -475,15 +475,15 @@
def llcp_worker(llc):
global init_on_touch
if init_on_touch:
- print("Starting handover client")
+ print "Starting handover client"
p2p_handover_client(llc)
return
global no_input
if no_input:
- print("Wait for handover to complete")
+ print "Wait for handover to complete"
else:
- print("Wait for handover to complete - press 'i' to initiate ('w' for WPS only, 'p' for P2P only)")
+ print "Wait for handover to complete - press 'i' to initiate ('w' for WPS only, 'p' for P2P only)"
global srv
global wait_connection
while not wait_connection and srv.sent_carrier is None:
@@ -506,21 +506,21 @@
else:
continue
clear_raw_mode()
- print("Starting handover client")
+ print "Starting handover client"
p2p_handover_client(llc)
return
clear_raw_mode()
- print("Exiting llcp_worker thread")
+ print "Exiting llcp_worker thread"
def llcp_startup(clf, llc):
- print("Start LLCP server")
+ print "Start LLCP server"
global srv
srv = HandoverServer(llc)
return llc
def llcp_connected(llc):
- print("P2P LLCP connected")
+ print "P2P LLCP connected"
global wait_connection
wait_connection = False
global init_on_touch
@@ -587,7 +587,7 @@
if args.ifname:
global ifname
ifname = args.ifname
- print("Selected ifname " + ifname)
+ print "Selected ifname " + ifname
if args.no_wps_req:
global include_wps_req
@@ -610,7 +610,7 @@
try:
if not clf.open("usb"):
- print("Could not open connection with an NFC device")
+ print "Could not open connection with an NFC device"
raise SystemExit
if args.command == "write-p2p-sel":
@@ -619,7 +619,7 @@
global continue_loop
while continue_loop:
- print("Waiting for a tag or peer to be touched")
+ print "Waiting for a tag or peer to be touched"
wait_connection = True
try:
if args.tag_read_only:
@@ -636,8 +636,8 @@
'on-connect': llcp_connected},
terminate=terminate_loop):
break
- except Exception as e:
- print("clf.connect failed")
+ except Exception, e:
+ print "clf.connect failed"
global srv
if only_one and srv and srv.success:
diff --git a/wpa_supplicant/examples/p2p/p2p_connect.py b/wpa_supplicant/examples/p2p/p2p_connect.py
index 6e3d94e..59b0a9d 100644
--- a/wpa_supplicant/examples/p2p/p2p_connect.py
+++ b/wpa_supplicant/examples/p2p/p2p_connect.py
@@ -13,40 +13,40 @@
def usage():
- print("Usage:")
- print(" %s -i <interface_name> -m <wps_method> \ " \
- % sys.argv[0])
- print(" -a <addr> [-p <pin>] [-g <go_intent>] \ ")
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -m = wps method")
- print(" -a = peer address")
- print(" -p = pin number (8 digits)")
- print(" -g = group owner intent")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0 -a 0015008352c0 -m display -p 12345670" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> -m <wps_method> \ " \
+ % sys.argv[0]
+ print " -a <addr> [-p <pin>] [-g <go_intent>] \ "
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -m = wps method"
+ print " -a = peer address"
+ print " -p = pin number (8 digits)"
+ print " -g = group owner intent"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0 -a 0015008352c0 -m display -p 12345670" % sys.argv[0]
# Required Signals
def GONegotiationSuccess(status):
- print("Go Negotiation Success")
+ print "Go Negotiation Success"
def GONegotiationFailure(status):
- print('Go Negotiation Failed. Status:')
- print(format(status))
+ print 'Go Negotiation Failed. Status:'
+ print format(status)
os._exit(0)
def GroupStarted(properties):
if properties.has_key("group_object"):
- print('Group Formation Complete %s' \
- % properties["group_object"])
+ print 'Group Formation Complete %s' \
+ % properties["group_object"]
os._exit(0)
def WpsFailure(status, etc):
- print("WPS Authentication Failure".format(status))
- print(etc)
+ print "WPS Authentication Failure".format(status)
+ print etc
os._exit(0)
class P2P_Connect():
@@ -118,7 +118,7 @@
{'Ifname': ifname, 'Driver': 'test'})
time.sleep(1)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
if not str(exc).startswith(
self.wpas_dbus_interface + \
".InterfaceExists:"):
@@ -157,12 +157,12 @@
if (self.pin != None):
self.p2p_connect_arguements.update({'pin':self.pin})
else:
- print("Error:\n Pin required for wps_method=display")
+ print "Error:\n Pin required for wps_method=display"
usage()
quit()
if (self.go_intent != None and int(self.go_intent) != 15):
- print("go_intent overwritten to 15")
+ print "go_intent overwritten to 15"
self.go_intent = '15'
@@ -171,14 +171,14 @@
if (self.pin != None):
self.p2p_connect_arguements.update({'pin':self.pin})
else:
- print("Error:\n Pin required for wps_method=keypad")
+ print "Error:\n Pin required for wps_method=keypad"
usage()
quit()
if (self.go_intent != None and int(self.go_intent) == 15):
error = "Error :\n Group Owner intent cannot be" + \
" 15 for wps_method=keypad"
- print(error)
+ print error
usage()
quit()
@@ -186,15 +186,15 @@
# for ./wpa_cli, p2p_connect [mac] [pin#], wps_method=keypad
elif (self.wps_method == 'pin'):
if (self.pin != None):
- print("pin ignored")
+ print "pin ignored"
# No pin is required for pbc so it is ignored
elif (self.wps_method == 'pbc'):
if (self.pin != None):
- print("pin ignored")
+ print "pin ignored"
else:
- print("Error:\n wps_method not supported or does not exist")
+ print "Error:\n wps_method not supported or does not exist"
usage()
quit()
@@ -209,12 +209,12 @@
result_pin = self.p2p_interface.Connect(
self.p2p_connect_arguements)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
raise exc
if (self.wps_method == 'pin' and \
not self.p2p_connect_arguements.has_key('pin') ):
- print("Connect return with pin value of %d " % int(result_pin))
+ print "Connect return with pin value of %d " % int(result_pin)
gobject.MainLoop().run()
if __name__ == "__main__":
@@ -268,19 +268,19 @@
# Required Arguements check
if (interface_name == None or wps_method == None or addr == None):
- print("Error:\n Required arguements not specified")
+ print "Error:\n Required arguements not specified"
usage()
quit()
# Group Owner Intent Check
if (go_intent != None and (int(go_intent) > 15 or int(go_intent) < 0) ):
- print("Error:\n Group Owner Intent must be between 0 and 15 inclusive")
+ print "Error:\n Group Owner Intent must be between 0 and 15 inclusive"
usage()
quit()
# Pin Check
if (pin != None and len(pin) != 8):
- print("Error:\n Pin is not 8 digits")
+ print "Error:\n Pin is not 8 digits"
usage()
quit()
@@ -289,7 +289,7 @@
addr,pin,wps_method,go_intent)
except:
- print("Error:\n Invalid Arguements")
+ print "Error:\n Invalid Arguements"
usage()
quit()
diff --git a/wpa_supplicant/examples/p2p/p2p_disconnect.py b/wpa_supplicant/examples/p2p/p2p_disconnect.py
index 85b5a8b..c3e39b3 100644
--- a/wpa_supplicant/examples/p2p/p2p_disconnect.py
+++ b/wpa_supplicant/examples/p2p/p2p_disconnect.py
@@ -12,19 +12,19 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> \ " \
- % sys.argv[0])
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i p2p-wlan0-0" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> \ " \
+ % sys.argv[0]
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i p2p-wlan0-0" % sys.argv[0]
# Required Signals
def GroupFinished(status, etc):
- print("Disconnected")
+ print "Disconnected"
os._exit(0)
class P2P_Disconnect (threading.Thread):
@@ -81,10 +81,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -142,7 +142,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -152,7 +152,7 @@
wpas_dbus_interface,timeout)
except:
- print("Error:\n Invalid wpas_dbus_interface")
+ print "Error:\n Invalid wpas_dbus_interface"
usage()
quit()
@@ -165,5 +165,5 @@
except:
pass
- print("Disconnect timed out")
+ print "Disconnect timed out"
quit()
diff --git a/wpa_supplicant/examples/p2p/p2p_find.py b/wpa_supplicant/examples/p2p/p2p_find.py
index e2df528..973d46a 100644
--- a/wpa_supplicant/examples/p2p/p2p_find.py
+++ b/wpa_supplicant/examples/p2p/p2p_find.py
@@ -13,23 +13,23 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> [-t <timeout>] \ " \
- % sys.argv[0])
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -t = timeout = 0s (infinite)")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0 -t 10" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> [-t <timeout>] \ " \
+ % sys.argv[0]
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -t = timeout = 0s (infinite)"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0 -t 10" % sys.argv[0]
# Required Signals
def deviceFound(devicepath):
- print("Device found: %s" % (devicepath))
+ print "Device found: %s" % (devicepath)
def deviceLost(devicepath):
- print("Device lost: %s" % (devicepath))
+ print "Device lost: %s" % (devicepath)
class P2P_Find (threading.Thread):
# Needed Variables
@@ -85,10 +85,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -150,7 +150,7 @@
if ( int(value) >= 0):
timeout = value
else:
- print("Error:\n Timeout cannot be negative")
+ print "Error:\n Timeout cannot be negative"
usage()
quit()
# Dbus interface
@@ -161,7 +161,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -170,7 +170,7 @@
p2p_find_test = P2P_Find(interface_name, wpas_dbus_interface, timeout)
except:
- print("Error:\n Invalid wpas_dbus_interface")
+ print "Error:\n Invalid wpas_dbus_interface"
usage()
quit()
diff --git a/wpa_supplicant/examples/p2p/p2p_flush.py b/wpa_supplicant/examples/p2p/p2p_flush.py
index 42fc7a3..ff8509d 100644
--- a/wpa_supplicant/examples/p2p/p2p_flush.py
+++ b/wpa_supplicant/examples/p2p/p2p_flush.py
@@ -13,19 +13,19 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> \ " \
- % sys.argv[0])
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> \ " \
+ % sys.argv[0]
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0" % sys.argv[0]
# Required Signals\
def deviceLost(devicepath):
- print("Device lost: %s" % (devicepath))
+ print "Device lost: %s" % (devicepath)
class P2P_Flush (threading.Thread):
# Needed Variables
@@ -81,10 +81,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -142,7 +142,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -151,7 +151,7 @@
p2p_flush_test = P2P_Flush(interface_name, wpas_dbus_interface,timeout)
except:
- print("Error:\n Invalid wpas_dbus_interface")
+ print "Error:\n Invalid wpas_dbus_interface"
usage()
quit()
@@ -164,5 +164,5 @@
except:
pass
- print("p2p_flush complete")
+ print "p2p_flush complete"
quit()
diff --git a/wpa_supplicant/examples/p2p/p2p_group_add.py b/wpa_supplicant/examples/p2p/p2p_group_add.py
index 6d40821..5c8fdaf 100644
--- a/wpa_supplicant/examples/p2p/p2p_group_add.py
+++ b/wpa_supplicant/examples/p2p/p2p_group_add.py
@@ -11,30 +11,30 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> [-p <persistent>] \ " \
- % sys.argv[0])
- print(" [-f <frequency>] [-o <group_object_path>] \ ")
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -p = persistant group = 0 (0=false, 1=true)")
- print(" -f = frequency")
- print(" -o = persistent group object path")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> [-p <persistent>] \ " \
+ % sys.argv[0]
+ print " [-f <frequency>] [-o <group_object_path>] \ "
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -p = persistant group = 0 (0=false, 1=true)"
+ print " -f = frequency"
+ print " -o = persistent group object path"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0" % sys.argv[0]
# Required Signals
def GroupStarted(properties):
if properties.has_key("group_object"):
- print('Group Formation Complete %s' \
- % properties["group_object"])
+ print 'Group Formation Complete %s' \
+ % properties["group_object"]
os._exit(0)
def WpsFailure(status, etc):
- print("WPS Authentication Failure".format(status))
- print(etc)
+ print "WPS Authentication Failure".format(status)
+ print etc
os._exit(0)
class P2P_Group_Add (threading.Thread):
@@ -99,10 +99,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -127,7 +127,7 @@
if (int(self.frequency) > 0):
self.P2PDictionary.update({'frequency':int(self.frequency)})
else:
- print("Error:\n Frequency must be greater than 0")
+ print "Error:\n Frequency must be greater than 0"
usage()
os._exit(0)
@@ -141,7 +141,7 @@
self.p2p_interface.GroupAdd(self.P2PDictionary)
except:
- print("Error:\n Could not preform group add")
+ print "Error:\n Could not preform group add"
usage()
os._exit(0)
@@ -188,7 +188,7 @@
elif (value == '1'):
persistent = True
else:
- print("Error:\n Persistent can only be 1 or 0")
+ print "Error:\n Persistent can only be 1 or 0"
usage()
os._exit(0)
# Frequency
@@ -205,7 +205,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -213,10 +213,10 @@
p2p_group_add_test = P2P_Group_Add(interface_name,wpas_dbus_interface,
persistent,frequency,persistent_group_object)
except:
- print("Error:\n Invalid Arguements")
+ print "Error:\n Invalid Arguements"
p2p_group_add_test.constructArguements()
p2p_group_add_test.start()
time.sleep(5)
- print("Error:\n Group formation timed out")
+ print "Error:\n Group formation timed out"
os._exit(0)
diff --git a/wpa_supplicant/examples/p2p/p2p_invite.py b/wpa_supplicant/examples/p2p/p2p_invite.py
index 341dcd0..6deb397 100644
--- a/wpa_supplicant/examples/p2p/p2p_invite.py
+++ b/wpa_supplicant/examples/p2p/p2p_invite.py
@@ -11,29 +11,29 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> -a <addr> \ " \
- % sys.argv[0])
- print(" [-o <persistent_group_object>] [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -a = address of peer")
- print(" -o = persistent group object path")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i p2p-wlan0-0 -a 00150083523c" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> -a <addr> \ " \
+ % sys.argv[0]
+ print " [-o <persistent_group_object>] [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -a = address of peer"
+ print " -o = persistent group object path"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i p2p-wlan0-0 -a 00150083523c" % sys.argv[0]
# Required Signals
def InvitationResult(invite_result):
- print("Inviation Result signal :")
+ print "Inviation Result signal :"
status = invite_result['status']
- print("status = ", status)
+ print "status = ", status
if invite_result.has_key('BSSID'):
bssid = invite_result['BSSID']
- print("BSSID = ", hex(bssid[0]) , ":" , \
+ print "BSSID = ", hex(bssid[0]) , ":" , \
hex(bssid[1]) , ":" , hex(bssid[2]) , ":", \
hex(bssid[3]) , ":" , hex(bssid[4]) , ":" , \
- hex(bssid[5]))
+ hex(bssid[5])
os._exit(0)
class P2P_Invite (threading.Thread):
@@ -96,10 +96,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -127,7 +127,7 @@
self.p2p_interface.Invite(self.P2PDictionary)
except:
- print("Error:\n Invalid Arguements")
+ print "Error:\n Invalid Arguements"
usage()
os._exit(0)
@@ -176,12 +176,12 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
if (addr == None):
- print("Error:\n peer address is required")
+ print "Error:\n peer address is required"
usage()
quit()
@@ -190,12 +190,12 @@
P2P_Invite(interface_name,wpas_dbus_interface,
addr,persistent_group_object)
except:
- print("Error:\n Invalid Arguements")
+ print "Error:\n Invalid Arguements"
usage()
os._exit(1)
p2p_invite_test.constructArguements()
p2p_invite_test.start()
time.sleep(10)
- print("Error:\n p2p_invite timed out")
+ print "Error:\n p2p_invite timed out"
os._exit(0)
diff --git a/wpa_supplicant/examples/p2p/p2p_listen.py b/wpa_supplicant/examples/p2p/p2p_listen.py
index b0837d9..bb3c1e4 100644
--- a/wpa_supplicant/examples/p2p/p2p_listen.py
+++ b/wpa_supplicant/examples/p2p/p2p_listen.py
@@ -13,20 +13,20 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> [-t <timeout>] \ " \
- % sys.argv[0])
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -t = timeout = 0s (infinite)")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0 -t 5" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> [-t <timeout>] \ " \
+ % sys.argv[0]
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -t = timeout = 0s (infinite)"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0 -t 5" % sys.argv[0]
# Required Signals
def p2pStateChange(status):
- print(status)
+ print status
class P2P_Listen(threading.Thread):
# Needed Variables
@@ -82,10 +82,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -140,7 +140,7 @@
if ( int(value) >= 0):
timeout = value
else:
- print("Error:\n Timeout cannot be negative")
+ print "Error:\n Timeout cannot be negative"
usage()
quit()
# Dbus interface
@@ -151,7 +151,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -160,7 +160,7 @@
p2p_listen_test = P2P_Listen(interface_name, wpas_dbus_interface, timeout)
except:
- print("Error:\n Invalid wpas_dbus_interface")
+ print "Error:\n Invalid wpas_dbus_interface"
usage()
quit()
diff --git a/wpa_supplicant/examples/p2p/p2p_stop_find.py b/wpa_supplicant/examples/p2p/p2p_stop_find.py
index bdb4c0e..f6c03b0 100644
--- a/wpa_supplicant/examples/p2p/p2p_stop_find.py
+++ b/wpa_supplicant/examples/p2p/p2p_stop_find.py
@@ -11,22 +11,22 @@
from dbus.mainloop.glib import DBusGMainLoop
def usage():
- print("Usage:")
- print(" %s -i <interface_name> \ " \
- % sys.argv[0])
- print(" [-w <wpas_dbus_interface>]")
- print("Options:")
- print(" -i = interface name")
- print(" -w = wpas dbus interface = fi.w1.wpa_supplicant1")
- print("Example:")
- print(" %s -i wlan0" % sys.argv[0])
+ print "Usage:"
+ print " %s -i <interface_name> \ " \
+ % sys.argv[0]
+ print " [-w <wpas_dbus_interface>]"
+ print "Options:"
+ print " -i = interface name"
+ print " -w = wpas dbus interface = fi.w1.wpa_supplicant1"
+ print "Example:"
+ print " %s -i wlan0" % sys.argv[0]
# Required Signals
def deviceLost(devicepath):
- print("Device lost: %s" % (devicepath))
+ print "Device lost: %s" % (devicepath)
def p2pStateChange(status):
- print(status)
+ print status
os._exit(0)
class P2P_Stop_Find (threading.Thread):
@@ -83,10 +83,10 @@
try:
self.path = self.wpas.GetInterface(
self.interface_name)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
error = 'Error:\n Interface ' + self.interface_name \
+ ' was not found'
- print(error)
+ print error
usage()
os._exit(0)
@@ -147,7 +147,7 @@
# Interface name is required and was not given
if (interface_name == None):
- print("Error:\n interface_name is required")
+ print "Error:\n interface_name is required"
usage()
quit()
@@ -157,7 +157,7 @@
wpas_dbus_interface,timeout)
except:
- print("Error:\n Invalid wpas_dbus_interface")
+ print "Error:\n Invalid wpas_dbus_interface"
usage()
quit()
@@ -170,5 +170,5 @@
except:
pass
- print("p2p find stopped")
+ print "p2p find stopped"
quit()
diff --git a/wpa_supplicant/examples/wpas-dbus-new-getall.py b/wpa_supplicant/examples/wpas-dbus-new-getall.py
index 732f54d..03da187 100755
--- a/wpa_supplicant/examples/wpas-dbus-new-getall.py
+++ b/wpa_supplicant/examples/wpas-dbus-new-getall.py
@@ -11,8 +11,8 @@
"/fi/w1/wpa_supplicant1")
props = wpas_obj.GetAll("fi.w1.wpa_supplicant1",
dbus_interface=dbus.PROPERTIES_IFACE)
- print("GetAll(fi.w1.wpa_supplicant1, /fi/w1/wpa_supplicant1):")
- print(props)
+ print "GetAll(fi.w1.wpa_supplicant1, /fi/w1/wpa_supplicant1):"
+ print props
if len(sys.argv) != 2:
os._exit(1)
@@ -24,15 +24,15 @@
if_obj = bus.get_object("fi.w1.wpa_supplicant1", path)
props = if_obj.GetAll("fi.w1.wpa_supplicant1.Interface",
dbus_interface=dbus.PROPERTIES_IFACE)
- print('')
- print("GetAll(fi.w1.wpa_supplicant1.Interface, %s):" % (path))
- print(props)
+ print
+ print "GetAll(fi.w1.wpa_supplicant1.Interface, %s):" % (path)
+ print props
props = if_obj.GetAll("fi.w1.wpa_supplicant1.Interface.WPS",
dbus_interface=dbus.PROPERTIES_IFACE)
- print('')
- print("GetAll(fi.w1.wpa_supplicant1.Interface.WPS, %s):" % (path))
- print(props)
+ print
+ print "GetAll(fi.w1.wpa_supplicant1.Interface.WPS, %s):" % (path)
+ print props
res = if_obj.Get("fi.w1.wpa_supplicant1.Interface", 'BSSs',
dbus_interface=dbus.PROPERTIES_IFACE)
@@ -40,9 +40,9 @@
bss_obj = bus.get_object("fi.w1.wpa_supplicant1", res[0])
props = bss_obj.GetAll("fi.w1.wpa_supplicant1.BSS",
dbus_interface=dbus.PROPERTIES_IFACE)
- print('')
- print("GetAll(fi.w1.wpa_supplicant1.BSS, %s):" % (res[0]))
- print(props)
+ print
+ print "GetAll(fi.w1.wpa_supplicant1.BSS, %s):" % (res[0])
+ print props
res = if_obj.Get("fi.w1.wpa_supplicant1.Interface", 'Networks',
dbus_interface=dbus.PROPERTIES_IFACE)
@@ -50,9 +50,10 @@
net_obj = bus.get_object("fi.w1.wpa_supplicant1", res[0])
props = net_obj.GetAll("fi.w1.wpa_supplicant1.Network",
dbus_interface=dbus.PROPERTIES_IFACE)
- print('')
- print("GetAll(fi.w1.wpa_supplicant1.Network, %s):" % (res[0]))
- print(props)
+ print
+ print "GetAll(fi.w1.wpa_supplicant1.Network, %s):" % (res[0])
+ print props
if __name__ == "__main__":
main()
+
diff --git a/wpa_supplicant/examples/wpas-dbus-new-signals.py b/wpa_supplicant/examples/wpas-dbus-new-signals.py
index 366a655..d90ef18 100755
--- a/wpa_supplicant/examples/wpas-dbus-new-signals.py
+++ b/wpa_supplicant/examples/wpas-dbus-new-signals.py
@@ -32,17 +32,17 @@
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
ifname = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'Ifname',
dbus_interface=dbus.PROPERTIES_IFACE)
- print(ifname)
+ print ifname
def interfaceAdded(interface, properties):
- print("InterfaceAdded(%s): Ifname=%s" % (interface, properties['Ifname']))
+ print "InterfaceAdded(%s): Ifname=%s" % (interface, properties['Ifname'])
def interfaceRemoved(interface):
- print("InterfaceRemoved(%s)" % (interface))
+ print "InterfaceRemoved(%s)" % (interface)
def propertiesChanged(properties):
for i in properties:
- print("PropertiesChanged: %s=%s" % (i, properties[i]))
+ print "PropertiesChanged: %s=%s" % (i, properties[i])
def showBss(bss):
net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss)
@@ -80,48 +80,48 @@
else:
maxrate = 0
- print(" %s :: ssid='%s' wpa=%s wpa2=%s signal=%d rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, signal, maxrate, freq))
+ print " %s :: ssid='%s' wpa=%s wpa2=%s signal=%d rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, signal, maxrate, freq)
def scanDone(success):
gobject.MainLoop().quit()
- print("Scan done: success=%s" % success)
+ print "Scan done: success=%s" % success
def scanDone2(success, path=None):
- print("Scan done: success=%s [path=%s]" % (success, path))
+ print "Scan done: success=%s [path=%s]" % (success, path)
def bssAdded(bss, properties):
- print("BSS added: %s" % (bss))
+ print "BSS added: %s" % (bss)
showBss(bss)
def bssRemoved(bss):
- print("BSS removed: %s" % (bss))
+ print "BSS removed: %s" % (bss)
def blobAdded(blob):
- print("BlobAdded(%s)" % (blob))
+ print "BlobAdded(%s)" % (blob)
def blobRemoved(blob):
- print("BlobRemoved(%s)" % (blob))
+ print "BlobRemoved(%s)" % (blob)
def networkAdded(network, properties):
- print("NetworkAdded(%s)" % (network))
+ print "NetworkAdded(%s)" % (network)
def networkRemoved(network):
- print("NetworkRemoved(%s)" % (network))
+ print "NetworkRemoved(%s)" % (network)
def networkSelected(network):
- print("NetworkSelected(%s)" % (network))
+ print "NetworkSelected(%s)" % (network)
def propertiesChangedInterface(properties):
for i in properties:
- print("PropertiesChanged(interface): %s=%s" % (i, properties[i]))
+ print "PropertiesChanged(interface): %s=%s" % (i, properties[i])
def propertiesChangedBss(properties):
for i in properties:
- print("PropertiesChanged(BSS): %s=%s" % (i, properties[i]))
+ print "PropertiesChanged(BSS): %s=%s" % (i, properties[i])
def propertiesChangedNetwork(properties):
for i in properties:
- print("PropertiesChanged(Network): %s=%s" % (i, properties[i]))
+ print "PropertiesChanged(Network): %s=%s" % (i, properties[i])
def main():
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
diff --git a/wpa_supplicant/examples/wpas-dbus-new-wps.py b/wpa_supplicant/examples/wpas-dbus-new-wps.py
index 7d87b1e..b886385 100755
--- a/wpa_supplicant/examples/wpas-dbus-new-wps.py
+++ b/wpa_supplicant/examples/wpas-dbus-new-wps.py
@@ -15,23 +15,23 @@
def propertiesChanged(properties):
if properties.has_key("State"):
- print("PropertiesChanged: State: %s" % (properties["State"]))
+ print "PropertiesChanged: State: %s" % (properties["State"])
def scanDone(success):
- print("Scan done: success=%s" % success)
+ print "Scan done: success=%s" % success
def bssAdded(bss, properties):
- print("BSS added: %s" % (bss))
+ print "BSS added: %s" % (bss)
def bssRemoved(bss):
- print("BSS removed: %s" % (bss))
+ print "BSS removed: %s" % (bss)
def wpsEvent(name, args):
- print("WPS event: %s" % (name))
- print(args)
+ print "WPS event: %s" % (name)
+ print args
def credentials(cred):
- print("WPS credentials: %s" % (cred))
+ print "WPS credentials: %s" % (cred)
def main():
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -40,7 +40,7 @@
wpas_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
if len(sys.argv) != 2:
- print("Missing ifname argument")
+ print "Missing ifname argument"
os._exit(1)
wpas = dbus.Interface(wpas_obj, WPAS_DBUS_INTERFACE)
diff --git a/wpa_supplicant/examples/wpas-dbus-new.py b/wpa_supplicant/examples/wpas-dbus-new.py
index 6bf74ae..25072ce 100755
--- a/wpa_supplicant/examples/wpas-dbus-new.py
+++ b/wpa_supplicant/examples/wpas-dbus-new.py
@@ -31,11 +31,11 @@
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
ifname = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'Ifname',
dbus_interface=dbus.PROPERTIES_IFACE)
- print(ifname)
+ print ifname
def propertiesChanged(properties):
if properties.has_key("State"):
- print("PropertiesChanged: State: %s" % (properties["State"]))
+ print "PropertiesChanged: State: %s" % (properties["State"])
def showBss(bss):
net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss)
@@ -73,25 +73,25 @@
else:
maxrate = 0
- print(" %s :: ssid='%s' wpa=%s wpa2=%s signal=%d rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, signal, maxrate, freq))
+ print " %s :: ssid='%s' wpa=%s wpa2=%s signal=%d rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, signal, maxrate, freq)
def scanDone(success):
- print("Scan done: success=%s" % success)
+ print "Scan done: success=%s" % success
res = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'BSSs',
dbus_interface=dbus.PROPERTIES_IFACE)
- print("Scanned wireless networks:")
+ print "Scanned wireless networks:"
for opath in res:
- print(opath)
+ print opath
showBss(opath)
def bssAdded(bss, properties):
- print("BSS added: %s" % (bss))
+ print "BSS added: %s" % (bss)
showBss(bss)
def bssRemoved(bss):
- print("BSS removed: %s" % (bss))
+ print "BSS removed: %s" % (bss)
def main():
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -123,14 +123,14 @@
path = None
try:
path = wpas.GetInterface(ifname)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceUnknown:"):
raise exc
try:
path = wpas.CreateInterface({'Ifname': ifname, 'Driver': 'test'})
time.sleep(1)
- except dbus.DBusException as exc:
+ except dbus.DBusException, exc:
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceExists:"):
raise exc
diff --git a/wpa_supplicant/examples/wpas-test.py b/wpa_supplicant/examples/wpas-test.py
index bdd16a8..fd7f73d 100755
--- a/wpa_supplicant/examples/wpas-test.py
+++ b/wpa_supplicant/examples/wpas-test.py
@@ -24,7 +24,7 @@
def main():
if len(sys.argv) != 2:
- print("Usage: wpas-test.py <interface>")
+ print "Usage: wpas-test.py <interface>"
os._exit(1)
ifname = sys.argv[1]
@@ -37,12 +37,12 @@
path = None
try:
path = wpas.getInterface(ifname)
- except dbus.dbus_bindings.DBusException as exc:
+ except dbus.dbus_bindings.DBusException, exc:
if str(exc) != "wpa_supplicant knows nothing about this interface.":
raise exc
try:
path = wpas.addInterface(ifname, {'driver': dbus.Variant('wext')})
- except dbus.dbus_bindings.DBusException as exc:
+ except dbus.dbus_bindings.DBusException, exc:
if str(exc) != "wpa_supplicant already controls this interface.":
raise exc
@@ -53,7 +53,7 @@
time.sleep(5)
res = iface.scanResults()
- print("Scanned wireless networks:")
+ print "Scanned wireless networks:"
for opath in res:
net_obj = bus.get_object(WPAS_DBUS_SERVICE, opath)
net = dbus.Interface(net_obj, WPAS_DBUS_BSSID_INTERFACE)
@@ -80,7 +80,7 @@
noise = props["noise"]
maxrate = props["maxrate"] / 1000000
- print(" %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq))
+ print " %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq)
wpas.removeInterface(dbus.ObjectPath(path))
# Should fail here with unknown interface error
diff --git a/wpa_supplicant/examples/wps-ap-cli b/wpa_supplicant/examples/wps-ap-cli
index 15d913e..cc2cff2 100755
--- a/wpa_supplicant/examples/wps-ap-cli
+++ b/wpa_supplicant/examples/wps-ap-cli
@@ -14,12 +14,12 @@
enter_pin()
{
echo "Enter a PIN from a station to be enrolled to the network."
- printf "Enrollee PIN: "
+ echo -n "Enrollee PIN: "
read pin
cpin=`$CLI wps_check_pin "$pin" | tail -1`
if [ "$cpin" = "FAIL-CHECKSUM" ]; then
echo "Checksum digit is not valid"
- printf "Do you want to use this PIN (y/n)? "
+ echo -n "Do you want to use this PIN (y/n)? "
read resp
case "$resp" in
y*)
@@ -52,7 +52,7 @@
echo "3: Show current configuration"
echo "0: Exit wps-ap-cli"
- printf "Command: "
+ echo -n "Command: "
read cmd
case "$cmd" in
diff --git a/wpa_supplicant/examples/wps-nfc.py b/wpa_supplicant/examples/wps-nfc.py
index bb458fb..7459eb9 100755
--- a/wpa_supplicant/examples/wps-nfc.py
+++ b/wpa_supplicant/examples/wps-nfc.py
@@ -30,7 +30,7 @@
success_file = None
def summary(txt):
- print(txt)
+ print txt
if summary_file:
with open(summary_file, 'a') as f:
f.write(txt + "\n")
@@ -46,19 +46,19 @@
if os.path.isdir(wpas_ctrl):
try:
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
- except OSError as error:
- print("Could not find wpa_supplicant: ", error)
+ except OSError, error:
+ print "Could not find wpa_supplicant: ", error
return None
if len(ifaces) < 1:
- print("No wpa_supplicant control interface found")
+ print "No wpa_supplicant control interface found"
return None
for ctrl in ifaces:
try:
wpas = wpaspy.Ctrl(ctrl)
return wpas
- except Exception as e:
+ except Exception, e:
pass
return None
@@ -163,22 +163,22 @@
self.ho_server_processing = True
summary("HandoverServer - request received")
try:
- print("Parsed handover request: " + request.pretty())
- except Exception as e:
- print(e)
+ print "Parsed handover request: " + request.pretty()
+ except Exception, e:
+ print e
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
for carrier in request.carriers:
- print("Remote carrier type: " + carrier.type)
+ print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.wsc":
summary("WPS carrier type match - add WPS carrier record")
data = wpas_get_handover_sel(self.uuid)
if data is None:
summary("Could not get handover select carrier record from wpa_supplicant")
continue
- print("Handover select carrier record from wpa_supplicant:")
- print(data.encode("hex"))
+ print "Handover select carrier record from wpa_supplicant:"
+ print data.encode("hex")
self.sent_carrier = data
if "OK" in wpas_report_handover(carrier.record, self.sent_carrier, "RESP"):
success_report("Handover reported successfully (responder)")
@@ -188,12 +188,12 @@
message = nfc.ndef.Message(data);
sel.add_carrier(message[0], "active", message[1:])
- print("Handover select:")
+ print "Handover select:"
try:
- print(sel.pretty())
- except Exception as e:
- print(e)
- print(str(sel).encode("hex"))
+ print sel.pretty()
+ except Exception, e:
+ print e
+ print str(sel).encode("hex")
summary("Sending handover select")
self.success = True
@@ -207,19 +207,19 @@
if (data == None):
summary("Could not get handover request carrier record from wpa_supplicant")
return
- print("Handover request carrier record from wpa_supplicant: " + data.encode("hex"))
+ print "Handover request carrier record from wpa_supplicant: " + data.encode("hex")
message = nfc.ndef.HandoverRequestMessage(version="1.2")
message.nonce = random.randint(0, 0xffff)
datamsg = nfc.ndef.Message(data)
message.add_carrier(datamsg[0], "active", datamsg[1:])
- print("Handover request:")
+ print "Handover request:"
try:
- print(message.pretty())
- except Exception as e:
- print(e)
- print(str(message).encode("hex"))
+ print message.pretty()
+ except Exception, e:
+ print e
+ print str(message).encode("hex")
client = nfc.handover.HandoverClient(llc)
try:
@@ -230,7 +230,7 @@
summary("Handover connection refused")
client.close()
return
- except Exception as e:
+ except Exception, e:
summary("Other exception: " + str(e))
client.close()
return
@@ -253,23 +253,23 @@
client.close()
return
- print("Received message")
+ print "Received message"
try:
- print(message.pretty())
- except Exception as e:
- print(e)
- print(str(message).encode("hex"))
+ print message.pretty()
+ except Exception, e:
+ print e
+ print str(message).encode("hex")
message = nfc.ndef.HandoverSelectMessage(message)
summary("Handover select received")
try:
- print(message.pretty())
- except Exception as e:
- print(e)
+ print message.pretty()
+ except Exception, e:
+ print e
for carrier in message.carriers:
- print("Remote carrier type: " + carrier.type)
+ print "Remote carrier type: " + carrier.type
if carrier.type == "application/vnd.wfa.wsc":
- print("WPS carrier type match - send to wpa_supplicant")
+ print "WPS carrier type match - send to wpa_supplicant"
if "OK" in wpas_report_handover(data, carrier.record, "INIT"):
success_report("Handover reported successfully (initiator)")
else:
@@ -278,9 +278,9 @@
#wifi = nfc.ndef.WifiConfigRecord(carrier.record)
#print wifi.pretty()
- print("Remove peer")
+ print "Remove peer"
client.close()
- print("Done with handover")
+ print "Done with handover"
global only_one
if only_one:
global continue_loop
@@ -288,7 +288,7 @@
global no_wait
if no_wait:
- print("Trying to exit..")
+ print "Trying to exit.."
global terminate_now
terminate_now = True
@@ -296,7 +296,7 @@
success = False
if len(tag.ndef.message):
for record in tag.ndef.message:
- print("record type " + record.type)
+ print "record type " + record.type
if record.type == "application/vnd.wfa.wsc":
summary("WPS tag - send to wpa_supplicant")
success = wpas_tag_read(tag.ndef.message)
@@ -308,7 +308,7 @@
success_report("Tag read succeeded")
if wait_remove:
- print("Remove tag")
+ print "Remove tag"
while tag.is_present:
time.sleep(0.1)
@@ -320,7 +320,7 @@
global write_data
tag.ndef.message = str(write_data)
success_report("Tag write succeeded")
- print("Done - remove tag")
+ print "Done - remove tag"
global only_one
if only_one:
global continue_loop
@@ -330,41 +330,41 @@
time.sleep(0.1)
def wps_write_config_tag(clf, id=None, wait_remove=True):
- print("Write WPS config token")
+ print "Write WPS config token"
global write_data, write_wait_remove
write_wait_remove = wait_remove
write_data = wpas_get_config_token(id)
if write_data == None:
- print("Could not get WPS config token from wpa_supplicant")
+ print "Could not get WPS config token from wpa_supplicant"
sys.exit(1)
return
- print("Touch an NFC tag")
+ print "Touch an NFC tag"
clf.connect(rdwr={'on-connect': rdwr_connected_write})
def wps_write_er_config_tag(clf, uuid, wait_remove=True):
- print("Write WPS ER config token")
+ print "Write WPS ER config token"
global write_data, write_wait_remove
write_wait_remove = wait_remove
write_data = wpas_get_er_config_token(uuid)
if write_data == None:
- print("Could not get WPS config token from wpa_supplicant")
+ print "Could not get WPS config token from wpa_supplicant"
return
- print("Touch an NFC tag")
+ print "Touch an NFC tag"
clf.connect(rdwr={'on-connect': rdwr_connected_write})
def wps_write_password_tag(clf, wait_remove=True):
- print("Write WPS password token")
+ print "Write WPS password token"
global write_data, write_wait_remove
write_wait_remove = wait_remove
write_data = wpas_get_password_token()
if write_data == None:
- print("Could not get WPS password token from wpa_supplicant")
+ print "Could not get WPS password token from wpa_supplicant"
return
- print("Touch an NFC tag")
+ print "Touch an NFC tag"
clf.connect(rdwr={'on-connect': rdwr_connected_write})
@@ -373,11 +373,11 @@
summary("Tag connected: " + str(tag))
if tag.ndef:
- print("NDEF tag: " + tag.type)
+ print "NDEF tag: " + tag.type
try:
- print(tag.ndef.message.pretty())
- except Exception as e:
- print(e)
+ print tag.ndef.message.pretty()
+ except Exception, e:
+ print e
success = wps_tag_read(tag, not only_one)
if only_one and success:
global continue_loop
@@ -393,7 +393,7 @@
global arg_uuid
if arg_uuid is None:
wps_handover_init(llc)
- print("Exiting llcp_worker thread")
+ print "Exiting llcp_worker thread"
return
global srv
@@ -405,19 +405,19 @@
def llcp_startup(clf, llc):
global arg_uuid
if arg_uuid:
- print("Start LLCP server")
+ print "Start LLCP server"
global srv
srv = HandoverServer(llc)
if arg_uuid is "ap":
- print("Trying to handle WPS handover")
+ print "Trying to handle WPS handover"
srv.uuid = None
else:
- print("Trying to handle WPS handover with AP " + arg_uuid)
+ print "Trying to handle WPS handover with AP " + arg_uuid
srv.uuid = arg_uuid
return llc
def llcp_connected(llc):
- print("P2P LLCP connected")
+ print "P2P LLCP connected"
global wait_connection
wait_connection = False
global arg_uuid
@@ -426,7 +426,7 @@
srv.start()
else:
threading.Thread(target=llcp_worker, args=(llc,)).start()
- print("llcp_connected returning")
+ print "llcp_connected returning"
return True
@@ -482,7 +482,7 @@
try:
if not clf.open("usb"):
- print("Could not open connection with an NFC device")
+ print "Could not open connection with an NFC device"
raise SystemExit
if args.command == "write-config":
@@ -499,7 +499,7 @@
global continue_loop
while continue_loop:
- print("Waiting for a tag or peer to be touched")
+ print "Waiting for a tag or peer to be touched"
wait_connection = True
try:
if not clf.connect(rdwr={'on-connect': rdwr_connected},
@@ -507,8 +507,8 @@
'on-connect': llcp_connected},
terminate=terminate_loop):
break
- except Exception as e:
- print("clf.connect failed")
+ except Exception, e:
+ print "clf.connect failed"
global srv
if only_one and srv and srv.success: