Skip to content

Commit 2299ecf

Browse files
authored
Block 0xe5 (Honda Bosch) at the panda/uno. Only allow static values. (#515)
* Safety for static 0xe5 Passes Misra test * Add e5 to test. * Readd
1 parent 3517306 commit 2299ecf

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

board/safety/safety_honda.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// brake rising edge
88
// brake > 0mph
99
const AddrBus HONDA_N_TX_MSGS[] = {{0xE4, 0}, {0x194, 0}, {0x1FA, 0}, {0x200, 0}, {0x30C, 0}, {0x33D, 0}};
10-
const AddrBus HONDA_BG_TX_MSGS[] = {{0xE4, 2}, {0x296, 0}, {0x33D, 2}}; // Bosch Giraffe
11-
const AddrBus HONDA_BH_TX_MSGS[] = {{0xE4, 0}, {0x296, 1}, {0x33D, 0}}; // Bosch Harness
10+
const AddrBus HONDA_BG_TX_MSGS[] = {{0xE4, 2}, {0xE5, 2}, {0x296, 0}, {0x33D, 2}}; // Bosch Giraffe
11+
const AddrBus HONDA_BH_TX_MSGS[] = {{0xE4, 0}, {0xE5, 0}, {0x296, 1}, {0x33D, 0}}; // Bosch Harness
1212

1313
// Roughly calculated using the offsets in openpilot +5%:
1414
// In openpilot: ((gas1_norm + gas2_norm)/2) > 15
@@ -238,6 +238,13 @@ static int honda_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
238238
}
239239
}
240240

241+
// Bosch supplemental control check
242+
if (addr == 0xE5) {
243+
if ((GET_BYTES_04(to_send) != 0x10800004) || ((GET_BYTES_48(to_send) & 0x00FFFFFF) != 0x0)) {
244+
tx = 0;
245+
}
246+
}
247+
241248
// GAS: safety check
242249
if (addr == 0x200) {
243250
if (!current_controls_allowed) {
@@ -322,7 +329,7 @@ static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
322329
}
323330
if (bus_num == bus_rdr_cam) {
324331
int addr = GET_ADDR(to_fwd);
325-
int is_lkas_msg = (addr == 0xE4) || (addr == 0x33D);
332+
int is_lkas_msg = (addr == 0xE4) || (addr == 0xE5) || (addr == 0x33D);
326333
if (!is_lkas_msg) {
327334
bus_fwd = bus_rdr_car;
328335
}

tests/safety/test_honda.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ def test_tx_hook_on_interceptor_pressed(self):
248248

249249

250250
class TestHondaBoschHarnessSafety(TestHondaSafety):
251-
TX_MSGS = [[0xE4, 0], [0x296, 1], [0x33D, 0]] # Bosch Harness
251+
TX_MSGS = [[0xE4, 0], [0xE5, 0], [0x296, 1], [0x33D, 0]] # Bosch Harness
252252
STANDSTILL_THRESHOLD = 0
253253
RELAY_MALFUNCTION_ADDR = 0xE4
254254
RELAY_MALFUNCTION_BUS = 0
255-
FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0x33D]}
255+
FWD_BLACKLISTED_ADDRS = {2: [0xE4, 0xE5, 0x33D]}
256256
FWD_BUS_LOOKUP = {0: 2, 2: 0}
257257

258258
PT_BUS = 1
@@ -290,11 +290,11 @@ def test_alt_disengage_on_brake(self):
290290

291291

292292
class TestHondaBoschGiraffeSafety(TestHondaBoschHarnessSafety):
293-
TX_MSGS = [[0xE4, 2], [0x296, 0], [0x33D, 2]] # Bosch Giraffe
293+
TX_MSGS = [[0xE4, 2], [0xE5, 2], [0x296, 0], [0x33D, 2]] # Bosch Giraffe
294294
STANDSTILL_THRESHOLD = 0
295295
RELAY_MALFUNCTION_ADDR = 0xE4
296296
RELAY_MALFUNCTION_BUS = 2
297-
FWD_BLACKLISTED_ADDRS = {1: [0xE4, 0x33D]}
297+
FWD_BLACKLISTED_ADDRS = {1: [0xE4, 0xE5, 0x33D]}
298298
FWD_BUS_LOOKUP = {1: 2, 2: 1}
299299

300300
PT_BUS = 0

0 commit comments

Comments
 (0)