FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add initial implementation of list_devices · python-ivi/python-ivi@6b75caa · GitHub

This repository was archived by the owner on Feb 2, 2026. It is now read-only.
/ python-ivi Public archive

Commit 6b75caa

Browse files
committed
Add initial implementation of list_devices
1 parent 8dece66 commit 6b75caa

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎ivi/ivi.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,40 @@ def help(obj=None, itm=None, complete=False, indent=0):
753753
"""))
754754

755755

756+
def list_devices():
757+
devs = []
758+
759+
if 'vxi11' in globals():
760+
# search for VXI11 devices
761+
try:
762+
devs.extend(["TCPIP::%s::INSTR" % h for h in vxi11.list_devices()])
763+
except:
764+
pass
765+
766+
if 'usbtmc' in globals():
767+
# search for USBTMC devices
768+
try:
769+
for dev in usbtmc.list_devices():
770+
idVendor = dev.idVendor
771+
idProduct = dev.idProduct
772+
iSerial = None
773+
# attempt to read serial number
774+
try:
775+
iSerial = dev.serial_number
776+
except:
777+
pass
778+
# append formatted resource string to list
779+
if iSerial is None:
780+
devs.append("USB::%d::%d::INSTR" % (idVendor, idProduct))
781+
else:
782+
devs.append("USB::%d::%d::%s::INSTR" % (idVendor, idProduct, iSerial))
783+
pass
784+
except:
785+
pass
786+
787+
return devs
788+
789+
756790
class DriverOperation(IviContainer):
757791
"Inherent IVI methods for driver operation"
758792

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL