Skip to contentSkip to conversation

libsocketcan: upgrade to 0.0.9

PATCH New Eric Bénard 1 participant 2 messages Sep 19, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libsocketcan: upgrade to 0.0.9

and include a compile fix

---
 ...e-strcmp-instead-of-sizeof-on-char-string.patch | 39 ++++++++++++++++++++++
 ...libsocketcan_0.0.8.bb => libsocketcan_0.0.9.bb} |  7 ++--
 2 files changed, 43 insertions(+), 3 deletions(-)
 create mode 100644 meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch
 rename meta-oe/recipes-extended/socketcan/{libsocketcan_0.0.8.bb => libsocketcan_0.0.9.bb} (57%)
meta-oe/recipes-extended/socketcan/libsocketcan/0001-Use-strcmp-instead-of-sizeof-on-char-string.patch new file +39 -0
new file mode 100644
index 0000000..aa6196e
@@ -0,0 +1,39 @@
+From 94094cc4ee7ae585da3e5e7e83e7d82b5d6de656 Mon Sep 17 00:00:00 2001
+From: Alexander Stein <[email protected]>
+Date: Wed, 14 Nov 2012 12:13:06 +0100
+Subject: [PATCH] Use strcmp instead of sizeof on char* string
+
+This bug was detected by the clang warning:
+libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call
+is the same expression as the source; did you mean to provide an
+explicit length? [-Wsizeof-pointer-memaccess]
+sizeof(name)) != 0)
+~~~~~~~^~~~~~
+
+Signed-off-by: Alexander Stein <[email protected]>
+Signed-off-by: Marc Kleine-Budde <[email protected]>
+---
+Upstream-Status: Backport
+
+ src/libsocketcan.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/libsocketcan.c b/src/libsocketcan.c
+index fedcbdc..841c2ed 100644
+--- a/src/libsocketcan.c
++++ b/src/libsocketcan.c
+@@ -379,9 +379,8 @@ static int do_get_nl_link(int fd, __u8 acquire, const char *name, void *res)
+ 				nl_msg->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
+ 			parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
+ 
+-			if (strncmp
+-			    ((char *)RTA_DATA(tb[IFLA_IFNAME]), name,
+-			     sizeof(name)) != 0)
++			if (strcmp
++			    ((char *)RTA_DATA(tb[IFLA_IFNAME]), name) != 0)
+ 				continue;
+ 
+ 			if (tb[IFLA_LINKINFO])
+-- 
+1.8.3.1
+
meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb renamed from meta-oe/recipes-extended/socketcan/libsocketcan_0.0.8.bb +4 -3
similarity index 57%
rename from meta-oe/recipes-extended/socketcan/libsocketcan_0.0.8.bb
rename to meta-oe/recipes-extended/socketcan/libsocketcan_0.0.9.bb
index 34ba56b..6b31a1e 100644
@@ -5,9 +5,10 @@ SECTION = "libs/network"
 LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://src/libsocketcan.c;beginline=3;endline=17;md5=97e38adced4385d8fba1ae2437cedee1"
 
-SRCREV = "3a2cec63a4e6212cc63d21008453bd799cfe8774"
+SRCREV = "e1a224bf1c409adf0c02b07a90deada634e54b88"
 
-SRC_URI = "git://git.pengutronix.de/git/tools/libsocketcan.git \
+SRC_URI = "git://git.pengutronix.de/git/tools/libsocketcan.git;protocol=git \
+    file://0001-Use-strcmp-instead-of-sizeof-on-char-string.patch \
 "
 
 S = "${WORKDIR}/git"
@@ -15,5 +16,5 @@ S = "${WORKDIR}/git"
 inherit autotools pkgconfig
 
 do_configure_prepend() {
-    sed -i -e s:tests/GNUmakefile::g -e s:trunk:0.0.8: configure.ac
+    sed -i -e s:tests/GNUmakefile::g -e s:trunk:0.0.9: configure.ac
 }
Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH 2/2 canutils: update recipe

- use git hash instead of tag
- backport "candump: Add error frame's handling"

---
 ...nutils-candump-Add-error-frame-s-handling.patch | 94 ++++++++++++++++++++++
 .../recipes-extended/socketcan/canutils_4.0.6.bb   |  5 +-
 2 files changed, 97 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch
