Re: RFC: slcan: read status flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22.03.2021 09:31:16, Yegor Yefremov wrote:
> Is there any chance we could add 'F' command to get the error flags?
> The problem is, there is no special interrupt or special packet coming
> from the serial-to-CAN converter. So we cannot timely send this
> information to the user.

You mean you have to send a 'F' command to the CAN controller to query
the status?

> But perhaps an IOCTL could get the current state?

Can you hook something up to the do_get_berr_counter() callback? What's
the response to a 'F' command?

You can send the command in the do_get_berr_counter() and sleep on a
waitqueue. On receive of the response in the serial RX handler, parse
it, store in data priv and wake up the waitqueue.

If you don't get any CAN error counters, but CAN state information (like
error active, passive, bus off), it might be a good idea to set some
error counter values that correspond to the CAN state. Send CAN state
CAN frames from RX handler as usual.

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


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux