diff options
4 files changed, 14 insertions, 177 deletions
diff --git a/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch b/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch deleted file mode 100644 index f69254a292..0000000000 --- a/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | From 059d5512e840fe68e2bb37add6c9208fa9c34d15 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sekhar Nori <nsekhar@ti.com> | ||
3 | Date: Tue, 24 Feb 2015 22:16:37 +0530 | ||
4 | Subject: [PATCH 1/2] Add option to enable internal loopback | ||
5 | |||
6 | Upstream-status: Pending | ||
7 | --- | ||
8 | serialcheck.c | 23 +++++++++++++++++++++++ | ||
9 | 1 file changed, 23 insertions(+) | ||
10 | |||
11 | diff --git a/serialcheck.c b/serialcheck.c | ||
12 | index 4f5b747..4100c37 100644 | ||
13 | --- a/serialcheck.c | ||
14 | +++ b/serialcheck.c | ||
15 | @@ -12,6 +12,8 @@ | ||
16 | #include <sys/ioctl.h> | ||
17 | #include <linux/serial.h> | ||
18 | |||
19 | +#define TIOCM_LOOP 0x8000 | ||
20 | + | ||
21 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) | ||
22 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
23 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | ||
24 | @@ -40,6 +42,7 @@ struct g_opt { | ||
25 | unsigned char hflow; | ||
26 | unsigned char do_termios; | ||
27 | unsigned char *cmp_buff; | ||
28 | + unsigned char loopback; | ||
29 | }; | ||
30 | |||
31 | /* name, key, arg, flags, doc, group */ | ||
32 | @@ -51,6 +54,7 @@ static struct argp_option options[] = { | ||
33 | {"mode", 'm', "M", 0, "transfer mode (d = duplex, t = send r = receive)", 0}, | ||
34 | {"loops", 'l', "NUM", 0, "loops to perform (0 => wait fot CTRL-C", 0}, | ||
35 | {"no-termios", 'n', NULL, 0, "No termios change (baud rate etc. remains unchanged)", 0}, | ||
36 | + {"loopback", 'k', NULL, 0, "loopback mode", 0}, | ||
37 | {NULL, 0, NULL, 0, NULL, 0} | ||
38 | }; | ||
39 | |||
40 | @@ -67,6 +71,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) | ||
41 | go->baudrate = 115200; | ||
42 | go->loops = UINT_MAX; | ||
43 | go->do_termios = 1; | ||
44 | + go->loopback = 0; | ||
45 | break; | ||
46 | case ARGP_KEY_ARG: | ||
47 | ret = ARGP_ERR_UNKNOWN; | ||
48 | @@ -113,6 +118,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) | ||
49 | } else | ||
50 | go->loops = num; | ||
51 | break; | ||
52 | + case 'k': | ||
53 | + go->loopback = 1; | ||
54 | + break; | ||
55 | default: | ||
56 | ret = ARGP_ERR_UNKNOWN; | ||
57 | } | ||
58 | @@ -487,6 +495,21 @@ int main(int argc, char *argv[]) | ||
59 | die("tcflush failed: %m\n"); | ||
60 | } | ||
61 | |||
62 | + if (opts.loopback) { | ||
63 | + unsigned int mcr; | ||
64 | + | ||
65 | + ret = ioctl(fd, TIOCMGET, &mcr); | ||
66 | + if (ret < 0) | ||
67 | + die("mcr get failed: %m\n"); | ||
68 | + | ||
69 | + mcr |= TIOCM_LOOP; | ||
70 | + | ||
71 | + ret = ioctl(fd, TIOCMSET, &mcr); | ||
72 | + if (ret < 0) | ||
73 | + die ("mcr set failed: %m\n"); | ||
74 | + | ||
75 | + } | ||
76 | + | ||
77 | ret = fcntl(fd, F_SETFL, 0); | ||
78 | if (ret) | ||
79 | printf("Failed to remove nonblock mode\n"); | ||
80 | -- | ||
81 | 1.9.1 | ||
diff --git a/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Makefile-Change-order-of-link-flags.patch b/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Makefile-Change-order-of-link-flags.patch deleted file mode 100644 index 2ab48345dc..0000000000 --- a/meta-oe/recipes-devtools/serialcheck/serialcheck/0001-Makefile-Change-order-of-link-flags.patch +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | From efc8a4e717ba919c869c2da1c7de2d08bc976926 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 24 Feb 2016 18:48:07 +0000 | ||
4 | Subject: [PATCH] Makefile: Change order of link flags | ||
5 | |||
6 | This helps in injectcting LDFLAGS from env to take effect | ||
7 | as it appears last on cmdline now | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Makefile | 10 ++++++++-- | ||
14 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/Makefile b/Makefile | ||
17 | index ba2bfbb..6d13e68 100644 | ||
18 | --- a/Makefile | ||
19 | +++ b/Makefile | ||
20 | @@ -1,3 +1,9 @@ | ||
21 | -CFLAGS=-O2 -Wall -Wextra -g -Wno-sign-compare -Wno-pointer-sign | ||
22 | -CC=gcc | ||
23 | +CFLAGS?=-O2 -Wall -Wextra -g -Wno-sign-compare -Wno-pointer-sign | ||
24 | +CC?=gcc | ||
25 | all: serialcheck | ||
26 | +serialcheck : serialcheck.o | ||
27 | + $(CC) -o serialcheck serialcheck.o $(CFLAGS) $(LDFLAGS) | ||
28 | + | ||
29 | +%.o : %.c | ||
30 | + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ | ||
31 | + | ||
32 | -- | ||
33 | 1.9.1 | ||
34 | |||
diff --git a/meta-oe/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch b/meta-oe/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch deleted file mode 100644 index 1b8c95b10c..0000000000 --- a/meta-oe/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From a6e5813d2f8402bf3a311c8bcda02623bfb76882 Mon Sep 17 00:00:00 2001 | ||
2 | From: Carlos Hernandez <ceh@ti.com> | ||
3 | Date: Tue, 24 Feb 2015 16:00:34 -0500 | ||
4 | Subject: [PATCH 2/2] Restore original loopback config | ||
5 | |||
6 | If loopback option is enabled, disable it at the end of the test. | ||
7 | |||
8 | Signed-off-by: Carlos Hernandez <ceh@ti.com> | ||
9 | Upstream-status: Pending | ||
10 | --- | ||
11 | serialcheck.c | 9 +++++++-- | ||
12 | 1 file changed, 7 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/serialcheck.c b/serialcheck.c | ||
15 | index 4100c37..06470f7 100644 | ||
16 | --- a/serialcheck.c | ||
17 | +++ b/serialcheck.c | ||
18 | @@ -427,6 +427,7 @@ int main(int argc, char *argv[]) | ||
19 | unsigned char *data; | ||
20 | unsigned int open_mode; | ||
21 | off_t data_len; | ||
22 | + unsigned int mcr; | ||
23 | |||
24 | argp_parse(&argp, argc, argv, 0, NULL, &opts); | ||
25 | if (!opts.file_trans) | ||
26 | @@ -496,8 +497,6 @@ int main(int argc, char *argv[]) | ||
27 | } | ||
28 | |||
29 | if (opts.loopback) { | ||
30 | - unsigned int mcr; | ||
31 | - | ||
32 | ret = ioctl(fd, TIOCMGET, &mcr); | ||
33 | if (ret < 0) | ||
34 | die("mcr get failed: %m\n"); | ||
35 | @@ -535,6 +534,12 @@ int main(int argc, char *argv[]) | ||
36 | ret = tcsetattr(fd, TCSAFLUSH, &old_term); | ||
37 | if (ret) | ||
38 | printf("tcsetattr() of old ones failed: %m\n"); | ||
39 | + if (opts.loopback) { | ||
40 | + mcr &= ~(TIOCM_LOOP); | ||
41 | + ret = ioctl(fd, TIOCMSET, &mcr); | ||
42 | + } | ||
43 | + if (ret) | ||
44 | + printf("disabling loopback failed: %m\n"); | ||
45 | |||
46 | close(fd); | ||
47 | return status; | ||
48 | -- | ||
49 | 1.9.1 | ||
diff --git a/meta-oe/recipes-devtools/serialcheck/serialcheck_1.0.0.bb b/meta-oe/recipes-devtools/serialcheck/serialcheck_1.0.0.bb index cd5e0a4e5c..16eaf62f78 100644 --- a/meta-oe/recipes-devtools/serialcheck/serialcheck_1.0.0.bb +++ b/meta-oe/recipes-devtools/serialcheck/serialcheck_1.0.0.bb | |||
@@ -1,30 +1,31 @@ | |||
1 | SUMMARY = "Application to verify operation of serial ports" | 1 | SUMMARY = "Application to verify operation of serial ports" |
2 | HOMEPAGE = "http://git.breakpoint.cc/cgit/bigeasy/serialcheck.git/" | 2 | HOMEPAGE = "https://github.com/nsekhar/serialcheck" |
3 | LICENSE = "GPLv2" | 3 | LICENSE = "GPLv2" |
4 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
5 | 5 | ||
6 | SRC_URI = "git://git.breakpoint.cc/bigeasy/serialcheck.git \ | 6 | SRC_URI = " \ |
7 | file://0001-Add-option-to-enable-internal-loopback.patch \ | 7 | git://github.com/nsekhar/serialcheck.git \ |
8 | file://0002-Restore-original-loopback-config.patch \ | 8 | " |
9 | file://0001-Makefile-Change-order-of-link-flags.patch \ | ||
10 | " | ||
11 | 9 | ||
12 | SRCREV = "63854a2d0c0129efab132ec328a75279e013fb84" | 10 | SRCREV = "45eb2ffa5378396e85432872833890b0a1cba872" |
13 | 11 | ||
14 | S = "${WORKDIR}/git" | 12 | S = "${WORKDIR}/git" |
15 | 13 | ||
14 | inherit autotools | ||
15 | |||
16 | DEPENDS_append_libc-musl = " argp-standalone" | 16 | DEPENDS_append_libc-musl = " argp-standalone" |
17 | EXTRA_OEMAKE = "-e MAKEFLAGS=" | 17 | EXTRA_OEMAKE_append_libc-musl = " LIBS='-largp'" |
18 | 18 | ||
19 | CFLAGS_prepend = "-Wall -Wextra -Wno-sign-compare -Wno-pointer-sign " | 19 | PACKAGE_BEFORE_PN += "${PN}-stats" |
20 | LDFLAGS_append_libc-musl = " -largp" | ||
21 | 20 | ||
22 | do_install() { | 21 | do_install() { |
23 | install -d ${D}${bindir} | 22 | install -d ${D}${bindir} |
24 | install ${S}/serialcheck ${D}${bindir} | 23 | install ${B}/serialcheck ${D}${bindir} |
24 | install ${B}/serialstats ${D}${bindir} | ||
25 | install -d ${D}${docdir}/${BP} | 25 | install -d ${D}${docdir}/${BP} |
26 | install ${S}/Readme.txt ${D}${docdir}/${BP} | 26 | install ${S}/README ${D}${docdir}/${BP} |
27 | } | 27 | } |
28 | CLEANBROKEN = "1" | 28 | |
29 | FILES_${PN}-stats = "${bindir}/serialstats" | ||
29 | 30 | ||
30 | BBCLASSEXTEND = "nativesdk" | 31 | BBCLASSEXTEND = "nativesdk" |