meta-oe/recipes-extended/socketcan/canutils/0001-canutils-candump-Add-error-frame-s-handling.patch new file +94 -0
new file mode 100644
index 0000000..fcc38e0
@@ -0,0 +1,94 @@
+From bab595e38295dcafcfc17a011d3d51f2df1618e6 Mon Sep 17 00:00:00 2001
+From: AnilKumar Ch <[email protected]>
+Date: Tue, 10 Jan 2012 18:55:11 +0530
+Subject: [PATCH] canutils: candump: Add error frame's handling
+
+This patch adds the error handling capability to candump utility
+by adding error flags for displaying all kind of error frames
+like tx_timeout, lost arbitration, controller problems, buserrors,
+bus warnings etc.
+
+Usage of candump for error frame display on console:
+candump [<can-interface>] [Options]
+Ex: candump can0 --error
+
+This patch is created on top of canutils-4.0.6 tag from
+http://git.pengutronix.de/?p=tools/canutils.git
+
+Signed-off-by: AnilKumar Ch <[email protected]>
+Signed-off-by: Marc Kleine-Budde <[email protected]>
+---
+Upstream-Status: Backport
+
+ src/candump.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/candump.c b/src/candump.c
+index 259d442..c16425b 100644
+--- a/src/candump.c
++++ b/src/candump.c
+@@ -20,6 +20,7 @@
+ 
+ #include <linux/can.h>
+ #include <linux/can/raw.h>
++#include <linux/can/error.h>
+ 
+ extern int optind, opterr, optopt;
+ 
+@@ -40,6 +41,7 @@ static void print_usage(char *prg)
+ 		" -p, --protocol=PROTO\t"	"CAN protocol (default CAN_RAW = %d)\n"
+ 		"     --filter=id:mask[:id:mask]...\n"
+ 		"\t\t\t"			"apply filter\n"
++		" -e, --error\t\t"		"dump error frames along with data frames\n"
+ 		" -h, --help\t\t"		"this help\n"
+ 		" -o <filename>\t\t"		"output into filename\n"
+ 		" -d\t\t\t"			"daemonize\n"
+@@ -86,6 +88,11 @@ int main(int argc, char **argv)
+ 	int nbytes, i;
+ 	int opt, optdaemon = 0;
+ 	uint32_t id, mask;
++	int error = 0;
++	can_err_mask_t err_mask = (CAN_ERR_TX_TIMEOUT | CAN_ERR_LOSTARB |
++					CAN_ERR_CRTL | CAN_ERR_PROT |
++					CAN_ERR_TRX | CAN_ERR_ACK | CAN_ERR_BUSOFF |
++					CAN_ERR_BUSERROR);
+ 
+ 	signal(SIGPIPE, SIG_IGN);
+ 
+@@ -95,6 +102,7 @@ int main(int argc, char **argv)
+ 		{ "protocol", required_argument, 0, 'p' },
+ 		{ "type", required_argument, 0, 't' },
+ 		{ "filter", required_argument, 0, FILTER_OPTION },
++		{ "error", no_argument, 0, 'e' },
+ 		{ "version", no_argument, 0, VERSION_OPTION},
+ 		{ 0, 0, 0, 0},
+ 	};
+@@ -121,6 +129,10 @@ int main(int argc, char **argv)
+ 			proto = strtoul(optarg, NULL, 0);
+ 			break;
+ 
++		case 'e':
++			error = 1;
++			break;
++
+ 		case 'o':
+ 			optout = optarg;
+ 			break;
+@@ -186,6 +198,14 @@ int main(int argc, char **argv)
+ 		}
+ 	}
+ 
++	if (error) {
++		if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER, &err_mask,
++			       sizeof(err_mask)) != 0) {
++			perror("setsockopt");
++			exit(1);
++		}
++	}
++
+ 	if (optdaemon)
+ 		daemon(1, 0);
+ 	else {
+-- 
+1.8.3.1
+
meta-oe/recipes-extended/socketcan/canutils_4.0.6.bb +3 -2
index 3bc2f93..504c510 100644
@@ -7,8 +7,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
 DEPENDS = "libsocketcan"
 
-TAG = "canutils-${PV}"
-SRC_URI = "git://git.pengutronix.de/git/tools/canutils.git;tag=${TAG} \
+SRCREV = "299dff7f5322bf0348dcdd60071958ebedf5f09d"
+SRC_URI = "git://git.pengutronix.de/git/tools/canutils.git;protocol=git \
+    file://0001-canutils-candump-Add-error-frame-s-handling.patch \
 "
 
 S = "${WORKDIR}/git"
Signature · 1 line
1.8.4.rc3