summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch')
-rw-r--r--recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
new file mode 100644
index 0000000..433d301
--- /dev/null
+++ b/recipes-bsp/amt/lms/0003-Fix-device-file-referance-to-dev-mei0-remove-select.patch
@@ -0,0 +1,91 @@
1Fix device file referance to /dev/mei0, remove select post write.
2
3LMS 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.
4
5Adding /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.
6
7Upstream-Status: Pending
8
9Signed-off-by: Anand Vastrad <anand.vastrad@intel.com>
10---
11 src/mei/MEILinux.cpp | 43 +++++++------------------------------------
12 1 file changed, 7 insertions(+), 36 deletions(-)
13
14diff --git a/src/mei/MEILinux.cpp b/src/mei/MEILinux.cpp
15index 1e9d28f..6d23f54 100755
16--- a/src/mei/MEILinux.cpp
17+++ b/src/mei/MEILinux.cpp
18@@ -94,13 +94,17 @@ bool MEILinux::Init(unsigned char reqProtocolVersion)
19 Deinit();
20 }
21
22- _fd = open("/dev/mei", O_RDWR);
23+ _fd = open("/dev/mei0", O_RDWR);
24
25 if (_fd == -1 ) {
26 if (_verbose) {
27- fprintf(stderr, "Error: Cannot establish a handle to the MEI driver\n");
28+ fprintf(stderr, "Warning: Cannot establish a handle to the MEI driver mei0, retrying with mei \n");
29+ }
30+ _fd = open("/dev/mei", O_RDWR);
31+ if (_fd == -1 ) {
32+ fprintf(stderr, "Error: Cannot establish a handle to the MEI driver mei\n");
33+ return false;
34 }
35- return false;
36 }
37 _initialized = true;
38
39@@ -181,13 +185,7 @@ int MEILinux::ReceiveMessage(unsigned char *buffer, int len, unsigned long timeo
40 int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long timeout)
41 {
42 int rv = 0;
43- int return_length =0;
44 int error = 0;
45- fd_set set;
46- struct timeval tv;
47-
48- tv.tv_sec = timeout / 1000;
49- tv.tv_usec =(timeout % 1000) * 1000000;
50
51 if (_verbose) {
52 fprintf(stdout, "call write length = %d\n", len);
53@@ -198,35 +196,8 @@ int MEILinux::SendMessage(const unsigned char *buffer, int len, unsigned long ti
54 if (_verbose) {
55 fprintf(stderr,"write failed with status %d %d\n", rv, error);
56 }
57- goto out;
58- }
59-
60- return_length = rv;
61-
62- FD_ZERO(&set);
63- FD_SET(_fd, &set);
64- rv = select(_fd+1 ,&set, NULL, NULL, &tv);
65- if (rv > 0 && FD_ISSET(_fd, &set)) {
66- if (_verbose) {
67- fprintf(stderr, "write success\n");
68- }
69 }
70- else if (rv == 0) {
71- if (_verbose) {
72- fprintf(stderr, "write failed on timeout with status\n");
73- }
74- goto out;
75- }
76- else { //rv<0
77- if (_verbose) {
78- fprintf(stderr, "write failed on select with status %d\n", rv);
79- }
80- goto out;
81- }
82-
83- rv = return_length;
84
85-out:
86 if (rv < 0) {
87 Deinit();
88 }
89--
902.7.4
91