input_common.h: Add retry loop for event device
PATCH v2 1/1 input_common.h: Add retry loop for event device
Android has a delay between the entry in /proc/bus/input/devices and the path /dev/input/eventN becoming accessible. Add a retry loop to account for this.
--- testcases/kernel/input/input_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/input/input_common.h +1 -1
@@ -29,7 +29,7 @@ static inline int open_event_device(void)memset (path,0 ,sizeof (path));snprintf (path,sizeof (path),"/dev/input/%s" , device); -if (!access (path,F_OK )) { +if (!TST_RETRY_FUNC (access (path,F_OK ),TST_RETVAL_EQ0 )) {tst_res (TINFO ,"Found event device: %s" , path);break ; }
Signature · 5 lines
2.48.1.711.g2feabab25a-goog -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 4 lines · Edward Liaw via ltp
Android has a delay between the entry in
/proc/bus/input/devicesand the path/dev/input/eventNbecoming accessible. Add a retry loop to account for this.
Did you count for how long it takes to entry? The default time TST_RETRY_FUNC
is backoff 1 second, if that time is not enough, you can consider the completed
version TST_RETRY_FN_EXP_BACKOFF for setting more seconds.
Anyway, this looks good.
Quoted 31 lines
Signed-off-by Edward Liaw <[email protected]>--- testcases/kernel/input/input_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/input/input_common.h +1
-1@@ -29,7 +29,7 @@ static inline int open_event_device(void)memset (path,0 ,sizeof (path));snprintf (path,sizeof (path),"/dev/input/%s" , device); -if (!access (path,F_OK )) { +if (!TST_RETRY_FUNC (access (path,F_OK ),TST_RETVAL_EQ0 )) { tst_res(TINFO, "Found event device: %s",path); break; }--
2.48.1.711.g2feabab25a-goog--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 10 lines · Li Wang
Quoted 4 lines · Edward Liaw via ltp
Android has a delay between the entry in
/proc/bus/input/devicesand the path/dev/input/eventNbecoming accessible. Add a retry loop to account for this.
Quoted 9 lines
Did you count for how long it takes to entry? The default time
TST_RETRY_FUNC
is backoff 1 second, if that time is not enough, you can consider the completed
versionTST_RETRY_FN_EXP_BACKOFFfor setting more seconds.Anyway, this looks good.
Reviewed-by Li Wang <[email protected]>
Yeah, 1 sec should be more than enough for Android; the delay has so far been on the order of microseconds.
Quoted 39 lines
Quoted 26 lines
Signed-off-by Edward Liaw <[email protected]>--- testcases/kernel/input/input_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/input/input_common.h +1
-1@@ -29,7 +29,7 @@ static inline int open_event_device(void)memset (path,0 ,sizeof (path));snprintf (path,sizeof (path),"/dev/input/%s" , device); -if (!access (path,F_OK )) { +if (!TST_RETRY_FUNC (access (path,F_OK ),TST_RETVAL_EQ0 )) { tst_res(TINFO, "Found event device: %s",path); break; }Quoted 8 lines
--
2.48.1.711.g2feabab25a-goog--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Regards,
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 20 lines · Edward Liaw
Quoted 16 lines · Li Wang
Quoted 4 lines · Edward Liaw via ltp
Android has a delay between the entry in
/proc/bus/input/devicesand the path/dev/input/eventNbecoming accessible. Add a retry loop to account for this.Did you count for how long it takes to entry? The default time
TST_RETRY_FUNC
is backoff 1 second, if that time is not enough, you can consider the completed
versionTST_RETRY_FN_EXP_BACKOFFfor setting more seconds.
Quoted 7 lines
Quoted 3 lines
Anyway, this looks good.
Reviewed-by Li Wang <[email protected]>Yeah, 1 sec should be more than enough for Android; the delay has so far been on the order of microseconds.
Sorry, milliseconds* not microseconds.
Quoted 41 lines
Quoted 40 lines
Quoted 27 lines
Signed-off-by Edward Liaw <[email protected]>--- testcases/kernel/input/input_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)testcases/kernel/input/input_common.h +1
-1@@ -29,7 +29,7 @@ static inline int open_event_device(void)memset (path,0 ,sizeof (path));snprintf (path,sizeof (path),"/dev/input/%s" , device); -if (!access (path,F_OK )) { +if (!TST_RETRY_FUNC (access (path,F_OK ),TST_RETVAL_EQ0 )) { tst_res(TINFO, "Found event device: %s",path); break; }Quoted 8 lines
--
2.48.1.711.g2feabab25a-goog--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Regards,
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Patch pushed, thanks!
Quoted 1 line
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp