diff --git a/selfdrive/boardd/panda.cc b/selfdrive/boardd/panda.cc index 0bc72cff63..8f9525fb61 100644 --- a/selfdrive/boardd/panda.cc +++ b/selfdrive/boardd/panda.cc @@ -118,6 +118,10 @@ int Panda::usb_read(uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned int err; const uint8_t bmRequestType = LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE; + if (!connected){ + return LIBUSB_ERROR_NO_DEVICE; + } + std::lock_guard lk(usb_lock); do { err = libusb_control_transfer(dev_handle, bmRequestType, bRequest, wValue, wIndex, data, wLength, timeout);