Re: [PATCH v3 13/13] can: slcan: extend the protocol with CAN state info

From: Marc Kleine-Budde
Date: Tue Jun 14 2022 - 03:23:10 EST


On 14.06.2022 08:29:57, Dario Binacchi wrote:
> > > + cmd[SLC_STATE_BE_TXCNT_LEN] = 0;
> > > + if (kstrtou32(cmd, 10, &txerr))
> > > + return;
> > > +
> > > + *cmd = 0;
> > > + cmd -= SLC_STATE_BE_RXCNT_LEN;
> > > + if (kstrtou32(cmd, 10, &rxerr))
> > > + return;
> >
> > Why do you parse TX first and then RX?
>
> Since adding the end-of-string character to the counter to be decoded
> invalidates the next one.
> If I had started from the rx counter, I would have found the
> transmission counter always at 0.

Thanks for the explanation.

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature