bin/gpib_detect

changeset 70
4cd8edd2b4e7
parent 65
10d218fbf86f
child 79
b8eec4f9db52
equal deleted inserted replaced
69:879083ec2355 70:4cd8edd2b4e7
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

mercurial