From d4b17ab3156f53fc4f9346c822ed7a1c02f3ebdb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 22 Sep 2014 13:36:55 +0300 Subject: Support filtering on multiple addresses If the -a argument is specified multiple time each address will generate a match when filtering URBs. Signed-off-by: Laurent Pinchart --- usbmon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usbmon.py b/usbmon.py index 23d694b..0bbab3f 100755 --- a/usbmon.py +++ b/usbmon.py @@ -694,7 +694,7 @@ def main(argv): opts = getopt.getopt(argv[1:], 'a:c:C:d:e:f:ho:') outf = sys.stdout - addr = -1 + addr = [] devclass = 'std' endp = -1 capture = None @@ -703,7 +703,7 @@ def main(argv): for opt in opts[0]: if opt[0] == '-a': - addr = int(opt[1]) + addr.append(int(opt[1], 0)) elif opt[0] == '-c': capture = [int(v) for v in opt[1].split('-')] elif opt[0] == '-C': @@ -739,7 +739,7 @@ def main(argv): raise index += 1 - if addr != -1 and urb.addr != addr: + if urb.addr not in addr: continue if endp != -1 and urb.endp != endp: continue -- cgit v1.2.3