Re: [PATCH] can: elmcan driver for ELM327 based OBD-II adapters

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

 



On 7/11/19 2:36 PM, Max Staudt wrote:
> This is the elmcan driver. It does a surprisingly good job at turning
> ELM327 based OBD-II interfaces into cheap CAN interfaces for simple
> homebrew projects.
> 
> Please see the included documentation for details and limitations:
> Documentation/networking/device_drivers/elmcan.rst
> 
> Thanks to Oliver Neukum for his reviews, wisdom, and encouragement
> while writing this.
> 
> CC TTY maintainers for their opinion as this patch adds a new ldisc.

Can you convert the driver from a ldisc to a serdev driver?

There is also the problem of using netif_rx_ni(skb) to push the frames
into networking stack. With this function the CAN frames might not end
up in the user space in the correct order. You have to use
netif_receive_skb(skb) to avoid this problem.

However this is a bit more complicated, as you can only use this
function from the NAPI context. You can setup a rx_offload, via
can_rx_offload_add_fifo() and then use can_rx_offload_queue_tail() to
push the CAN frames to the networking stack. See the flexcan driver as
an example. Use this [1] version as a reference how to use
can_rx_offload_queue_tail(). It's used here for error frames, but you
can use it for normal frames as well.

Marc

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git/tree/drivers/net/can/flexcan.c?id=4530ec36bb1e0d24f41c33229694adacda3d5d89#n613

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital 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