[Feature][ZXW-235][DTR]DTR changed to waiting queue
Only Configure :No
Affected branch: master
Affected module: autosuspend
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I57c338fd0909cee1f1b277e8d7580c96fb814471
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
index 01ccd5d..260dcb6 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
@@ -7,7 +7,7 @@
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
-#include <cutils/uevent.h>
+
#include <lynq_autosuspend.h>
#include "lynq-qser-autosuspend.h"
@@ -31,16 +31,7 @@
#define UEVENT_MSG_LEN 128
-int device_fd;
int g_init_flag = 0;
-struct dtr_uevent {
- const char *action;
- const char *path;
- const char *subsystem;
- const char *usbevent;
-};
-
-static void parse_event(const char *msg, struct dtr_uevent *dtr_uevent);
qser_lpm_Handler_t g_lpm_handler = NULL;
@@ -238,75 +229,35 @@
return ret;
}
-static void parse_event(const char *msg, struct dtr_uevent *dtr_uevent)
-{
- dtr_uevent->action = "";
- dtr_uevent->path = "";
- dtr_uevent->subsystem = "";
- dtr_uevent->usbevent = "";
-
- while (*msg) {
- if (!strncmp(msg, "ACTION=", 7))
- {
- msg += 7;
- dtr_uevent->action = msg;
- }
- else if (!strncmp(msg, "DEVPATH=", 8))
- {
- msg += 8;
- dtr_uevent->path = msg;
- }
- else if (!strncmp(msg, "SUBSYSTEM=", 10))
- {
- msg += 10;
- dtr_uevent->subsystem = msg;
- }
- else if (!strncmp(msg, "USBEVENT=", 9)) {
- msg += 9;
- dtr_uevent->usbevent = msg;
- }
-
- while(*msg++);
- }
-
- LYINFLOG("event { '%s', '%s', '%s', '%s'}\n",
- dtr_uevent->action, dtr_uevent->path, dtr_uevent->subsystem,dtr_uevent->usbevent);
-}
-
-
void *check_dtr(void * arg)
{
qser_lpm_edge_t lpm_edge;
- char msg[UEVENT_MSG_LEN+2];
- struct dtr_uevent dtr_uevent;
- int n;
- int i;
-
- device_fd = uevent_open_socket(4*UEVENT_MSG_LEN, true);
- if(device_fd < 0)
- {
- LYERRLOG("uevent_open_socket fail\n");
- return -1;
- }
+ char msg[16];
+ int fd=0;
+ int ret=0;
+
while(1)
{
- n = uevent_kernel_multicast_recv(device_fd, msg, UEVENT_MSG_LEN);
- msg[n] = '\0';
- msg[n+1] = '\0';
- parse_event(msg, &dtr_uevent);
- if((!strcmp(dtr_uevent.subsystem, "xp2xp")))
+ fd = open("/sys/xp2xp/xp2xp_notify/xp2xp_state", O_RDONLY);
+ ret=read(fd, &msg,15);
+ LYERRLOG("xp2xp_state ret = %d\n", ret);
+ close(fd);
+
+ if(ret == 5)
{
- if(!strcmp(dtr_uevent.action, "online"))
- {
- lpm_edge =E_QL_LPM_FALLING;
- }
- else
- {
- lpm_edge =E_QL_LPM_RISING;
- }
- g_lpm_handler(lpm_edge);
+ lpm_edge =E_QL_LPM_FALLING;
}
+ else if(ret == 6)
+ {
+ lpm_edge =E_QL_LPM_RISING;
+ }
+ else
+ {
+ continue;
+ }
+ g_lpm_handler(lpm_edge);
+
}
return 0;
@@ -343,7 +294,6 @@
}
g_init_flag = 0;
ret = pthread_cancel(thid);
- close(device_fd);
if(!ret)
{
LYERRLOG("pthread cancel success, lpm deinit success\n");