      .param1 = param1,
      .param2 = param2,
      .length = 0
    };
    return spi_transfer_retry(0, (uint8_t *) &packet, sizeof(packet), NULL, 0);
  }
  
  int PandaSpiHandle::control_read(uint8_t request, uint16_t param1, uint16_t param2, unsigned char *data, uint16_t length, unsigned int timeout) {
    LockEx lock(spi_fd, hw_lock);
    ControlPacket_t packet = {
 
</s> remove   LockEx lock(spi_fd, hw_lock);
 </s> add  </s> remove const int SPI_MAX_RETRIES = 5;
const int SPI_ACK_TIMEOUT = 50; // milliseconds
 </s> add const int SPI_ACK_TIMEOUT = 500; // milliseconds </s> remove   ret = control_read(0xc3, 0, 0, uid, uid_len);
 </s> add   ret = control_read(0xc3, 0, 0, uid, uid_len, 1000); </s> remove   int spi_transfer_retry(uint8_t endpoint, uint8_t *tx_data, uint16_t tx_len, uint8_t *rx_data, uint16_t max_rx_len);
 </s> add   int spi_transfer_retry(uint8_t endpoint, uint8_t *tx_data, uint16_t tx_len, uint8_t *rx_data, uint16_t max_rx_len, unsigned int timeout);
  return spi_transfer_retry(0, (uint8_t *) &packet, sizeof(packet), NULL, 0, timeout);
      .param1 = param1,
      .param2 = param2,
      .length = 0
    };
  return spi_transfer_retry(0, (uint8_t *) &packet, sizeof(packet), NULL, 0, timeout);
  }
  
  int PandaSpiHandle::control_read(uint8_t request, uint16_t param1, uint16_t param2, unsigned char *data, uint16_t length, unsigned int timeout) {
    LockEx lock(spi_fd, hw_lock);
    ControlPacket_t packet = {
keep keep keep keep replace keep keep keep keep keep
 boardd: handle nack on tx buffer full (#28241)

* boardd: handle nack on tx buffer full

* print pandaStates

* rx buffer too small

* connect timeout

---------

Co-authored-by: Comma Device <device@comma.ai> 
selfdrive/boardd/spi.cc