Moved boardd loopback config to envvar.

old-commit-hash: 38aa03e0f7f858b38ffd7a1c9f392e6abd135795
This commit is contained in:
Jessy Diamond Exum
2017-07-11 21:57:16 -07:00
parent cf43e7d1bf
commit 4271fb34ab
2 changed files with 9 additions and 6 deletions

View File

@@ -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);

View File

@@ -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