]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add AP mode NFC connection handover with wpa_supplicant/nfcpy
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 24 Feb 2013 08:57:06 +0000 (10:57 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 24 Feb 2013 08:57:06 +0000 (10:57 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/examples/wps-nfc.py

index 2d54cd24cb8c2bea5b0dc3e33a93d48a20ca56c5..9a6da5f974c62eb0cc56ba0d00b4d46f9a4c0958 100755 (executable)
@@ -86,6 +86,8 @@ def wpas_get_handover_sel(uuid):
     wpas = wpas_connect()
     if (wpas == None):
         return None
+    if uuid is None:
+        return wpas.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip().decode("hex")
     return wpas.request("NFC_GET_HANDOVER_SEL NDEF WPS-CR " + uuid).rstrip().decode("hex")
 
 
@@ -133,7 +135,10 @@ class HandoverServer(nfc.handover.HandoverServer):
 
 
 def wps_handover_resp(peer, uuid):
-    print "Trying to handle WPS handover with AP " + uuid
+    if uuid is None:
+        print "Trying to handle WPS handover"
+    else:
+        print "Trying to handle WPS handover with AP " + uuid
 
     srv = HandoverServer()
     srv.sent_carrier = None
@@ -375,6 +380,8 @@ def main():
             if isinstance(tag, nfc.DEP):
                 if arg_uuid is None:
                     wps_handover_init(tag)
+                elif arg_uuid is "ap":
+                    wps_handover_resp(tag, None)
                 else:
                     wps_handover_resp(tag, arg_uuid)
                 continue