|
@@ -42,11 +42,25 @@ def output_verify(sink):
|
42
|
42
|
def main():
|
43
|
43
|
# Make the argument parser
|
44
|
44
|
parser = argparse.ArgumentParser(description='Test a PD Buddy Sink')
|
45
|
|
- parser.add_argument('tty', metavar='tty', type=str, help="the Sink's tty")
|
|
45
|
+ parser.add_argument('tty', metavar='tty', type=str, nargs='?',
|
|
46
|
+ help="the Sink's tty")
|
|
47
|
+ parser.add_argument('-l', '--list-devices', action='store_true',
|
|
48
|
+ help='list connected PD Buddy Sinks and exit')
|
46
|
49
|
|
47
|
50
|
# Parse arguments
|
48
|
51
|
args = parser.parse_args()
|
49
|
52
|
|
|
53
|
+ # If asked to, list devices and exit
|
|
54
|
+ if args.list_devices:
|
|
55
|
+ for sinkinfo in pdbuddy.Sink.get_devices():
|
|
56
|
+ print(sinkinfo.device, '-', sinkinfo.manufacturer,
|
|
57
|
+ sinkinfo.product, sinkinfo.serial_number)
|
|
58
|
+ sys.exit(0)
|
|
59
|
+
|
|
60
|
+ # If there's no device file specified, complain and exit
|
|
61
|
+ if not args.tty:
|
|
62
|
+ parser.error('the following arguments are required: tty')
|
|
63
|
+
|
50
|
64
|
# Define configurations for testing
|
51
|
65
|
cfg_20v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|
52
|
66
|
flags=pdbuddy.SinkFlags.NONE, v=20000, i=1000)
|