sensors: Handle fod press status without coordinates
Also fix the error handling of sscanf which returns the number of matched variables on partial success. Change-Id: I785c0e3f73e89f79addcf18e1b5111e93e25e430
This commit is contained in:
@@ -42,7 +42,13 @@ static bool readFpState(int fd, int& screenX, int& screenY) {
|
||||
}
|
||||
|
||||
rc = sscanf(buffer, "%d,%d,%d", &screenX, &screenY, &state);
|
||||
if (rc < 0) {
|
||||
if (rc == 1) {
|
||||
// If only the first variable can be matched assume
|
||||
// that the node only reports the state
|
||||
state = screenX;
|
||||
screenX = 0;
|
||||
screenY = 0;
|
||||
} else if (rc < 3) {
|
||||
ALOGE("failed to parse fp state: %d", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user