Confirming hardware Tx in socketCAN

"Al Thomason" <[email protected]> Thu, 9 Mar 2017 09:27:26 -0800
Newsgroups gmane.comp.hardware.bus.can
Message-ID <[email protected]>
I am not sure if this is the best forum to ask socketCAN questions on, if
there is a better place - suggestions appreciated.

 

I am porting an existing program from a micro-controller to be usable in
Linux.  I am using socketCAN for the Tx and Rx capabilities and all is
working well using non-blocking RAW writes (letting the socket queue do its
job).     However, one of the needs of the existing program is to assure a
given packet has been sent out via the hardware.  It uses this to coordinate
in-order transmission of multi-packet messages.   Is there a way to poll a
CAN socket to determine if indeed a message has been sent, or if the entire
queue is empty?  All references I have found to date cover file or perhaps
TCP access - and changing (even temporarily) to blocking writes risks
wedging the application.

 

Right now I am using an ugly sleep() for 3mS after transmitting 'need to
confirm' packets, with the idea being to raise the likelihood a given packet
was indeed sent (if it can be at all).   However, clearly some other
non-delay approach would be preferred. Any other ideas?   

 

Thank you in advance for any suggestions.

 

-al-