Moved boardd loopback config to envvar.

old-commit-hash: 38aa03e0f7
commatwo_master
Jessy Diamond Exum 8 years ago
parent cf43e7d1bf
commit 4271fb34ab
  1. 13
      selfdrive/boardd/boardd.cc
  2. 2
      selfdrive/boardd/test_boardd_loopback.py

@ -23,8 +23,6 @@
#include "common/swaglog.h"
#include "common/timing.h"
//#define DEBUG_WITH_PANDA_LOOPBACK
int do_exit = 0;
libusb_context *ctx = NULL;
@ -33,6 +31,7 @@ pthread_mutex_t usb_lock;
bool spoofing_started = false;
bool fake_send = false;
bool loopback_can = false;
// double the FIFO size
#define RECV_SIZE (0x1000)
@ -54,9 +53,9 @@ bool usb_connect() {
err = libusb_claim_interface(dev_handle, 0);
if (err != 0) { return false; }
#ifdef DEBUG_WITH_PANDA_LOOPBACK
libusb_control_transfer(dev_handle, 0xc0, 0xe5, 1, 0, NULL, 0, TIMEOUT);
#endif
if(loopback_can) {
libusb_control_transfer(dev_handle, 0xc0, 0xe5, 1, 0, NULL, 0, TIMEOUT);
}
// power off ESP
libusb_control_transfer(dev_handle, 0xc0, 0xd9, 0, 0, NULL, 0, TIMEOUT);
@ -337,6 +336,10 @@ int main() {
fake_send = true;
}
if(getenv("BOARDD_LOOPBACK")){
loopback_can = true;
}
// init libusb
err = libusb_init(&ctx);
assert(err == 0);

@ -1,4 +1,4 @@
"""Enable the DEBUG_WITH_PANDA_LOOPBACK define in boardd.cc before test."""
"""Run boardd with the BOARDD_LOOPBACK envvar before running this test."""
import os
import random

Loading…
Cancel
Save