All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe
@ 2015-02-27 20:55 Carlos Hernandez
  2015-02-27 20:55 ` [PATCH 2/3] packagegroup-arago-test: Add serialcheck Carlos Hernandez
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Carlos Hernandez @ 2015-02-27 20:55 UTC (permalink / raw)
  To: meta-arago

Serialcheck is a simple utility to verify serial ports functionality.
It supports all "standard" bauds listed in
include/uapi/asm-generic/termbits.h

Signed-off-by: Carlos Hernandez <ceh@ti.com>
---
 ...01-Add-option-to-enable-internal-loopback.patch | 81 ++++++++++++++++++++++
 .../0002-Restore-original-loopback-config.patch    | 49 +++++++++++++
 .../serialcheck/serialcheck_1.0.0.bb               | 22 ++++++
 3 files changed, 152 insertions(+)
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb

diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
new file mode 100644
index 0000000..c351fd3
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
@@ -0,0 +1,81 @@
+From 059d5512e840fe68e2bb37add6c9208fa9c34d15 Mon Sep 17 00:00:00 2001
+From: Sekhar Nori <nsekhar@ti.com>
+Date: Tue, 24 Feb 2015 22:16:37 +0530
+Subject: [PATCH 1/2] Add option to enable internal loopback
+
+---
+ serialcheck.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/serialcheck.c b/serialcheck.c
+index 4f5b747..4100c37 100644
+--- a/serialcheck.c
++++ b/serialcheck.c
+@@ -12,6 +12,8 @@
+ #include <sys/ioctl.h>
+ #include <linux/serial.h>
+ 
++#define TIOCM_LOOP	0x8000
++
+ #define __same_type(a, b)	__builtin_types_compatible_p(typeof(a), typeof(b))
+ #define BUILD_BUG_ON_ZERO(e)	(sizeof(struct { int:-!!(e); }))
+ #define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+@@ -40,6 +42,7 @@ struct g_opt {
+ 	unsigned char hflow;
+ 	unsigned char do_termios;
+ 	unsigned char *cmp_buff;
++	unsigned char loopback;
+ };
+ 
+ /* name, key, arg, flags, doc, group */
+@@ -51,6 +54,7 @@ static struct argp_option options[] = {
+ 	{"mode",	'm', "M",    0, "transfer mode (d = duplex, t = send r = receive)", 0},
+ 	{"loops",	'l', "NUM",  0, "loops to perform (0 => wait fot CTRL-C", 0},
+ 	{"no-termios",	'n', NULL,   0, "No termios change (baud rate etc. remains unchanged)", 0},
++	{"loopback",	'k', NULL,   0, "loopback mode", 0},
+ 	{NULL, 0, NULL, 0, NULL, 0}
+ };
+ 
+@@ -67,6 +71,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
+ 		go->baudrate = 115200;
+ 		go->loops = UINT_MAX;
+ 		go->do_termios = 1;
++		go->loopback = 0;
+ 		break;
+ 	case ARGP_KEY_ARG:
+ 		ret =  ARGP_ERR_UNKNOWN;
+@@ -113,6 +118,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
+ 		} else
+ 			go->loops = num;
+ 		break;
++	case 'k':
++		go->loopback = 1;
++		break;
+ 	default:
+ 		ret = ARGP_ERR_UNKNOWN;
+ 	}
+@@ -487,6 +495,21 @@ int main(int argc, char *argv[])
+ 			die("tcflush failed: %m\n");
+ 	}
+ 
++	if (opts.loopback) {
++		unsigned int mcr;
++
++		ret = ioctl(fd, TIOCMGET, &mcr);
++		if (ret < 0)
++			die("mcr get failed: %m\n");
++
++		mcr |= TIOCM_LOOP;
++
++		ret = ioctl(fd, TIOCMSET, &mcr);
++		if (ret < 0)
++			die ("mcr set failed: %m\n");
++		
++	}
++
+ 	ret = fcntl(fd, F_SETFL, 0);
+ 	if (ret)
+ 		printf("Failed to remove nonblock mode\n");
+-- 
+1.9.1
+
diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
new file mode 100644
index 0000000..ea03578
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
@@ -0,0 +1,49 @@
+From a6e5813d2f8402bf3a311c8bcda02623bfb76882 Mon Sep 17 00:00:00 2001
+From: Carlos Hernandez <ceh@ti.com>
+Date: Tue, 24 Feb 2015 16:00:34 -0500
+Subject: [PATCH 2/2] Restore original loopback config
+
+If loopback option is enabled. Disabled it at the end of the test.
+
+Signed-off-by: Carlos Hernandez <ceh@ti.com>
+---
+ serialcheck.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/serialcheck.c b/serialcheck.c
+index 4100c37..06470f7 100644
+--- a/serialcheck.c
++++ b/serialcheck.c
+@@ -427,6 +427,7 @@ int main(int argc, char *argv[])
+ 	unsigned char *data;
+ 	unsigned int open_mode;
+ 	off_t data_len;
++	unsigned int mcr;
+ 
+ 	argp_parse(&argp, argc, argv, 0, NULL, &opts);
+ 	if (!opts.file_trans)
+@@ -496,8 +497,6 @@ int main(int argc, char *argv[])
+ 	}
+ 
+ 	if (opts.loopback) {
+-		unsigned int mcr;
+-
+ 		ret = ioctl(fd, TIOCMGET, &mcr);
+ 		if (ret < 0)
+ 			die("mcr get failed: %m\n");
+@@ -535,6 +534,12 @@ int main(int argc, char *argv[])
+ 	ret = tcsetattr(fd, TCSAFLUSH, &old_term);
+ 	if (ret)
+ 		printf("tcsetattr() of old ones failed: %m\n");
++    if (opts.loopback) {
++		mcr &= ~(TIOCM_LOOP);
++		ret = ioctl(fd, TIOCMSET, &mcr);
++    }
++    if (ret)
++		printf("disabling loopback failed: %m\n");
+ 
+ 	close(fd);
+ 	return status;
+-- 
+1.9.1
+
diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
new file mode 100644
index 0000000..83b4798
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Application to verify operation of serial ports"
+HOMEPAGE = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+SRC_URI = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
+
+SRC_URI_append = " file://0001-Add-option-to-enable-internal-loopback.patch \
+                   file://0002-Restore-original-loopback-config.patch "
+
+SRCREV = "63854a2d0c0129efab132ec328a75279e013fb84"
+
+S = "${WORKDIR}/git"
+
+CFLAGS_prepend = "-Wall -Wextra -Wno-sign-compare -Wno-pointer-sign "
+
+do_install() {
+    install -d ${D}${base_bindir}
+    install ${S}/serialcheck  ${D}${base_bindir}/serialcheck
+}
+
+
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] packagegroup-arago-test: Add serialcheck
  2015-02-27 20:55 [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Carlos Hernandez
@ 2015-02-27 20:55 ` Carlos Hernandez
  2015-02-27 20:55 ` [PATCH 3/3] ltp-ddt: Add runtime dependency to serialcheck Carlos Hernandez
  2015-02-27 22:34 ` [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Denys Dmytriyenko
  2 siblings, 0 replies; 8+ messages in thread
From: Carlos Hernandez @ 2015-02-27 20:55 UTC (permalink / raw)
  To: meta-arago

Add serialcheck utility to validate serial ports.

Signed-off-by: Carlos Hernandez <ceh@ti.com>
---
 meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb
index 051f32b..d6fc0f5 100644
--- a/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb
+++ b/meta-arago-distro/recipes-core/packagegroups/packagegroup-arago-test.bb
@@ -23,6 +23,7 @@ ARAGO_TEST = "\
     rng-tools \
     perf \
     v4l-utils \
+    serialcheck \
     "
 
 ARAGO_TI_TEST = "\
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] ltp-ddt: Add runtime dependency to serialcheck
  2015-02-27 20:55 [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Carlos Hernandez
  2015-02-27 20:55 ` [PATCH 2/3] packagegroup-arago-test: Add serialcheck Carlos Hernandez
@ 2015-02-27 20:55 ` Carlos Hernandez
  2015-02-27 22:34 ` [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Denys Dmytriyenko
  2 siblings, 0 replies; 8+ messages in thread
From: Carlos Hernandez @ 2015-02-27 20:55 UTC (permalink / raw)
  To: meta-arago

New uart tests on ltp-ddt depends on serialcheck utility, so add
serialcheck as runtime dependency to ltp-ddt.

Signed-off-by: Carlos Hernandez <ceh@ti.com>
---
 meta-arago-distro/recipes-devtools/ltp-ddt/ltp-ddt_0.0.4.bbappend | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta-arago-distro/recipes-devtools/ltp-ddt/ltp-ddt_0.0.4.bbappend b/meta-arago-distro/recipes-devtools/ltp-ddt/ltp-ddt_0.0.4.bbappend
index 43660ae..9afc2fc 100644
--- a/meta-arago-distro/recipes-devtools/ltp-ddt/ltp-ddt_0.0.4.bbappend
+++ b/meta-arago-distro/recipes-devtools/ltp-ddt/ltp-ddt_0.0.4.bbappend
@@ -1,6 +1,6 @@
 PR_append = "-arago10+gitr${SRCPV}"
 
-RDEPENDS_${PN} += "linaro-pm-qa-utils"
+RDEPENDS_${PN} += "linaro-pm-qa-utils serialcheck"
 
 SRC_URI_remove = "file://0001-KERNEL_INC-in-modern-kernel-should-point-at-toplevel.patch"
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe
  2015-02-27 20:55 [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Carlos Hernandez
  2015-02-27 20:55 ` [PATCH 2/3] packagegroup-arago-test: Add serialcheck Carlos Hernandez
  2015-02-27 20:55 ` [PATCH 3/3] ltp-ddt: Add runtime dependency to serialcheck Carlos Hernandez
@ 2015-02-27 22:34 ` Denys Dmytriyenko
  2015-03-02 16:03   ` [PATCH 1/3 v2] " Carlos Hernandez
  2 siblings, 1 reply; 8+ messages in thread
From: Denys Dmytriyenko @ 2015-02-27 22:34 UTC (permalink / raw)
  To: Carlos Hernandez; +Cc: meta-arago

This patch has trailing whitespaces at the end of the files, which git am 
complains about. Can you fix those? Thanks.


On Fri, Feb 27, 2015 at 03:55:11PM -0500, Carlos Hernandez wrote:
> Serialcheck is a simple utility to verify serial ports functionality.
> It supports all "standard" bauds listed in
> include/uapi/asm-generic/termbits.h
> 
> Signed-off-by: Carlos Hernandez <ceh@ti.com>
> ---
>  ...01-Add-option-to-enable-internal-loopback.patch | 81 ++++++++++++++++++++++
>  .../0002-Restore-original-loopback-config.patch    | 49 +++++++++++++
>  .../serialcheck/serialcheck_1.0.0.bb               | 22 ++++++
>  3 files changed, 152 insertions(+)
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> 
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
> new file mode 100644
> index 0000000..c351fd3
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
> @@ -0,0 +1,81 @@
> +From 059d5512e840fe68e2bb37add6c9208fa9c34d15 Mon Sep 17 00:00:00 2001
> +From: Sekhar Nori <nsekhar@ti.com>
> +Date: Tue, 24 Feb 2015 22:16:37 +0530
> +Subject: [PATCH 1/2] Add option to enable internal loopback
> +
> +---
> + serialcheck.c | 23 +++++++++++++++++++++++
> + 1 file changed, 23 insertions(+)
> +
> +diff --git a/serialcheck.c b/serialcheck.c
> +index 4f5b747..4100c37 100644
> +--- a/serialcheck.c
> ++++ b/serialcheck.c
> +@@ -12,6 +12,8 @@
> + #include <sys/ioctl.h>
> + #include <linux/serial.h>
> + 
> ++#define TIOCM_LOOP	0x8000
> ++
> + #define __same_type(a, b)	__builtin_types_compatible_p(typeof(a), typeof(b))
> + #define BUILD_BUG_ON_ZERO(e)	(sizeof(struct { int:-!!(e); }))
> + #define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> +@@ -40,6 +42,7 @@ struct g_opt {
> + 	unsigned char hflow;
> + 	unsigned char do_termios;
> + 	unsigned char *cmp_buff;
> ++	unsigned char loopback;
> + };
> + 
> + /* name, key, arg, flags, doc, group */
> +@@ -51,6 +54,7 @@ static struct argp_option options[] = {
> + 	{"mode",	'm', "M",    0, "transfer mode (d = duplex, t = send r = receive)", 0},
> + 	{"loops",	'l', "NUM",  0, "loops to perform (0 => wait fot CTRL-C", 0},
> + 	{"no-termios",	'n', NULL,   0, "No termios change (baud rate etc. remains unchanged)", 0},
> ++	{"loopback",	'k', NULL,   0, "loopback mode", 0},
> + 	{NULL, 0, NULL, 0, NULL, 0}
> + };
> + 
> +@@ -67,6 +71,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
> + 		go->baudrate = 115200;
> + 		go->loops = UINT_MAX;
> + 		go->do_termios = 1;
> ++		go->loopback = 0;
> + 		break;
> + 	case ARGP_KEY_ARG:
> + 		ret =  ARGP_ERR_UNKNOWN;
> +@@ -113,6 +118,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
> + 		} else
> + 			go->loops = num;
> + 		break;
> ++	case 'k':
> ++		go->loopback = 1;
> ++		break;
> + 	default:
> + 		ret = ARGP_ERR_UNKNOWN;
> + 	}
> +@@ -487,6 +495,21 @@ int main(int argc, char *argv[])
> + 			die("tcflush failed: %m\n");
> + 	}
> + 
> ++	if (opts.loopback) {
> ++		unsigned int mcr;
> ++
> ++		ret = ioctl(fd, TIOCMGET, &mcr);
> ++		if (ret < 0)
> ++			die("mcr get failed: %m\n");
> ++
> ++		mcr |= TIOCM_LOOP;
> ++
> ++		ret = ioctl(fd, TIOCMSET, &mcr);
> ++		if (ret < 0)
> ++			die ("mcr set failed: %m\n");
> ++		
> ++	}
> ++
> + 	ret = fcntl(fd, F_SETFL, 0);
> + 	if (ret)
> + 		printf("Failed to remove nonblock mode\n");
> +-- 
> +1.9.1
> +
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
> new file mode 100644
> index 0000000..ea03578
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
> @@ -0,0 +1,49 @@
> +From a6e5813d2f8402bf3a311c8bcda02623bfb76882 Mon Sep 17 00:00:00 2001
> +From: Carlos Hernandez <ceh@ti.com>
> +Date: Tue, 24 Feb 2015 16:00:34 -0500
> +Subject: [PATCH 2/2] Restore original loopback config
> +
> +If loopback option is enabled. Disabled it at the end of the test.
> +
> +Signed-off-by: Carlos Hernandez <ceh@ti.com>
> +---
> + serialcheck.c | 9 +++++++--
> + 1 file changed, 7 insertions(+), 2 deletions(-)
> +
> +diff --git a/serialcheck.c b/serialcheck.c
> +index 4100c37..06470f7 100644
> +--- a/serialcheck.c
> ++++ b/serialcheck.c
> +@@ -427,6 +427,7 @@ int main(int argc, char *argv[])
> + 	unsigned char *data;
> + 	unsigned int open_mode;
> + 	off_t data_len;
> ++	unsigned int mcr;
> + 
> + 	argp_parse(&argp, argc, argv, 0, NULL, &opts);
> + 	if (!opts.file_trans)
> +@@ -496,8 +497,6 @@ int main(int argc, char *argv[])
> + 	}
> + 
> + 	if (opts.loopback) {
> +-		unsigned int mcr;
> +-
> + 		ret = ioctl(fd, TIOCMGET, &mcr);
> + 		if (ret < 0)
> + 			die("mcr get failed: %m\n");
> +@@ -535,6 +534,12 @@ int main(int argc, char *argv[])
> + 	ret = tcsetattr(fd, TCSAFLUSH, &old_term);
> + 	if (ret)
> + 		printf("tcsetattr() of old ones failed: %m\n");
> ++    if (opts.loopback) {
> ++		mcr &= ~(TIOCM_LOOP);
> ++		ret = ioctl(fd, TIOCMSET, &mcr);
> ++    }
> ++    if (ret)
> ++		printf("disabling loopback failed: %m\n");
> + 
> + 	close(fd);
> + 	return status;
> +-- 
> +1.9.1
> +
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> new file mode 100644
> index 0000000..83b4798
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> @@ -0,0 +1,22 @@
> +SUMMARY = "Application to verify operation of serial ports"
> +HOMEPAGE = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
> +LICENSE = "GPLv2"
> +
> +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> +SRC_URI = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
> +
> +SRC_URI_append = " file://0001-Add-option-to-enable-internal-loopback.patch \
> +                   file://0002-Restore-original-loopback-config.patch "
> +
> +SRCREV = "63854a2d0c0129efab132ec328a75279e013fb84"
> +
> +S = "${WORKDIR}/git"
> +
> +CFLAGS_prepend = "-Wall -Wextra -Wno-sign-compare -Wno-pointer-sign "
> +
> +do_install() {
> +    install -d ${D}${base_bindir}
> +    install ${S}/serialcheck  ${D}${base_bindir}/serialcheck
> +}
> +
> +
> -- 
> 1.9.1
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3 v2] meta-arago-distro/recipes-devtools: serialcheck recipe
  2015-02-27 22:34 ` [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Denys Dmytriyenko
@ 2015-03-02 16:03   ` Carlos Hernandez
  2015-03-04  0:37     ` Denys Dmytriyenko
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Hernandez @ 2015-03-02 16:03 UTC (permalink / raw)
  To: meta-arago

Serialcheck is a simple utility to verify serial ports functionality.
It supports all "standard" bauds listed in
include/uapi/asm-generic/termbits.h

Signed-off-by: Carlos Hernandez <ceh@ti.com>
---
 ...01-Add-option-to-enable-internal-loopback.patch | 80 ++++++++++++++++++++++
 .../0002-Restore-original-loopback-config.patch    | 48 +++++++++++++
 .../serialcheck/serialcheck_1.0.0.bb               | 20 ++++++
 3 files changed, 148 insertions(+)
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
 create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb

diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
new file mode 100644
index 0000000..fc387d7
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
@@ -0,0 +1,80 @@
+From 059d5512e840fe68e2bb37add6c9208fa9c34d15 Mon Sep 17 00:00:00 2001
+From: Sekhar Nori <nsekhar@ti.com>
+Date: Tue, 24 Feb 2015 22:16:37 +0530
+Subject: [PATCH 1/2] Add option to enable internal loopback
+
+---
+ serialcheck.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/serialcheck.c b/serialcheck.c
+index 4f5b747..4100c37 100644
+--- a/serialcheck.c
++++ b/serialcheck.c
+@@ -12,6 +12,8 @@
+ #include <sys/ioctl.h>
+ #include <linux/serial.h>
+
++#define TIOCM_LOOP	0x8000
++
+ #define __same_type(a, b)	__builtin_types_compatible_p(typeof(a), typeof(b))
+ #define BUILD_BUG_ON_ZERO(e)	(sizeof(struct { int:-!!(e); }))
+ #define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+@@ -40,6 +42,7 @@ struct g_opt {
+	unsigned char hflow;
+	unsigned char do_termios;
+	unsigned char *cmp_buff;
++	unsigned char loopback;
+ };
+
+ /* name, key, arg, flags, doc, group */
+@@ -51,6 +54,7 @@ static struct argp_option options[] = {
+	{"mode",	'm', "M",    0, "transfer mode (d = duplex, t = send r = receive)", 0},
+	{"loops",	'l', "NUM",  0, "loops to perform (0 => wait fot CTRL-C", 0},
+	{"no-termios",	'n', NULL,   0, "No termios change (baud rate etc. remains unchanged)", 0},
++	{"loopback",	'k', NULL,   0, "loopback mode", 0},
+	{NULL, 0, NULL, 0, NULL, 0}
+ };
+
+@@ -67,6 +71,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
+		go->baudrate = 115200;
+		go->loops = UINT_MAX;
+		go->do_termios = 1;
++		go->loopback = 0;
+		break;
+	case ARGP_KEY_ARG:
+		ret =  ARGP_ERR_UNKNOWN;
+@@ -113,6 +118,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
+		} else
+			go->loops = num;
+		break;
++	case 'k':
++		go->loopback = 1;
++		break;
+	default:
+		ret = ARGP_ERR_UNKNOWN;
+	}
+@@ -487,6 +495,21 @@ int main(int argc, char *argv[])
+			die("tcflush failed: %m\n");
+	}
+
++	if (opts.loopback) {
++		unsigned int mcr;
++
++		ret = ioctl(fd, TIOCMGET, &mcr);
++		if (ret < 0)
++			die("mcr get failed: %m\n");
++
++		mcr |= TIOCM_LOOP;
++
++		ret = ioctl(fd, TIOCMSET, &mcr);
++		if (ret < 0)
++			die ("mcr set failed: %m\n");
++
++	}
++
+	ret = fcntl(fd, F_SETFL, 0);
+	if (ret)
+		printf("Failed to remove nonblock mode\n");
+--
+1.9.1
diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
new file mode 100644
index 0000000..c9478fc
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
@@ -0,0 +1,48 @@
+From a6e5813d2f8402bf3a311c8bcda02623bfb76882 Mon Sep 17 00:00:00 2001
+From: Carlos Hernandez <ceh@ti.com>
+Date: Tue, 24 Feb 2015 16:00:34 -0500
+Subject: [PATCH 2/2] Restore original loopback config
+
+If loopback option is enabled. Disabled it at the end of the test.
+
+Signed-off-by: Carlos Hernandez <ceh@ti.com>
+---
+ serialcheck.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/serialcheck.c b/serialcheck.c
+index 4100c37..06470f7 100644
+--- a/serialcheck.c
++++ b/serialcheck.c
+@@ -427,6 +427,7 @@ int main(int argc, char *argv[])
+	unsigned char *data;
+	unsigned int open_mode;
+	off_t data_len;
++	unsigned int mcr;
+
+	argp_parse(&argp, argc, argv, 0, NULL, &opts);
+	if (!opts.file_trans)
+@@ -496,8 +497,6 @@ int main(int argc, char *argv[])
+	}
+
+	if (opts.loopback) {
+-		unsigned int mcr;
+-
+		ret = ioctl(fd, TIOCMGET, &mcr);
+		if (ret < 0)
+			die("mcr get failed: %m\n");
+@@ -535,6 +534,12 @@ int main(int argc, char *argv[])
+	ret = tcsetattr(fd, TCSAFLUSH, &old_term);
+	if (ret)
+		printf("tcsetattr() of old ones failed: %m\n");
++    if (opts.loopback) {
++		mcr &= ~(TIOCM_LOOP);
++		ret = ioctl(fd, TIOCMSET, &mcr);
++    }
++    if (ret)
++		printf("disabling loopback failed: %m\n");
+
+	close(fd);
+	return status;
+--
+1.9.1
diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
new file mode 100644
index 0000000..6929ffc
--- /dev/null
+++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
@@ -0,0 +1,20 @@
+SUMMARY = "Application to verify operation of serial ports"
+HOMEPAGE = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
+LICENSE = "GPLv2"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+SRC_URI = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
+
+SRC_URI_append = " file://0001-Add-option-to-enable-internal-loopback.patch \
+                   file://0002-Restore-original-loopback-config.patch "
+
+SRCREV = "63854a2d0c0129efab132ec328a75279e013fb84"
+
+S = "${WORKDIR}/git"
+
+CFLAGS_prepend = "-Wall -Wextra -Wno-sign-compare -Wno-pointer-sign "
+
+do_install() {
+    install -d ${D}${base_bindir}
+    install ${S}/serialcheck  ${D}${base_bindir}/serialcheck
+}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3 v2] meta-arago-distro/recipes-devtools: serialcheck recipe
  2015-03-02 16:03   ` [PATCH 1/3 v2] " Carlos Hernandez
@ 2015-03-04  0:37     ` Denys Dmytriyenko
  2015-03-04 14:38       ` Carlos Hernandez
  0 siblings, 1 reply; 8+ messages in thread
From: Denys Dmytriyenko @ 2015-03-04  0:37 UTC (permalink / raw)
  To: Carlos Hernandez; +Cc: meta-arago

On Mon, Mar 02, 2015 at 11:03:28AM -0500, Carlos Hernandez wrote:
> Serialcheck is a simple utility to verify serial ports functionality.
> It supports all "standard" bauds listed in
> include/uapi/asm-generic/termbits.h

Looks good, thanks. Just a small clarification - I see you install it in /bin 
instead of more standard /usr/bin. Is there any special reason for that?


> Signed-off-by: Carlos Hernandez <ceh@ti.com>
> ---
>  ...01-Add-option-to-enable-internal-loopback.patch | 80 ++++++++++++++++++++++
>  .../0002-Restore-original-loopback-config.patch    | 48 +++++++++++++
>  .../serialcheck/serialcheck_1.0.0.bb               | 20 ++++++
>  3 files changed, 148 insertions(+)
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
>  create mode 100644 meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> 
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
> new file mode 100644
> index 0000000..fc387d7
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0001-Add-option-to-enable-internal-loopback.patch
> @@ -0,0 +1,80 @@
> +From 059d5512e840fe68e2bb37add6c9208fa9c34d15 Mon Sep 17 00:00:00 2001
> +From: Sekhar Nori <nsekhar@ti.com>
> +Date: Tue, 24 Feb 2015 22:16:37 +0530
> +Subject: [PATCH 1/2] Add option to enable internal loopback
> +
> +---
> + serialcheck.c | 23 +++++++++++++++++++++++
> + 1 file changed, 23 insertions(+)
> +
> +diff --git a/serialcheck.c b/serialcheck.c
> +index 4f5b747..4100c37 100644
> +--- a/serialcheck.c
> ++++ b/serialcheck.c
> +@@ -12,6 +12,8 @@
> + #include <sys/ioctl.h>
> + #include <linux/serial.h>
> +
> ++#define TIOCM_LOOP	0x8000
> ++
> + #define __same_type(a, b)	__builtin_types_compatible_p(typeof(a), typeof(b))
> + #define BUILD_BUG_ON_ZERO(e)	(sizeof(struct { int:-!!(e); }))
> + #define __must_be_array(a)	BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> +@@ -40,6 +42,7 @@ struct g_opt {
> +	unsigned char hflow;
> +	unsigned char do_termios;
> +	unsigned char *cmp_buff;
> ++	unsigned char loopback;
> + };
> +
> + /* name, key, arg, flags, doc, group */
> +@@ -51,6 +54,7 @@ static struct argp_option options[] = {
> +	{"mode",	'm', "M",    0, "transfer mode (d = duplex, t = send r = receive)", 0},
> +	{"loops",	'l', "NUM",  0, "loops to perform (0 => wait fot CTRL-C", 0},
> +	{"no-termios",	'n', NULL,   0, "No termios change (baud rate etc. remains unchanged)", 0},
> ++	{"loopback",	'k', NULL,   0, "loopback mode", 0},
> +	{NULL, 0, NULL, 0, NULL, 0}
> + };
> +
> +@@ -67,6 +71,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
> +		go->baudrate = 115200;
> +		go->loops = UINT_MAX;
> +		go->do_termios = 1;
> ++		go->loopback = 0;
> +		break;
> +	case ARGP_KEY_ARG:
> +		ret =  ARGP_ERR_UNKNOWN;
> +@@ -113,6 +118,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
> +		} else
> +			go->loops = num;
> +		break;
> ++	case 'k':
> ++		go->loopback = 1;
> ++		break;
> +	default:
> +		ret = ARGP_ERR_UNKNOWN;
> +	}
> +@@ -487,6 +495,21 @@ int main(int argc, char *argv[])
> +			die("tcflush failed: %m\n");
> +	}
> +
> ++	if (opts.loopback) {
> ++		unsigned int mcr;
> ++
> ++		ret = ioctl(fd, TIOCMGET, &mcr);
> ++		if (ret < 0)
> ++			die("mcr get failed: %m\n");
> ++
> ++		mcr |= TIOCM_LOOP;
> ++
> ++		ret = ioctl(fd, TIOCMSET, &mcr);
> ++		if (ret < 0)
> ++			die ("mcr set failed: %m\n");
> ++
> ++	}
> ++
> +	ret = fcntl(fd, F_SETFL, 0);
> +	if (ret)
> +		printf("Failed to remove nonblock mode\n");
> +--
> +1.9.1
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
> new file mode 100644
> index 0000000..c9478fc
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck/0002-Restore-original-loopback-config.patch
> @@ -0,0 +1,48 @@
> +From a6e5813d2f8402bf3a311c8bcda02623bfb76882 Mon Sep 17 00:00:00 2001
> +From: Carlos Hernandez <ceh@ti.com>
> +Date: Tue, 24 Feb 2015 16:00:34 -0500
> +Subject: [PATCH 2/2] Restore original loopback config
> +
> +If loopback option is enabled. Disabled it at the end of the test.
> +
> +Signed-off-by: Carlos Hernandez <ceh@ti.com>
> +---
> + serialcheck.c | 9 +++++++--
> + 1 file changed, 7 insertions(+), 2 deletions(-)
> +
> +diff --git a/serialcheck.c b/serialcheck.c
> +index 4100c37..06470f7 100644
> +--- a/serialcheck.c
> ++++ b/serialcheck.c
> +@@ -427,6 +427,7 @@ int main(int argc, char *argv[])
> +	unsigned char *data;
> +	unsigned int open_mode;
> +	off_t data_len;
> ++	unsigned int mcr;
> +
> +	argp_parse(&argp, argc, argv, 0, NULL, &opts);
> +	if (!opts.file_trans)
> +@@ -496,8 +497,6 @@ int main(int argc, char *argv[])
> +	}
> +
> +	if (opts.loopback) {
> +-		unsigned int mcr;
> +-
> +		ret = ioctl(fd, TIOCMGET, &mcr);
> +		if (ret < 0)
> +			die("mcr get failed: %m\n");
> +@@ -535,6 +534,12 @@ int main(int argc, char *argv[])
> +	ret = tcsetattr(fd, TCSAFLUSH, &old_term);
> +	if (ret)
> +		printf("tcsetattr() of old ones failed: %m\n");
> ++    if (opts.loopback) {
> ++		mcr &= ~(TIOCM_LOOP);
> ++		ret = ioctl(fd, TIOCMSET, &mcr);
> ++    }
> ++    if (ret)
> ++		printf("disabling loopback failed: %m\n");
> +
> +	close(fd);
> +	return status;
> +--
> +1.9.1
> diff --git a/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> new file mode 100644
> index 0000000..6929ffc
> --- /dev/null
> +++ b/meta-arago-distro/recipes-devtools/serialcheck/serialcheck_1.0.0.bb
> @@ -0,0 +1,20 @@
> +SUMMARY = "Application to verify operation of serial ports"
> +HOMEPAGE = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
> +LICENSE = "GPLv2"
> +
> +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
> +SRC_URI = "git://git.breakpoint.cc/bigeasy/serialcheck.git"
> +
> +SRC_URI_append = " file://0001-Add-option-to-enable-internal-loopback.patch \
> +                   file://0002-Restore-original-loopback-config.patch "
> +
> +SRCREV = "63854a2d0c0129efab132ec328a75279e013fb84"
> +
> +S = "${WORKDIR}/git"
> +
> +CFLAGS_prepend = "-Wall -Wextra -Wno-sign-compare -Wno-pointer-sign "
> +
> +do_install() {
> +    install -d ${D}${base_bindir}
> +    install ${S}/serialcheck  ${D}${base_bindir}/serialcheck
> +}
> -- 
> 1.9.1
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3 v2] meta-arago-distro/recipes-devtools: serialcheck recipe
  2015-03-04  0:37     ` Denys Dmytriyenko
@ 2015-03-04 14:38       ` Carlos Hernandez
  2015-03-04 14:46         ` Denys Dmytriyenko
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Hernandez @ 2015-03-04 14:38 UTC (permalink / raw)
  To: Denys Dmytriyenko; +Cc: meta-arago

On 03/03/2015 07:37 PM, Denys Dmytriyenko wrote:
> On Mon, Mar 02, 2015 at 11:03:28AM -0500, Carlos Hernandez wrote:
>> >Serialcheck is a simple utility to verify serial ports functionality.
>> >It supports all "standard" bauds listed in
>> >include/uapi/asm-generic/termbits.h
> Looks good, thanks. Just a small clarification - I see you install it in /bin
> instead of more standard /usr/bin. Is there any special reason for that?
>
>

No, it could be placed is /usr/bin. Could you change it when you apply 
the patch or do I have to submit another version?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3 v2] meta-arago-distro/recipes-devtools: serialcheck recipe
  2015-03-04 14:38       ` Carlos Hernandez
@ 2015-03-04 14:46         ` Denys Dmytriyenko
  0 siblings, 0 replies; 8+ messages in thread
From: Denys Dmytriyenko @ 2015-03-04 14:46 UTC (permalink / raw)
  To: Carlos Hernandez; +Cc: meta-arago

On Wed, Mar 04, 2015 at 09:38:05AM -0500, Carlos Hernandez wrote:
> On 03/03/2015 07:37 PM, Denys Dmytriyenko wrote:
> >On Mon, Mar 02, 2015 at 11:03:28AM -0500, Carlos Hernandez wrote:
> >>>Serialcheck is a simple utility to verify serial ports functionality.
> >>>It supports all "standard" bauds listed in
> >>>include/uapi/asm-generic/termbits.h
> >Looks good, thanks. Just a small clarification - I see you install it in /bin
> >instead of more standard /usr/bin. Is there any special reason for that?
> >
> >
> 
> No, it could be placed is /usr/bin. Could you change it when you
> apply the patch or do I have to submit another version?

Sure, I can change it.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-04 14:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 20:55 [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Carlos Hernandez
2015-02-27 20:55 ` [PATCH 2/3] packagegroup-arago-test: Add serialcheck Carlos Hernandez
2015-02-27 20:55 ` [PATCH 3/3] ltp-ddt: Add runtime dependency to serialcheck Carlos Hernandez
2015-02-27 22:34 ` [PATCH 1/3] meta-arago-distro/recipes-devtools: serialcheck recipe Denys Dmytriyenko
2015-03-02 16:03   ` [PATCH 1/3 v2] " Carlos Hernandez
2015-03-04  0:37     ` Denys Dmytriyenko
2015-03-04 14:38       ` Carlos Hernandez
2015-03-04 14:46         ` Denys Dmytriyenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.