From 6202500f6fb8d871b3cf3e6249cfc9f0e8c89316 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 30 Nov 2013 16:49:04 +0200 Subject: [PATCH] WPS NFC: Logging level configuration to wps-nfc.py and wps-ap-nfc.py Signed-hostap: Jouni Malinen --- hostapd/wps-ap-nfc.py | 8 +++++++- wpa_supplicant/examples/wps-nfc.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hostapd/wps-ap-nfc.py b/hostapd/wps-ap-nfc.py index 8fe7b9e17..b9e233eb1 100755 --- a/hostapd/wps-ap-nfc.py +++ b/hostapd/wps-ap-nfc.py @@ -17,7 +17,6 @@ import nfc.llcp import nfc.handover import logging -logging.basicConfig() import wpaspy @@ -214,6 +213,11 @@ def main(): clf = nfc.ContactlessFrontend() parser = argparse.ArgumentParser(description='nfcpy to hostapd integration for WPS NFC operations') + parser.add_argument('-d', const=logging.DEBUG, default=logging.INFO, + action='store_const', dest='loglevel', + help='verbose debug output') + parser.add_argument('-q', const=logging.WARNING, action='store_const', + dest='loglevel', help='be quiet') parser.add_argument('--only-one', '-1', action='store_true', help='run only one operation and exit') parser.add_argument('--no-wait', action='store_true', @@ -229,6 +233,8 @@ def main(): global no_wait no_wait = args.no_wait + logging.basicConfig(level=args.loglevel) + try: if not clf.open("usb"): print "Could not open connection with an NFC device" diff --git a/wpa_supplicant/examples/wps-nfc.py b/wpa_supplicant/examples/wps-nfc.py index 0680be609..c349b4698 100755 --- a/wpa_supplicant/examples/wps-nfc.py +++ b/wpa_supplicant/examples/wps-nfc.py @@ -20,7 +20,6 @@ import nfc.llcp import nfc.handover import logging -logging.basicConfig() import wpaspy @@ -374,6 +373,11 @@ def main(): clf = nfc.ContactlessFrontend() parser = argparse.ArgumentParser(description='nfcpy to wpa_supplicant integration for WPS NFC operations') + parser.add_argument('-d', const=logging.DEBUG, default=logging.INFO, + action='store_const', dest='loglevel', + help='verbose debug output') + parser.add_argument('-q', const=logging.WARNING, action='store_const', + dest='loglevel', help='be quiet') parser.add_argument('--only-one', '-1', action='store_true', help='run only one operation and exit') parser.add_argument('--no-wait', action='store_true', @@ -397,6 +401,8 @@ def main(): global no_wait no_wait = args.no_wait + logging.basicConfig(level=args.loglevel) + try: if not clf.open("usb"): print "Could not open connection with an NFC device"