diff options
Diffstat (limited to 'util/ectool.c')
-rw-r--r-- | util/ectool.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/util/ectool.c b/util/ectool.c index f918c0b7eb..c9ac36c686 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -8598,13 +8598,21 @@ int main(int argc, char *argv[]) exit(1); } - if (acquire_gec_lock(GEC_LOCK_TIMEOUT_SECS) < 0) { - fprintf(stderr, "Could not acquire GEC lock.\n"); - exit(1); + /* Prefer /dev method, which supports built-in mutex */ + if (!(interfaces & COMM_DEV) || comm_init_dev(device_name)) { + /* If dev is excluded or isn't supported, find alternative */ + if (acquire_gec_lock(GEC_LOCK_TIMEOUT_SECS) < 0) { + fprintf(stderr, "Could not acquire GEC lock.\n"); + exit(1); + } + if (comm_init_alt(interfaces, device_name)) { + fprintf(stderr, "Couldn't find EC\n"); + goto out; + } } - if (comm_init(interfaces, device_name)) { - fprintf(stderr, "Couldn't find EC\n"); + if (comm_init_buffer()) { + fprintf(stderr, "Couldn't initialize buffers\n"); goto out; } |