Skip to content

Commit c18ce10

Browse files
Oliver Hartkoppdavem330
authored andcommitted
[CAN]: Add raw protocol
This patch adds the CAN raw protocol. Signed-off-by: Oliver Hartkopp <[email protected]> Signed-off-by: Urs Thuermann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0d66548 commit c18ce10

File tree

4 files changed

+808
-0
lines changed

4 files changed

+808
-0
lines changed

include/linux/can/raw.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* linux/can/raw.h
3+
*
4+
* Definitions for raw CAN sockets
5+
*
6+
* Authors: Oliver Hartkopp <[email protected]>
7+
* Urs Thuermann <[email protected]>
8+
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9+
* All rights reserved.
10+
*
11+
* Send feedback to <[email protected]>
12+
*
13+
*/
14+
15+
#ifndef CAN_RAW_H
16+
#define CAN_RAW_H
17+
18+
#include <linux/can.h>
19+
20+
#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
21+
22+
/* for socket options affecting the socket (not the global system) */
23+
24+
enum {
25+
CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
26+
CAN_RAW_ERR_FILTER, /* set filter for error frames */
27+
CAN_RAW_LOOPBACK, /* local loopback (default:on) */
28+
CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */
29+
};
30+
31+
#endif

net/can/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ menuconfig CAN
1515

1616
If you want CAN support you should say Y here and also to the
1717
specific driver for your controller(s) below.
18+
19+
config CAN_RAW
20+
tristate "Raw CAN Protocol (raw access with CAN-ID filtering)"
21+
depends on CAN
22+
default N
23+
---help---
24+
The raw CAN protocol option offers access to the CAN bus via
25+
the BSD socket API. You probably want to use the raw socket in
26+
most cases where no higher level protocol is being used. The raw
27+
socket has several filter options e.g. ID masking / error frames.
28+
To receive/send raw CAN messages, use AF_CAN with protocol CAN_RAW.

net/can/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44

55
obj-$(CONFIG_CAN) += can.o
66
can-objs := af_can.o proc.o
7+
8+
obj-$(CONFIG_CAN_RAW) += can-raw.o
9+
can-raw-objs := raw.o

0 commit comments

Comments
 (0)