Reputation: 8115
Is there a way to check for an empty transmit buffer with raw socketcan?
EDIT: Or is there a way to make socketcan blocking until the current frame is sent which would serve the same purpose ...
(motivation: I'm writing a mcu flash tool over can. The bootloader spec calls for a waiting time after a certain amount of data sent in order for it to do the writing to flash. Depending on the bus load the sending of the data could be faster or slower.)
Upvotes: 0
Views: 1151
Reputation: 411
SocketCAN sockets only block until the frame is put into the socket buffer (although see section 3.4 in https://rtime.felk.cvut.cz/can/socketcan-qdisc-final.pdf for some subtle complications).
If you want to discover if a frame was successfully sent, enable the CAN_RAW_RECV_OWN_MSGS
socket option and wait until you receive the sent frame with the MSG_CONFIRM
flag set. See this answer for more details.
Upvotes: 1