python: non-zero default timeout (#1279)

* non-zero default timeout

* respect timeout in spi
This commit is contained in:
Adeeb Shihadeh
2023-03-07 14:44:10 -08:00
committed by GitHub
parent df7952ec13
commit deaad254d9
3 changed files with 29 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
import struct
from typing import List
from .base import BaseHandle, BaseSTBootloaderHandle
from .base import BaseHandle, BaseSTBootloaderHandle, TIMEOUT
from .constants import McuType
class PandaUsbHandle(BaseHandle):
@@ -11,16 +11,16 @@ class PandaUsbHandle(BaseHandle):
def close(self):
self._libusb_handle.close()
def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = 0):
def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = TIMEOUT):
return self._libusb_handle.controlWrite(request_type, request, value, index, data, timeout)
def controlRead(self, request_type: int, request: int, value: int, index: int, length: int, timeout: int = 0):
def controlRead(self, request_type: int, request: int, value: int, index: int, length: int, timeout: int = TIMEOUT):
return self._libusb_handle.controlRead(request_type, request, value, index, length, timeout)
def bulkWrite(self, endpoint: int, data: List[int], timeout: int = 0) -> int:
def bulkWrite(self, endpoint: int, data: List[int], timeout: int = TIMEOUT) -> int:
return self._libusb_handle.bulkWrite(endpoint, data, timeout) # type: ignore
def bulkRead(self, endpoint: int, length: int, timeout: int = 0) -> bytes:
def bulkRead(self, endpoint: int, length: int, timeout: int = TIMEOUT) -> bytes:
return self._libusb_handle.bulkRead(endpoint, length, timeout) # type: ignore