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

[Backport v3.5-branch] drivers: can: shell: fully initialize frame before sending and use correct DLC in output #73321

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/can/can_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ static int cmd_can_send(const struct shell *sh, size_t argc, char **argv)
const struct device *dev = device_get_binding(argv[1]);
static unsigned int frame_counter;
unsigned int frame_no;
struct can_frame frame;
struct can_frame frame = { 0 };
uint32_t max_id;
int argidx = 2;
uint32_t val;
Expand Down Expand Up @@ -665,7 +665,7 @@ static int cmd_can_send(const struct shell *sh, size_t argc, char **argv)
(frame.flags & CAN_FRAME_RTR) != 0 ? 1 : 0,
(frame.flags & CAN_FRAME_FDF) != 0 ? 1 : 0,
(frame.flags & CAN_FRAME_BRS) != 0 ? 1 : 0,
can_dlc_to_bytes(frame.dlc));
frame.dlc);

err = can_send(dev, &frame, K_NO_WAIT, can_shell_tx_callback, UINT_TO_POINTER(frame_no));
if (err != 0) {
Expand Down
Loading