summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/socketcan
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
committerTudor Florea <tudor.florea@enea.com>2015-10-08 22:51:41 +0200
commit1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch)
treea21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/recipes-extended/socketcan
downloadmeta-openembedded-1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e.tar.gz
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-oe/recipes-extended/socketcan')
-rw-r--r--meta-oe/recipes-extended/socketcan/can-utils_git.bb16
-rw-r--r--meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch94
-rw-r--r--meta-oe/recipes-extended/socketcan/canutils_4.0.6.bb17
-rw-r--r--meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch39
-rw-r--r--meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb20
5 files changed, 186 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/socketcan/can-utils_git.bb b/meta-oe/recipes-extended/socketcan/can-utils_git.bb
new file mode 100644
index 000000000..d8de9dfd2
--- /dev/null
+++ b/meta-oe/recipes-extended/socketcan/can-utils_git.bb
@@ -0,0 +1,16 @@
1SUMMARY = "Linux CAN network development utilities"
2DESCRIPTION = "Linux CAN network development"
3LICENSE = "GPLv2 & BSD-3-Clause"
4LIC_FILES_CHKSUM = "file://include/linux/can.h;endline=43;md5=390a2c9a3c5e3595a069ac1436553ee7"
5
6DEPENDS = "libsocketcan"
7
8SRC_URI = "git://git.gitorious.org/linux-can/${BPN}.git;protocol=git;branch=master"
9SRCREV = "67a2bdcd336e6becfa5784742e18c88dbeddc973"
10
11PV = "0.0+gitr${SRCPV}"
12
13S = "${WORKDIR}/git"
14
15inherit autotools pkgconfig
16
diff --git a/meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch b/meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch
new file mode 100644
index 000000000..fcc38e061
--- /dev/null
+++ b/meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch
@@ -0,0 +1,94 @@
1From bab595e38295dcafcfc17a011d3d51f2df1618e6 Mon Sep 17 00:00:00 2001
2From: AnilKumar Ch <anilkumar@ti.com>
3Date: Tue, 10 Jan 2012 18:55:11 +0530
4Subject: [PATCH] canutils: candump: Add error frame's handling
5
6This patch adds the error handling capability to candump utility
7by adding error flags for displaying all kind of error frames
8like tx_timeout, lost arbitration, controller problems, buserrors,
9bus warnings etc.
10
11Usage of candump for error frame display on console:
12candump [<can-interface>] [Options]
13Ex: candump can0 --error
14
15This patch is created on top of canutils-4.0.6 tag from
16http://git.pengutronix.de/?p=tools/canutils.git
17
18Signed-off-by: AnilKumar Ch <anilkumar@ti.com>
19Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
20---
21Upstream-Status: Backport
22
23 src/candump.c | 20 ++++++++++++++++++++
24 1 file changed, 20 insertions(+)
25
26diff --git a/src/candump.c b/src/candump.c
27index 259d442..c16425b 100644
28--- a/src/candump.c
29+++ b/src/candump.c
30@@ -20,6 +20,7 @@
31
32 #include <linux/can.h>
33 #include <linux/can/raw.h>
34+#include <linux/can/error.h>
35
36 extern int optind, opterr, optopt;
37
38@@ -40,6 +41,7 @@ static void print_usage(char *prg)
39 " -p, --protocol=PROTO\t" "CAN protocol (default CAN_RAW = %d)\n"
40 " --filter=id:mask[:id:mask]...\n"
41 "\t\t\t" "apply filter\n"
42+ " -e, --error\t\t" "dump error frames along with data frames\n"
43 " -h, --help\t\t" "this help\n"
44 " -o <filename>\t\t" "output into filename\n"
45 " -d\t\t\t" "daemonize\n"
46@@ -86,6 +88,11 @@ int main(int argc, char **argv)
47 int nbytes, i;
48 int opt, optdaemon = 0;
49 uint32_t id, mask;
50+ int error = 0;
51+ can_err_mask_t err_mask = (CAN_ERR_TX_TIMEOUT | CAN_ERR_LOSTARB |
52+ CAN_ERR_CRTL | CAN_ERR_PROT |
53+ CAN_ERR_TRX | CAN_ERR_ACK | CAN_ERR_BUSOFF |
54+ CAN_ERR_BUSERROR);
55
56 signal(SIGPIPE, SIG_IGN);
57
58@@ -95,6 +102,7 @@ int main(int argc, char **argv)
59 { "protocol", required_argument, 0, 'p' },
60 { "type", required_argument, 0, 't' },
61 { "filter", required_argument, 0, FILTER_OPTION },
62+ { "error", no_argument, 0, 'e' },
63 { "version", no_argument, 0, VERSION_OPTION},
64 { 0, 0, 0, 0},
65 };
66@@ -121,6 +129,10 @@ int main(int argc, char **argv)
67 proto = strtoul(optarg, NULL, 0);
68 break;
69
70+ case 'e':
71+ error = 1;
72+ break;
73+
74 case 'o':
75 optout = optarg;
76 break;
77@@ -186,6 +198,14 @@ int main(int argc, char **argv)
78 }
79 }
80
81+ if (error) {
82+ if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask,
83+ sizeof(err_mask)) != 0) {
84+ perror("setsockopt");
85+ exit(1);
86+ }
87+ }
88+
89 if (optdaemon)
90 daemon(1, 0);
91 else {
92--
931.8.3.1
94
diff --git a/meta-oe/recipes-extended/socketcan/canutils_4.0.6.bb b/meta-oe/recipes-extended/socketcan/canutils_4.0.6.bb
new file mode 100644
index 000000000..c220eadab
--- /dev/null
+++ b/meta-oe/recipes-extended/socketcan/canutils_4.0.6.bb
@@ -0,0 +1,17 @@
1SUMMARY = "canutils (PTX flavour)"
2HOMEPAGE = "http://www.pengutronix.de"
3SECTION = "console/network"
4
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
7
8DEPENDS = "libsocketcan"
9
10SRCREV = "299dff7f5322bf0348dcdd60071958ebedf5f09d"
11SRC_URI = "git://git.pengutronix.de/git/tools/canutils.git;protocol=git \
12 file://0001-canutils-candump-Add-error-frame-s-handling.patch \
13"
14
15S = "${WORKDIR}/git"
16
17inherit autotools pkgconfig
diff --git a/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch b/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch
new file mode 100644
index 000000000..aa6196ee9
--- /dev/null
+++ b/meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch
@@ -0,0 +1,39 @@
1From 94094cc4ee7ae585da3e5e7e83e7d82b5d6de656 Mon Sep 17 00:00:00 2001
2From: Alexander Stein <alexander.stein@systec-electronic.com>
3Date: Wed, 14 Nov 2012 12:13:06 +0100
4Subject: [PATCH] Use strcmp instead of sizeof on char* string
5
6This bug was detected by the clang warning:
7libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call
8is the same expression as the source; did you mean to provide an
9explicit length? [-Wsizeof-pointer-memaccess]
10sizeof(name)) != 0)
11~~~~~~~^~~~~~
12
13Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
14Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
15---
16Upstream-Status: Backport
17
18 src/libsocketcan.c | 5 ++---
19 1 file changed, 2 insertions(+), 3 deletions(-)
20
21diff --git a/src/libsocketcan.c b/src/libsocketcan.c
22index fedcbdc..841c2ed 100644
23--- a/src/libsocketcan.c
24+++ b/src/libsocketcan.c
25@@ -379,9 +379,8 @@ static int do_get_nl_link(int fd, __u8 acquire, const char *name, void *res)
26 nl_msg->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
27 parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
28
29- if (strncmp
30- ((char *)RTA_DATA(tb[IFLA_IFNAME]), name,
31- sizeof(name)) != 0)
32+ if (strcmp
33+ ((char *)RTA_DATA(tb[IFLA_IFNAME]), name) != 0)
34 continue;
35
36 if (tb[IFLA_LINKINFO])
37--
381.8.3.1
39
diff --git a/meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb b/meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb
new file mode 100644
index 000000000..98ef73f29
--- /dev/null
+++ b/meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb
@@ -0,0 +1,20 @@
1SUMMARY = "Control basic functions in socketcan from userspace"
2HOMEPAGE = "http://www.pengutronix.de"
3SECTION = "libs/network"
4
5LICENSE = "LGPLv2.1"
6LIC_FILES_CHKSUM = "file://src/libsocketcan.c;beginline=3;endline=17;md5=97e38adced4385d8fba1ae2437cedee1"
7
8SRCREV = "e1a224bf1c409adf0c02b07a90deada634e54b88"
9
10SRC_URI = "git://git.pengutronix.de/git/tools/libsocketcan.git;protocol=git \
11 file://0001-Use-strcmp-instead-of-sizeof-on-char-string.patch \
12"
13
14S = "${WORKDIR}/git"
15
16inherit autotools pkgconfig
17
18do_configure_prepend() {
19 sed -i -e s:tests/GNUmakefile::g -e s:trunk:0.0.9: ${S}/configure.ac
20}