diff --git a/gpib_server.py b/gpib_server.py index 23fbe377..062d9290 100644 --- a/gpib_server.py +++ b/gpib_server.py @@ -63,6 +63,9 @@ """ +KNOWN_DEVICE_TYPES = ('GPIB', 'TCPIP', 'USB') + + class GPIBBusServer(LabradServer): """Provides direct access to GPIB-enabled devices.""" name = '%LABRADNODE% GPIB Bus' @@ -107,15 +110,9 @@ def refreshDevices(self): deletions = set(self.devices.keys()) - set(addresses) for addr in additions: try: - if addr.startswith('GPIB'): - instName = addr - elif addr.startswith('TCPIP'): - instName = addr - elif addr.startswith('USB'): - instName = addr + '::INSTR' - else: + if not addr.startswith(KNOWN_DEVICE_TYPES): continue - instr = rm.get_instrument(instName) + instr = rm.get_instrument(addr) instr.write_termination = '' instr.clear() if addr.endswith('SOCKET'):