  #include "cereal/gen/cpp/car.capnp.h"
  #include "cereal/gen/cpp/log.capnp.h"
  
  // double the FIFO size
  #define RECV_SIZE (0x1000)
  #define TIMEOUT 0
  #define PANDA_BUS_CNT 4
  
  // copied from panda/board/main.c
  struct __attribute__((packed)) health_t {
 
</s> remove   // Append to the end of the out_vec, such that we can pass it to multiple pandas
  // We already insert space for all the messages here for speed
  size_t num_msg = recv / 0x10;
  out_vec.reserve(out_vec.size() + num_msg);

  // Populate messages
  for (int i = 0; i < num_msg; i++) {
    can_frame canData;
    if (data[i*4] & 4) {
      // extended
      canData.address = data[i*4] >> 3;
      //printf("got extended: %x\n", data[i*4] >> 3);
    } else {
      // normal
      canData.address = data[i*4] >> 21;
    }
    canData.busTime = data[i*4+1] >> 16;
    int len = data[i*4+1] & 0xF;
    canData.dat.assign((char *)&data[i*4+2], len);
    canData.src = ((data[i*4+1] >> 4) & 0xff) + bus_offset;
 </s> add   out_vec.reserve(out_vec.size() + (recv / CANPACKET_HEAD_SIZE)); </s> remove   uint32_t msg_cnt = 0;
  for (int i = 0; i < can_data_list.size(); i++) {
    auto cmsg = can_data_list[i];
 </s> add void Panda::can_send(capnp::List<cereal::CanData>::Reader can_data_list) {
  send.resize(72 * can_data_list.size()); // TODO: need to include 1 byte for each usb 64bytes frame

  int msg_count = 0;
  while (msg_count < can_data_list.size()) {
    uint32_t pos = 0;
    while (pos < 256) {
      if (msg_count == can_data_list.size()) { break; }
      auto cmsg = can_data_list[msg_count];

      // check if the message is intended for this panda
      uint8_t bus = cmsg.getSrc();
      if (bus < bus_offset || bus >= (bus_offset + PANDA_BUS_CNT)) {
        msg_count++;
        continue;
      }
      auto can_data = cmsg.getDat();
      uint8_t data_len_code = len_to_dlc(can_data.size());
      assert(can_data.size() <= (hw_type == cereal::PandaState::PandaType::RED_PANDA) ? 64 : 8);
      assert(can_data.size() == dlc_to_len[data_len_code]);

      *(uint32_t*)&send[pos+1] = (cmsg.getAddress() << 3);
      if (cmsg.getAddress() >= 0x800) {
        *(uint32_t*)&send[pos+1] |= (1 << 2);
      }
      send[pos] = data_len_code << 4 | ((bus - bus_offset) << 1);
      memcpy(&send[pos+5], can_data.begin(), can_data.size());
#define RECV_SIZE (0x4000)
  #include "cereal/gen/cpp/car.capnp.h"
  #include "cereal/gen/cpp/log.capnp.h"
  
  // double the FIFO size
#define RECV_SIZE (0x4000)
  #define TIMEOUT 0
  #define PANDA_BUS_CNT 4
  
  // copied from panda/board/main.c
  struct __attribute__((packed)) health_t {
keep keep keep keep replace keep keep keep keep keep
 New usb protocol for panda (#22752)

* first try

* move dlc_to_len

* panda switch to mailbox branch

* add bitstruct to pipfile

* bump panda and remove bitstruct

* few cleanups and fixes

* sanity check data.size == dlc_to_len

* check problem with test

* Revert "check problem with test"

This reverts commit b4855b7c12188d36d5d510e729344dab2cf21be9.

* clean

* revert Pipfile.lock

* that was an issue???

* fix crash

* ...

* include dlc_to_len from panda

* alph

* define macros for returned and rejected

* cleanup

* bump panda to current master 
selfdrive/boardd/panda.h