[LTP] [PATCH v2] input_common.h: Add retry loop for event device
Li Wang
liwang@redhat.com
Mon Mar 3 10:35:25 CET 2025
On Sat, Mar 1, 2025 at 2:49 AM Edward Liaw via ltp <ltp@lists.linux.it>
wrote:
> 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.
>
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.
Reviewed-by: Li Wang <liwang@redhat.com>
>
> Signed-off-by: Edward Liaw <edliaw@google.com>
> ---
> testcases/kernel/input/input_common.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/input/input_common.h
> b/testcases/kernel/input/input_common.h
> index 0ac1624b3..5b1755771 100644
> --- a/testcases/kernel/input/input_common.h
> +++ b/testcases/kernel/input/input_common.h
> @@ -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
>
>
--
Regards,
Li Wang
More information about the ltp
mailing list