diff --git a/src/device/d-conf.c b/src/device/d-conf.c
index e57fa4b..6be89d0 100644
--- a/src/device/d-conf.c
+++ b/src/device/d-conf.c
@@ -46,6 +46,7 @@ static const char * const paths_global[] = {
"devices[].ttys[].tty",
"devices[].ttys[].rate",
"devices[].ttys[].initial_monitor",
+ "devices[].ttys[].lock",
"devices[].ttys[]",
"devices[]",
};
@@ -61,6 +62,7 @@ enum enum_paths_global {
LEJPM_DEVICES__TTYS__TTY,
LEJPM_DEVICES__TTYS__RATE,
LEJPM_DEVICES__TTYS__INITIAL_MONITOR,
+ LEJPM_DEVICES__TTYS__LOCK,
LEJPM_DEVICES__TTYS,
LEJPM_DEVICES,
@@ -115,7 +117,10 @@ said_conf_global_cb(struct lejp_ctx *ctx, char reason)
if (!a->tty)
return -1;
+ lwsl_notice("%s: adding tty\n", __func__);
+
a->tty->initial_monitor = 1;
+ a->tty->lock = 1;
a->tty->index = (int)a->dev->ttys_owner.count;
lws_dll2_add_tail(&a->tty->list, &a->dev->ttys_owner);
return 0;
@@ -136,6 +141,11 @@ said_conf_global_cb(struct lejp_ctx *ctx, char reason)
a->tty->initial_monitor = 0;
return 0;
}
+ if (reason == LEJPCB_VAL_FALSE &&
+ ctx->path_match - 1 == LEJPM_DEVICES__TTYS__LOCK) {
+ a->tty->lock = 0;
+ return 0;
+ }
if (reason != LEJPCB_VAL_STR_END)
return 0;
@@ -164,6 +174,7 @@ said_conf_global_cb(struct lejp_ctx *ctx, char reason)
break;
case LEJPM_DEVICES__TTYS__TTY:
pp = &a->tty->tty_path;
+ lwsl_notice("%s: tty path %.*s\n", __func__, (int)ctx->npos, ctx->buf);
break;
default:
diff --git a/src/device/d-private.h b/src/device/d-private.h
index 232b4d7..0df43a0 100644
--- a/src/device/d-private.h
+++ b/src/device/d-private.h
@@ -31,6 +31,7 @@ typedef struct sai_tty {
int rate;
int initial_monitor;
int index;
+ int lock;
} sai_tty_t; /* owned by sai_device_t's ttys_owner */
diff --git a/src/device/d-sai.c b/src/device/d-sai.c
index 95097e8..be38f73 100644
--- a/src/device/d-sai.c
+++ b/src/device/d-sai.c
@@ -155,7 +155,7 @@ said_check_device(lws_sorted_usec_list_t *sul)
sai_tty_t *t = lws_container_of(q,
sai_tty_t, list);
- if (try >= (int)LWS_ARRAY_SIZE(locked))
+ if (try >= (int)LWS_ARRAY_SIZE(locked) || !t->lock)
break;
try++;
@@ -209,6 +209,8 @@ said_check_device(lws_sorted_usec_list_t *sul)
try);
setenv(p1, t->tty_path, 1);
+ lwsl_warn("%s: exporting %s = %s\n", __func__, p1, t->tty_path);
+
if (alias) {
p1 = strchr(alias, '=');
if (p1 && atoi(&p1[1]) == try) {