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

Timeout in seconds · python-ivi/python-usbtmc@fe150d2 · GitHub

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

Commit fe150d2

Browse files
committed
Timeout in seconds
1 parent 9313b85 commit fe150d2

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎usbtmc/usbtmc.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def __init__(self, *args, **kwargs):
186186

187187
self.max_transfer_size = 1024*1024
188188

189-
self.timeout = 1000
189+
self.timeout = 1.0
190190

191191
self.bulk_in_ep = None
192192
self.bulk_out_ep = None
@@ -377,7 +377,7 @@ def get_capabilities(self):
377377
0x0000,
378378
self.iface.index,
379379
0x0018,
380-
timeout=self.timeout)
380+
timeout=int(self.timeout*1000))
381381
if (b[0] == USBTMC_STATUS_SUCCESS):
382382
self.bcdUSBTMC = (b[3] << 8) + b[2]
383383
self.support_pulse = b[4] & 4 != 0
@@ -412,7 +412,7 @@ def pulse(self):
412412
0x0000,
413413
self.iface.index,
414414
0x0001,
415-
timeout=self.timeout)
415+
timeout=int(self.timeout*1000))
416416
if (b[0] != USBTMC_STATUS_SUCCESS):
417417
raise UsbtmcException("Pulse failed", 'pulse')
418418

@@ -505,7 +505,7 @@ def read_raw(self, num=-1):
505505
req = self.pack_dev_dep_msg_in_header(read_len, term_char)
506506
self.bulk_out_ep.write(req)
507507

508-
resp = self.bulk_in_ep.read(read_len+USBTMC_HEADER_SIZE+3, timeout = self.timeout)
508+
resp = self.bulk_in_ep.read(read_len+USBTMC_HEADER_SIZE+3, timeout = int(self.timeout*1000))
509509

510510
if sys.version_info >= (3, 0):
511511
resp = resp.tobytes()
@@ -596,7 +596,7 @@ def read_stb(self):
596596
rstb_btag,
597597
self.iface.index,
598598
0x0003,
599-
timeout=self.timeout)
599+
timeout=int(self.timeout*1000))
600600
if (b[0] == USBTMC_STATUS_SUCCESS):
601601
# check btag
602602
if rstb_btag != b[1]:
@@ -606,7 +606,7 @@ def read_stb(self):
606606
return b[2]
607607
else:
608608
# read response from interrupt channel
609-
resp = self.interrupt_in_ep.read(2, timeout=self.timeout)
609+
resp = self.interrupt_in_ep.read(2, timeout=int(self.timeout*1000))
610610
if resp[0] != rstb_btag + 128:
611611
raise UsbtmcException("Read status byte btag mismatch", 'read_stb')
612612
else:
@@ -642,7 +642,7 @@ def clear(self):
642642
0x0000,
643643
self.iface.index,
644644
0x0001,
645-
timeout=self.timeout)
645+
timeout=int(self.timeout*1000))
646646
if (b[0] == USBTMC_STATUS_SUCCESS):
647647
# Initiate clear succeeded, wait for completion
648648
while True:
@@ -653,7 +653,7 @@ def clear(self):
653653
0x0000,
654654
self.iface.index,
655655
0x0002,
656-
timeout=self.timeout)
656+
timeout=int(self.timeout*1000))
657657
if (b[0] == USBTMC_STATUS_PENDING):
658658
time.sleep(0.1)
659659
else:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL