Browse Source

WPS NFC: nfcpy script to use new connection handover design

Fetch a carrier record from wpa_supplicant instead of full handover
request. This makes it easier for external programs to build handover
request messages with multiple alternative carriers.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 11 years ago
parent
commit
c209dd1108
1 changed files with 2 additions and 8 deletions
  1. 2 8
      wpa_supplicant/examples/wps-nfc.py

+ 2 - 8
wpa_supplicant/examples/wps-nfc.py

@@ -10,7 +10,6 @@ import os
 import sys
 import time
 import random
-import StringIO
 import threading
 import argparse
 
@@ -164,16 +163,11 @@ def wps_handover_init(llc):
         print "Could not get handover request carrier record from wpa_supplicant"
         return
     print "Handover request carrier record from wpa_supplicant: " + data.encode("hex")
-    record = nfc.ndef.Record()
-    f = StringIO.StringIO(data)
-    record._read(f)
-    record = nfc.ndef.HandoverCarrierRecord(record)
-    print "Parsed handover request carrier record:"
-    print record.pretty()
 
     message = nfc.ndef.HandoverRequestMessage(version="1.2")
     message.nonce = random.randint(0, 0xffff)
-    message.add_carrier(record, "active")
+    datamsg = nfc.ndef.Message(data)
+    message.add_carrier(datamsg[0], "active", datamsg[1:])
 
     print "Handover request:"
     print message.pretty()