diff --git a/pyusbtin/usbtin.py b/pyusbtin/usbtin.py index 679353b..6aa5e0e 100644 --- a/pyusbtin/usbtin.py +++ b/pyusbtin/usbtin.py @@ -274,7 +274,11 @@ def rx_thread(self): while self.rx_thread_state == USBtin.RX_THREAD_RUNNING: # fetch bytes if available rxcount = self.serial_port.inWaiting() - if rxcount > 0: + if rxcount == 0: + # if no data is available, sleep for 10ms to avoid busy looping + sleep(0.01) + continue + else: # fetch all data from serial buffer buf = self.serial_port.read(rxcount) if PY_VERSION == 2: