lkml.org 
[lkml]   [2022]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 13/13] can: slcan: extend the protocol with CAN state info
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 |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-06-14 09:25    [W:0.138 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site