17 opt.add_option('-d', '--device', default="/dev/ttyUSB0", |
17 opt.add_option('-d', '--device', default="/dev/ttyUSB0", |
18 dest="device", |
18 dest="device", |
19 help="Device of connected Prologix GPIB bundle [/dev/ttyUSB0]",) |
19 help="Device of connected Prologix GPIB bundle [/dev/ttyUSB0]",) |
20 options, argv = opt.parse_args(sys.argv) |
20 options, argv = opt.parse_args(sys.argv) |
21 |
21 |
|
22 print "Detecting GPIB devices on the bus. Please wait until completion." |
22 c = GPIBController(device=options.device) |
23 c = GPIBController(device=options.device) |
23 signal.signal(signal.SIGINT, c.stop) |
24 signal.signal(signal.SIGINT, c.stop) |
24 signal.signal(signal.SIGQUIT, c.stop) |
25 signal.signal(signal.SIGQUIT, c.stop) |
25 |
26 |
26 time.sleep(1) |
27 time.sleep(1) |
27 devices = c.detect_devices() |
28 devices = c.detect_devices() |
28 print "Found devices:" |
29 c.stop() |
|
30 |
|
31 print "GPIB devices:" |
29 for k in sorted(devices.keys()): |
32 for k in sorted(devices.keys()): |
30 print "%-3d: %s"%(k, devices[k]) |
33 print "%-3d: %s"%(k, devices[k]) |
31 c.stop() |
|
32 |
34 |
33 if __name__ == "__main__": |
35 if __name__ == "__main__": |
34 main() |
36 main() |
35 |
37 |