|
@@ -57,9 +57,18 @@ def main():
|
57
|
57
|
sinkinfo.product, sinkinfo.serial_number)
|
58
|
58
|
sys.exit(0)
|
59
|
59
|
|
60
|
|
- # If there's no device file specified, complain and exit
|
|
60
|
+ # If there's no device file specified, try to auto-detect
|
61
|
61
|
if not args.tty:
|
62
|
|
- parser.error('the following arguments are required: tty')
|
|
62
|
+ devices = list(pdbuddy.Sink.get_devices())
|
|
63
|
+ # If the wrong number of devices is present, complain and exit.
|
|
64
|
+ if len(devices) < 1:
|
|
65
|
+ print('No PD Buddy Sink devices found')
|
|
66
|
+ sys.exit(1)
|
|
67
|
+ elif len(devices) > 1:
|
|
68
|
+ print('Multiple PD Buddy Sink devices found')
|
|
69
|
+ sys.exit(1)
|
|
70
|
+ # Set args.tty to the auto-detected Sink
|
|
71
|
+ args.tty = devices[0].device
|
63
|
72
|
|
64
|
73
|
# Define configurations for testing
|
65
|
74
|
cfg_20v = pdbuddy.SinkConfig(status=pdbuddy.SinkStatus.VALID,
|