All of lore.kernel.org
 help / color / mirror / Atom feed
* RFC: slcan: read status flags
@ 2021-03-22  8:31 Yegor Yefremov
  2021-03-24  8:41 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Yegor Yefremov @ 2021-03-22  8:31 UTC (permalink / raw)
  To: linux-can

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. But perhaps an IOCTL could get the current
state?

What do you think?

Regards,
Yegor

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFC: slcan: read status flags
  2021-03-22  8:31 RFC: slcan: read status flags Yegor Yefremov
@ 2021-03-24  8:41 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2021-03-24  8:41 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-24  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  8:31 RFC: slcan: read status flags Yegor Yefremov
2021-03-24  8:41 ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.