diag: Implement new polling response mechanism
PC tools send various polling commands to target to detect its
presence. Initially modem used to respond to all pollings. However,
with new targets, we have applications processor as master as well
as subsystem restart. Due to these new features, modem does not respond
all the time. This change implements a new mechanism to respond to
polling.
The DIAG driver maintains a flag variable to keep track of any polling
command registered by a remote peripheral. As long as any polling command
is present, diag driver ignores a special polling request. If no peripheral
has registered for any polling at all, then diag responds to this special
polling request.
Change-Id: I6ba1744dd3dd4982027b671efce3beffb9a27786
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index 07322cd..5838bba 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -891,8 +891,8 @@
/* Check for polling for Apps only DIAG */
else if ((*buf == 0x4b) && (*(buf+1) == 0x32) &&
(*(buf+2) == 0x03)) {
- /* If there is NO MODEM present */
- if (!(driver->ch)) {
+ /* If no one has registered for polling */
+ if (!(driver->polling_reg_flag)) {
/* Respond to polling for Apps only DIAG */
for (i = 0; i < 3; i++)
driver->apps_rsp_buf[i] = *(buf+i);
@@ -901,13 +901,10 @@
ENCODE_RSP_AND_SEND(15);
return 0;
- } else {
- /* Since Modem is present, send error response */
- return 1;
}
}
/* Check for ID for NO MODEM present */
- else if (!(driver->ch)) {
+ else if (!(driver->polling_reg_flag)) {
/* respond to 0x0 command */
if (*buf == 0x00) {
for (i = 0; i < 55; i++)