diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:51:41 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-08 22:51:41 +0200 |
commit | 1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e (patch) | |
tree | a21a5fc103bb3bd65ecd85ed22be5228fc54e447 /meta-oe/recipes-extended/socketcan | |
download | meta-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')
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 @@ | |||
1 | SUMMARY = "Linux CAN network development utilities" | ||
2 | DESCRIPTION = "Linux CAN network development" | ||
3 | LICENSE = "GPLv2 & BSD-3-Clause" | ||
4 | LIC_FILES_CHKSUM = "file://include/linux/can.h;endline=43;md5=390a2c9a3c5e3595a069ac1436553ee7" | ||
5 | |||
6 | DEPENDS = "libsocketcan" | ||
7 | |||
8 | SRC_URI = "git://git.gitorious.org/linux-can/${BPN}.git;protocol=git;branch=master" | ||
9 | SRCREV = "67a2bdcd336e6becfa5784742e18c88dbeddc973" | ||
10 | |||
11 | PV = "0.0+gitr${SRCPV}" | ||
12 | |||
13 | S = "${WORKDIR}/git" | ||
14 | |||
15 | inherit 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 @@ | |||
1 | From bab595e38295dcafcfc17a011d3d51f2df1618e6 Mon Sep 17 00:00:00 2001 | ||
2 | From: AnilKumar Ch <anilkumar@ti.com> | ||
3 | Date: Tue, 10 Jan 2012 18:55:11 +0530 | ||
4 | Subject: [PATCH] canutils: candump: Add error frame's handling | ||
5 | |||
6 | This patch adds the error handling capability to candump utility | ||
7 | by adding error flags for displaying all kind of error frames | ||
8 | like tx_timeout, lost arbitration, controller problems, buserrors, | ||
9 | bus warnings etc. | ||
10 | |||
11 | Usage of candump for error frame display on console: | ||
12 | candump [<can-interface>] [Options] | ||
13 | Ex: candump can0 --error | ||
14 | |||
15 | This patch is created on top of canutils-4.0.6 tag from | ||
16 | http://git.pengutronix.de/?p=tools/canutils.git | ||
17 | |||
18 | Signed-off-by: AnilKumar Ch <anilkumar@ti.com> | ||
19 | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> | ||
20 | --- | ||
21 | Upstream-Status: Backport | ||
22 | |||
23 | src/candump.c | 20 ++++++++++++++++++++ | ||
24 | 1 file changed, 20 insertions(+) | ||
25 | |||
26 | diff --git a/src/candump.c b/src/candump.c | ||
27 | index 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 | -- | ||
93 | 1.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 @@ | |||
1 | SUMMARY = "canutils (PTX flavour)" | ||
2 | HOMEPAGE = "http://www.pengutronix.de" | ||
3 | SECTION = "console/network" | ||
4 | |||
5 | LICENSE = "GPLv2" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | ||
7 | |||
8 | DEPENDS = "libsocketcan" | ||
9 | |||
10 | SRCREV = "299dff7f5322bf0348dcdd60071958ebedf5f09d" | ||
11 | SRC_URI = "git://git.pengutronix.de/git/tools/canutils.git;protocol=git \ | ||
12 | file://0001-canutils-candump-Add-error-frame-s-handling.patch \ | ||
13 | " | ||
14 | |||
15 | S = "${WORKDIR}/git" | ||
16 | |||
17 | inherit 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 @@ | |||
1 | From 94094cc4ee7ae585da3e5e7e83e7d82b5d6de656 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Stein <alexander.stein@systec-electronic.com> | ||
3 | Date: Wed, 14 Nov 2012 12:13:06 +0100 | ||
4 | Subject: [PATCH] Use strcmp instead of sizeof on char* string | ||
5 | |||
6 | This bug was detected by the clang warning: | ||
7 | libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call | ||
8 | is the same expression as the source; did you mean to provide an | ||
9 | explicit length? [-Wsizeof-pointer-memaccess] | ||
10 | sizeof(name)) != 0) | ||
11 | ~~~~~~~^~~~~~ | ||
12 | |||
13 | Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> | ||
14 | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> | ||
15 | --- | ||
16 | Upstream-Status: Backport | ||
17 | |||
18 | src/libsocketcan.c | 5 ++--- | ||
19 | 1 file changed, 2 insertions(+), 3 deletions(-) | ||
20 | |||
21 | diff --git a/src/libsocketcan.c b/src/libsocketcan.c | ||
22 | index 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 | -- | ||
38 | 1.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 @@ | |||
1 | SUMMARY = "Control basic functions in socketcan from userspace" | ||
2 | HOMEPAGE = "http://www.pengutronix.de" | ||
3 | SECTION = "libs/network" | ||
4 | |||
5 | LICENSE = "LGPLv2.1" | ||
6 | LIC_FILES_CHKSUM = "file://src/libsocketcan.c;beginline=3;endline=17;md5=97e38adced4385d8fba1ae2437cedee1" | ||
7 | |||
8 | SRCREV = "e1a224bf1c409adf0c02b07a90deada634e54b88" | ||
9 | |||
10 | SRC_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 | |||
14 | S = "${WORKDIR}/git" | ||
15 | |||
16 | inherit autotools pkgconfig | ||
17 | |||
18 | do_configure_prepend() { | ||
19 | sed -i -e s:tests/GNUmakefile::g -e s:trunk:0.0.9: ${S}/configure.ac | ||
20 | } | ||