Hi Peter,
I just created the PR

Thanks

Javier Casas Marín
Geotab

Senior Embedded Systems Developer

Direct
Toll-free

Visit


+34 900 535 371
www.geotab.com/es

Twitter <https://twitter.com/geotab> | Facebook
<https://www.facebook.com/Geotab> | YouTube
<https://www.youtube.com/user/MyGeotab> | LinkedIn
<https://www.linkedin.com/company/geotab/>


On Fri, Mar 7, 2025 at 8:48 AM Peter van der Perk <peter.vanderp...@nxp.com>
wrote:

> HI Javier,
>
> I'm on an older branch as well thus didn't have this issue yet.
> But looking on the code it's reverting a regression.
>
> Feel free to send in a PR I'll review it.
>
> Yours sincerely,
>
> Peter van der Perk
>
> -----Original Message-----
> From: Javier Casas Marin <javierca...@geotab.com.INVALID>
> Sent: Thursday, March 6, 2025 5:25 PM
> To: dev@nuttx.apache.org
> Subject: Re: Re: socket CAN timestamp missing
>
>
> Hi Peter,
> I was thinking about that, the thing is that we are using Nuttx as a
> submodule in our system and we haven't updated it in a while so right now
> we are using a quite older version and I'm not able to test the fix in
> master. I can send a PR but I don't think it will be approved without the
> proper testing. WDYT?
>
>
> Thanks
>
> Javier Casas Marín
> Geotab
>
> Senior Embedded Systems Developer
>
> Direct
> Toll-free
>
> Visit
>
>
> +34 900 535 371
> http://www.geotab.com/es
>
> Twitter <https://twitter.com/geotab> | Facebook <
> https://www.facebook.com/Geotab> | YouTube <
> https://www.youtube.com/user/MyGeotab> | LinkedIn <
> https://www.linkedin.com/company/geotab/>
>
>
> On Thu, Mar 6, 2025 at 3:24 PM Peter van der Perk <
> peter.vanderp...@nxp.com>
> wrote:
>
> > Hi Javier,
> >
> > Good to hear.
> > If it working fine for you with the fix, feel free to send a PR into
> > upstream NuttX.
> >
> > Yours sincerely,
> >
> > Peter van der Perk
> >
> > -----Original Message-----
> > From: Javier Casas Marin <javierca...@geotab.com.INVALID>
> > Sent: Thursday, March 6, 2025 2:59 PM
> > To: dev@nuttx.apache.org
> > Subject: Re: socket CAN timestamp missing
> >
> > Caution: This is an external email. Please take care when clicking
> > links or opening attachments. When in doubt, report the message using
> > the 'Report this email' button
> >
> >
> > Hi Peter,
> >
> > Thanks for answering. You are right, moving the timestamp generation
> > back up fixes the issue and it makes more sense to have the code
> > there, before branching the code flow, than having it duplicated in both
> paths.
> >
> > Thanks!
> >
> > Javier Casas Marín
> > Geotab
> >
> > Senior Embedded Systems Developer
> >
> > Direct
> > Toll-free
> >
> > Visit
> >
> >
> > +34 900 535 371
> > http://www.g/
> > eotab.com%2Fes&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7C23945522e0f
> > 44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638
> > 768751012827986%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOi
> > IwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%
> > 7C%7C&sdata=Pge79WK1%2BDR8gT89%2F3pYuidmabCKy5PdvruVsXdd3K0%3D&reserve
> > d=0
> >
> > Twitter
> > <https://twi/
> > tter.com%2Fgeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7C23945522
> > e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> > 638768751012839631%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlY
> > iOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%
> > 7C%7C%7C&sdata=IundPq6DfqLT8WuzW5vUVdqQcCllEtW17pIpkplEFHk%3D&reserved
> > =0> | Facebook <
> > https://www/.
> > facebook.com%2FGeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7C2394
> > 5522e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C
> > 0%7C638768751012851628%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWU
> > sIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%
> > 7C0%7C%7C%7C&sdata=POXP5B3LabUVJc00c1Oj6Y3Br%2Ft%2F15FITbSVSVEVyPA%3D&
> > reserved=0> | YouTube <
> > https://www/.
> > youtube.com%2Fuser%2FMyGeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.co
> > m%7C23945522e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c30163
> > 5%7C0%7C0%7C638768751012864359%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGk
> > iOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyf
> > Q%3D%3D%7C0%7C%7C%7C&sdata=CpYLDUt9PJJvk%2FY9%2FBNrJz5vokkga4JKETUqCpZ
> > 2tKg%3D&reserved=0> | LinkedIn <
> > https://www/.
> > linkedin.com%2Fcompany%2Fgeotab%2F&data=05%7C02%7Cpeter.vanderperk%40n
> > xp.com%7C23945522e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c
> > 301635%7C0%7C0%7C638768751012880738%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU
> > 1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldU
> > IjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Y%2F29kbwdXzNq5bAOwHxzRiGNuoNzB1KwhYCZ
> > p8VlI8U%3D&reserved=0>
> >
> >
> > On Wed, Mar 5, 2025 at 7:11 PM Peter van der Perk <
> > peter.vanderp...@nxp.com>
> > wrote:
> >
> > > Hi Javier,
> > >
> > > I think it's a regression from the IOB rewrite.
> > >
> > > The original implementation added the timestamp before calling
> > > either devif_conn_event or can_data_event.
> > >
> > > https://gith/
> > > ub.com%2Fapache%2Fnuttx%2Fblob%2F55d9e5f7af05e75ca62f57863b880d723aa
> > > 83
> > > c56%2Fnet%2Fcan%2Fcan_callback.c%23L123-136&data=05%7C02%7Cpeter.van
> > > de
> > > rperk%40nxp.com%7Cf104859d6a1a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6
> > > fa
> > > 92cd99c5c301635%7C0%7C0%7C638768663693812678%7CUnknown%7CTWFpbGZsb3d
> > > 8e
> > > yJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiT
> > > WF
> > > pbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=rmMl%2BcVzdMZPrTpl1GcKUUfsz
> > > m9
> > > tDf1Oi1K%2FN%2F6kqF4%3D&reserved=0
> > >
> > > I think moving the code up would fix it.
> > >
> > > Yours sincerely,
> > >
> > > Peter van der Perk
> > >
> > > -----Original Message-----
> > > From: Javier Casas Marin <javierca...@geotab.com.INVALID>
> > > Sent: Wednesday, March 5, 2025 2:27 PM
> > > To: dev@nuttx.apache.org
> > > Subject: socket CAN timestamp missing
> > >
> > > Hi Nuttxaddicts,
> > >
> > > After configuring the CAN socket with SO_TIMESTAMP, the application
> > > reading the socket is sometimes getting an empty timestamp in some
> > > situations. I've been debugging this issue and I this is what I found:
> > >
> > > There are two paths when receiving a CAN frame from the interrupt,
> > > if there is someone waiting for a frame, the
> > > can_recvfrom_eventhandler callback is called to deliver the frame to
> > > the application, otherwise the frame is stored in the read-ahead list.
> > >
> > > When there is no listener available the timestamp is generated in
> > > the can_callback function just before calling can_data_event to
> > > store the CAN frame in the read-ahead list. But, if there is a
> > > listener waiting, the can_recvfrom_eventhandler is called and the
> > > timestamp is not generated at all, so the recvmsg call in the
> > > application side returns an
> > empty timestamp.
> > >
> > > I think this is a bug. Why is the timestant not added in the
> > > explained case? Adding it in the can_recvfrom_newdata function solves
> the issue.
> > >
> > > Javier Casas Marín
> > > Geotab
> > >
> > > Senior Embedded Systems Developer
> > >
> > > Direct
> > > Toll-free
> > >
> > > Visit
> > >
> > >
> > > +34 900 535 371
> > > http://www/
> > > .g%2F&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7C23945522e0f44c749d
> > > df08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63876875
> > > 1012894258%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwL
> > > jAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7
> > > C%7C&sdata=I757WREiA5t4rHUwjDHTcOw1BQ7LqWcEs9eS5npKoXY%3D&reserved=0
> > > eotab.com%2Fes&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7Cf104859d6
> > > a1
> > > a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6
> > > 38
> > > 768663693830272%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYi
> > > Oi
> > > IwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7
> > > C%
> > > 7C%7C&sdata=h2hUAcDskib8Ls0VEGXMTpYKCG%2B%2FAO24TAV5KhcHT5w%3D&reser
> > > ve
> > > d=0
> > >
> > > Twitter
> > > <https://twi/
> > > tter.com%2Fgeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7Cf10485
> > > 9d
> > >
> > 6a1a445d62a808dd5cb71af1%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> > 638768663693847889%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlY
> > iOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%
> > 7C%7C%7C&sdata=YKDNsDL62ZkxjJ%2FhSttjkxFxdghfZmqY4MNVXgFBzq4%3D&reserv
> > ed=0>
> > | Facebook <
> > | https://ww/
> > | w.facebook.com%2FGeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.com%7C
> > | 23945522e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c301635%
> > | 7C0%7C0%7C638768751012905861%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGk
> > | iOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjo
> > | yfQ%3D%3D%7C0%7C%7C%7C&sdata=gVhaJudRfKZrGDfeB8rlRMntBJSjI%2B%2F5QwB
> > | 5lUYNcnc%3D&reserved=0> | YouTube <
> > https://www/.
> > youtube.com%2Fuser%2FMyGeotab&data=05%7C02%7Cpeter.vanderperk%40nxp.co
> > m%7C23945522e0f44c749ddf08dd5ccb709c%7C686ea1d3bc2b4c6fa92cd99c5c30163
> >
> 5%7C0%7C0%7C638768751012917406%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=17JnNCoaVU7Pjt%2FRWenL77nZUuAdH7qwK4r9Hk%2B5w6w%3D&reserved=0>
> | LinkedIn < https://www.linkedin.com/company/geotab/>
> > >
> >
>

Reply via email to