Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honda Radarless: only forward buttons frame when controls are off. #1814

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions board/safety/safety_honda.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {

// FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW
// ensuring that only the cancel button press is sent (VAL 2) when controls are off.
// This avoids unintended engagements while still allowing resume spam
// This avoids unintended engagements while still allowing resume spam and button passthrough.
if ((addr == 0x296) && !controls_allowed && (bus == bus_buttons)) {
if (((GET_BYTE(to_send, 0) >> 5) & 0x7U) != 2U) {
tx = false;
Expand Down Expand Up @@ -412,7 +412,11 @@ static int honda_bosch_fwd_hook(int bus_num, int addr) {
int bus_fwd = -1;

if (bus_num == 0) {
bus_fwd = 2;
bool is_button_msg = (addr == 0x296);
bool block_msg = is_button_msg && controls_allowed && honda_bosch_radarless && !honda_bosch_long;
if (!block_msg) {
bus_fwd = 2;
}
}
if (bus_num == 2) {
bool is_lkas_msg = (addr == 0xE4) || (addr == 0xE5) || (addr == 0x33D) || (addr == 0x33DA) || (addr == 0x33DB);
Expand Down
13 changes: 13 additions & 0 deletions tests/safety/test_honda.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,19 @@ def setUp(self):
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_RADARLESS)
self.safety.init_tests()

# Test Add-on. Radarless must be able to send all buttons when controls_allowed
def test_spam_cancel_safety_check(self):
super().test_spam_cancel_safety_check()
for button in (Btn.MAIN, Btn.SET, Btn.NONE):
self.assertTrue(self._tx(self._button_msg(button, bus=self.BUTTONS_BUS)))

# Test that buttons don't forward when engaged.
def test_button_fwd_radarless(self):
self.safety.set_controls_allowed(True)
self.FWD_BLACKLISTED_ADDRS[0] = [0x296]
super().test_fwd_hook()
# reset for the following iterations
self.FWD_BLACKLISTED_ADDRS[0] = []

class TestHondaBoschRadarlessAltBrakeSafety(HondaPcmEnableBase, TestHondaBoschRadarlessSafetyBase, TestHondaBoschAltBrakeSafetyBase):
"""
Expand Down