Skip to content

Commit 5e133c1

Browse files
can_common: can_handle_bus_off_recovery(): send CAN_ERR_RESTARTED CAN error message
1 parent b9a20bf commit 5e133c1

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/can_common.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,20 @@ static bool can_state_change_pending(struct can_channel *channel, const uint32_t
310310
return true;
311311
}
312312

313-
static void can_handle_bus_off_recovery(USBD_GS_CAN_HandleTypeDef __maybe_unused *hcan, struct can_channel *channel)
313+
static void can_handle_bus_off_recovery(USBD_GS_CAN_HandleTypeDef *hcan, struct can_channel *channel)
314314
{
315315
can_drv_handle_bus_off_recovery(channel);
316+
317+
struct gs_host_frame_object *frame_object = gs_host_frame_object_get_locked(hcan);
318+
if (!frame_object)
319+
return;
320+
321+
struct gs_host_frame *frame = &frame_object->frame;
322+
can_prepare_error_frame(channel, frame);
323+
324+
frame->can_id |= CAN_ERR_RESTARTED;
325+
326+
list_add_tail_locked(&frame_object->list, &hcan->list_to_host);
316327
}
317328

318329
static bool can_bus_off_recovery_pending(const struct can_channel *channel)

0 commit comments

Comments
 (0)