From 2b1d1e6d92463e7b0cd8c33f5ffeaf819482b45a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 3 Jun 2021 15:05:40 +0200 Subject: [PATCH] firmware: octsimtest: Fix disabling the card_insert signal Back in I8c9b0c3d862a967832134b24252577739182da62 we added support for enabling the card_insert signal, but not for explicit disable of it. Let's fix that. Change-Id: I6f32bde60674119c9912e51059a53b5ee74d074a --- firmware/libboard/octsimtest/source/board_octsimtest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/firmware/libboard/octsimtest/source/board_octsimtest.c b/firmware/libboard/octsimtest/source/board_octsimtest.c index 1c6a2786..5dff0463 100644 --- a/firmware/libboard/octsimtest/source/board_octsimtest.c +++ b/firmware/libboard/octsimtest/source/board_octsimtest.c @@ -103,8 +103,13 @@ void board_set_card_insert(struct cardem_inst *ci, bool card_insert) * the sim-present signal of the respective slot */ if (mcp2317_present) { - /* we must enable card-presence of the active slot and disable it on all others */ - mcp23017_set_output_a(MCP23017_ADDRESS, (1 << s)); + if (card_insert) { + /* we must enable card-presence of the active slot and disable it on all others */ + mcp23017_set_output_a(MCP23017_ADDRESS, (1 << s)); + } else { + /* we disable all card insert signals */ + mcp23017_set_output_a(MCP23017_ADDRESS, 0); + } } else { TRACE_WARNING("No MCP23017 present; cannot set CARD_INSERT\r\n"); }