WPS NFC: Logging level configuration to wps-nfc.py and wps-ap-nfc.py

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-11-30 16:49:04 +02:00 committed by Jouni Malinen
parent 1f1b5b31d7
commit 6202500f6f
2 changed files with 14 additions and 2 deletions

View file

@ -17,7 +17,6 @@ import nfc.llcp
import nfc.handover import nfc.handover
import logging import logging
logging.basicConfig()
import wpaspy import wpaspy
@ -214,6 +213,11 @@ def main():
clf = nfc.ContactlessFrontend() clf = nfc.ContactlessFrontend()
parser = argparse.ArgumentParser(description='nfcpy to hostapd integration for WPS NFC operations') 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', parser.add_argument('--only-one', '-1', action='store_true',
help='run only one operation and exit') help='run only one operation and exit')
parser.add_argument('--no-wait', action='store_true', parser.add_argument('--no-wait', action='store_true',
@ -229,6 +233,8 @@ def main():
global no_wait global no_wait
no_wait = args.no_wait no_wait = args.no_wait
logging.basicConfig(level=args.loglevel)
try: try:
if not clf.open("usb"): if not clf.open("usb"):
print "Could not open connection with an NFC device" print "Could not open connection with an NFC device"

View file

@ -20,7 +20,6 @@ import nfc.llcp
import nfc.handover import nfc.handover
import logging import logging
logging.basicConfig()
import wpaspy import wpaspy
@ -374,6 +373,11 @@ def main():
clf = nfc.ContactlessFrontend() clf = nfc.ContactlessFrontend()
parser = argparse.ArgumentParser(description='nfcpy to wpa_supplicant integration for WPS NFC operations') 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', parser.add_argument('--only-one', '-1', action='store_true',
help='run only one operation and exit') help='run only one operation and exit')
parser.add_argument('--no-wait', action='store_true', parser.add_argument('--no-wait', action='store_true',
@ -397,6 +401,8 @@ def main():
global no_wait global no_wait
no_wait = args.no_wait no_wait = args.no_wait
logging.basicConfig(level=args.loglevel)
try: try:
if not clf.open("usb"): if not clf.open("usb"):
print "Could not open connection with an NFC device" print "Could not open connection with an NFC device"