| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9313b85 commit fe150d2
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -186,7 +186,7 @@ def __init__(self, *args, **kwargs): | |||
| 186 | 186 | ||
| 187 | 187 | self.max_transfer_size = 1024*1024 | |
| 188 | 188 | ||
| 189 | - self.timeout = 1000 | ||
| 189 | + self.timeout = 1.0 | ||
| 190 | 190 | ||
| 191 | 191 | self.bulk_in_ep = None | |
| 192 | 192 | self.bulk_out_ep = None | |
@@ -377,7 +377,7 @@ def get_capabilities(self): | |||
| 377 | 377 | 0x0000, | |
| 378 | 378 | self.iface.index, | |
| 379 | 379 | 0x0018, | |
| 380 | - timeout=self.timeout) | ||
| 380 | + timeout=int(self.timeout*1000)) | ||
| 381 | 381 | if (b[0] == USBTMC_STATUS_SUCCESS): | |
| 382 | 382 | self.bcdUSBTMC = (b[3] << 8) + b[2] | |
| 383 | 383 | self.support_pulse = b[4] & 4 != 0 | |
@@ -412,7 +412,7 @@ def pulse(self): | |||
| 412 | 412 | 0x0000, | |
| 413 | 413 | self.iface.index, | |
| 414 | 414 | 0x0001, | |
| 415 | - timeout=self.timeout) | ||
| 415 | + timeout=int(self.timeout*1000)) | ||
| 416 | 416 | if (b[0] != USBTMC_STATUS_SUCCESS): | |
| 417 | 417 | raise UsbtmcException("Pulse failed", 'pulse') | |
| 418 | 418 | ||
@@ -505,7 +505,7 @@ def read_raw(self, num=-1): | |||
| 505 | 505 | req = self.pack_dev_dep_msg_in_header(read_len, term_char) | |
| 506 | 506 | self.bulk_out_ep.write(req) | |
| 507 | 507 | ||
| 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)) | ||
| 509 | 509 | ||
| 510 | 510 | if sys.version_info >= (3, 0): | |
| 511 | 511 | resp = resp.tobytes() | |
@@ -596,7 +596,7 @@ def read_stb(self): | |||
| 596 | 596 | rstb_btag, | |
| 597 | 597 | self.iface.index, | |
| 598 | 598 | 0x0003, | |
| 599 | - timeout=self.timeout) | ||
| 599 | + timeout=int(self.timeout*1000)) | ||
| 600 | 600 | if (b[0] == USBTMC_STATUS_SUCCESS): | |
| 601 | 601 | # check btag | |
| 602 | 602 | if rstb_btag != b[1]: | |
@@ -606,7 +606,7 @@ def read_stb(self): | |||
| 606 | 606 | return b[2] | |
| 607 | 607 | else: | |
| 608 | 608 | # 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)) | ||
| 610 | 610 | if resp[0] != rstb_btag + 128: | |
| 611 | 611 | raise UsbtmcException("Read status byte btag mismatch", 'read_stb') | |
| 612 | 612 | else: | |
@@ -642,7 +642,7 @@ def clear(self): | |||
| 642 | 642 | 0x0000, | |
| 643 | 643 | self.iface.index, | |
| 644 | 644 | 0x0001, | |
| 645 | - timeout=self.timeout) | ||
| 645 | + timeout=int(self.timeout*1000)) | ||
| 646 | 646 | if (b[0] == USBTMC_STATUS_SUCCESS): | |
| 647 | 647 | # Initiate clear succeeded, wait for completion | |
| 648 | 648 | while True: | |
@@ -653,7 +653,7 @@ def clear(self): | |||
| 653 | 653 | 0x0000, | |
| 654 | 654 | self.iface.index, | |
| 655 | 655 | 0x0002, | |
| 656 | - timeout=self.timeout) | ||
| 656 | + timeout=int(self.timeout*1000)) | ||
| 657 | 657 | if (b[0] == USBTMC_STATUS_PENDING): | |
| 658 | 658 | time.sleep(0.1) | |
| 659 | 659 | else: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments