Re: [meta-intel] [meta-intel LMS][PATCHV2 1/2] Fix device file referance to /dev/mei0 and remove select post write.

2017-07-07 Thread Wold, Saul

Well, sorry, but this is also not correct!  

This commit message needs to be inside the patch you are creating below
and the this along with 2/2 should be 1 patch.

You can then submit this as you did the first version.  Again, please
review the wiki links I sent you.

See below in the .patch diff

Sau!



On Fri, 2017-07-07 at 11:34 -0700, Anand Vastrad wrote:
> LMS uses /dev/mei character device which is absent on current kernel
> versions causing LMS fail to initialize. LMS sends messages to MEI
> with a post select timeout. Select timeout causes SendMessage to fail
> causing LMS to not to communicate properly with MEI.
> 
> Adding /dev/mei0 device file reference to check first and then
> /dev/mei sucessfully initializes LMS. Rely on write return length and
> remove select with timeout to fix communication with MEI.
> 
> Upstream-Status: Submitted [meta-intel@yoctoproject.org]
> 
> Signed-off-by: Anand Vastrad 
> ---
>  .../amt/lms/0003-device-file-reference-fix.patch   | 73
> ++
>  1 file changed, 73 insertions(+)
>  create mode 100644 common/recipes-bsp/amt/lms/0003-device-file-
> reference-fix.patch
> 
> diff --git a/common/recipes-bsp/amt/lms/0003-device-file-reference-
> fix.patch b/common/recipes-bsp/amt/lms/0003-device-file-reference-
> fix.patch
> new file mode 100644
> index 000..0269438
> --- /dev/null
> +++ b/common/recipes-bsp/amt/lms/0003-device-file-reference-fix.patch
> @@ -0,0 +1,73 @@

You need the above commit message here, however you create your patches
for LMS, you need the above commit message here.

> +--- lms8_8.0.0-7.orig/src/mei/MEILinux.cpp   2012-10-11
> 05:16:05.0 -0700
>  lms8_8.0.0-7/src/mei/MEILinux.cpp2017-06-21
> 15:14:13.725853901 -0700
> +@@ -94,13 +94,17 @@
> + Deinit();
> + }
> +
> +-_fd = open("/dev/mei", O_RDWR);
> ++_fd = open("/dev/mei0", O_RDWR);
> +
> + if (_fd == -1 ) {
> + if (_verbose) {
> +-fprintf(stderr, "Error: Cannot establish a
> handle to the MEI driver\n");
> ++fprintf(stderr, "Warning: Cannot establish
> a handle to the MEI driver mei0, retrying with mei \n");
> ++}
> ++_fd = open("/dev/mei", O_RDWR);
> ++if (_fd == -1 ) {
> ++fprintf(stderr, "Error: Cannot establish a
> handle to the MEI driver mei\n");
> ++return false;
> + }
> +-return false;
> + }
> + _initialized = true;
> +
> +@@ -181,13 +185,7 @@
> + int MEILinux::SendMessage(const unsigned char *buffer, int len,
> unsigned long timeout)
> + {
> + int rv = 0;
> +-int return_length =0;
> + int error = 0;
> +-fd_set set;
> +-struct timeval tv;
> +-
> +-tv.tv_sec =  timeout / 1000;
> +-tv.tv_usec =(timeout % 1000) * 100;
> +
> + if (_verbose) {
> + fprintf(stdout, "call write length = %d\n", len);
> +@@ -198,35 +196,8 @@
> + if (_verbose) {
> + fprintf(stderr,"write failed with status %d
> %d\n", rv, error);
> + }
> +-goto out;
> +-}
> +-
> +-return_length = rv;
> +-
> +-FD_ZERO(&set);
> +-FD_SET(_fd, &set);
> +-rv = select(_fd+1 ,&set, NULL, NULL, &tv);
> +-if (rv > 0 && FD_ISSET(_fd, &set)) {
> +-if (_verbose) {
> +-fprintf(stderr, "write success\n");
> +-}
> + }
> +-else if (rv == 0) {
> +-if (_verbose) {
> +-fprintf(stderr, "write failed on timeout
> with status\n");
> +-}
> +-goto out;
> +-}
> +-else { //rv<0
> +-if (_verbose) {
> +-fprintf(stderr, "write failed on select
> with status %d\n", rv);
> +-}
> +-goto out;
> +-}
> +-
> +-rv = return_length;
> +
> +-out:
> + if (rv < 0) {
> + Deinit();
> + }
-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel


[meta-intel] [meta-intel LMS][PATCHV2 1/2] Fix device file referance to /dev/mei0 and remove select post write.

2017-07-07 Thread Anand Vastrad
LMS uses /dev/mei character device which is absent on current kernel versions 
causing LMS fail to initialize. LMS sends messages to MEI with a post select 
timeout. Select timeout causes SendMessage to fail causing LMS to not to 
communicate properly with MEI.

Adding /dev/mei0 device file reference to check first and then /dev/mei 
sucessfully initializes LMS. Rely on write return length and remove select with 
timeout to fix communication with MEI.

Upstream-Status: Submitted [meta-intel@yoctoproject.org]

Signed-off-by: Anand Vastrad 
---
 .../amt/lms/0003-device-file-reference-fix.patch   | 73 ++
 1 file changed, 73 insertions(+)
 create mode 100644 
common/recipes-bsp/amt/lms/0003-device-file-reference-fix.patch

diff --git a/common/recipes-bsp/amt/lms/0003-device-file-reference-fix.patch 
b/common/recipes-bsp/amt/lms/0003-device-file-reference-fix.patch
new file mode 100644
index 000..0269438
--- /dev/null
+++ b/common/recipes-bsp/amt/lms/0003-device-file-reference-fix.patch
@@ -0,0 +1,73 @@
+--- lms8_8.0.0-7.orig/src/mei/MEILinux.cpp 2012-10-11 05:16:05.0 
-0700
 lms8_8.0.0-7/src/mei/MEILinux.cpp  2017-06-21 15:14:13.725853901 -0700
+@@ -94,13 +94,17 @@
+   Deinit();
+   }
+
+-  _fd = open("/dev/mei", O_RDWR);
++  _fd = open("/dev/mei0", O_RDWR);
+
+   if (_fd == -1 ) {
+   if (_verbose) {
+-  fprintf(stderr, "Error: Cannot establish a handle to 
the MEI driver\n");
++  fprintf(stderr, "Warning: Cannot establish a handle to 
the MEI driver mei0, retrying with mei \n");
++  }
++  _fd = open("/dev/mei", O_RDWR);
++  if (_fd == -1 ) {
++  fprintf(stderr, "Error: Cannot establish a handle to 
the MEI driver mei\n");
++  return false;
+   }
+-  return false;
+   }
+   _initialized = true;
+
+@@ -181,13 +185,7 @@
+ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long 
timeout)
+ {
+   int rv = 0;
+-  int return_length =0;
+   int error = 0;
+-  fd_set set;
+-  struct timeval tv;
+-
+-  tv.tv_sec =  timeout / 1000;
+-  tv.tv_usec =(timeout % 1000) * 100;
+
+   if (_verbose) {
+   fprintf(stdout, "call write length = %d\n", len);
+@@ -198,35 +196,8 @@
+   if (_verbose) {
+   fprintf(stderr,"write failed with status %d %d\n", rv, 
error);
+   }
+-  goto out;
+-  }
+-
+-  return_length = rv;
+-
+-  FD_ZERO(&set);
+-  FD_SET(_fd, &set);
+-  rv = select(_fd+1 ,&set, NULL, NULL, &tv);
+-  if (rv > 0 && FD_ISSET(_fd, &set)) {
+-  if (_verbose) {
+-  fprintf(stderr, "write success\n");
+-  }
+   }
+-  else if (rv == 0) {
+-  if (_verbose) {
+-  fprintf(stderr, "write failed on timeout with 
status\n");
+-  }
+-  goto out;
+-  }
+-  else { //rv<0
+-  if (_verbose) {
+-  fprintf(stderr, "write failed on select with status 
%d\n", rv);
+-  }
+-  goto out;
+-  }
+-
+-  rv = return_length;
+
+-out:
+   if (rv < 0) {
+   Deinit();
+   }
-- 
2.7.4

-- 
___
meta-intel mailing list
meta-intel@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-intel