summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio/xfid.c
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-09-28 02:33:23 +0000
committerJacob Moody <moody@posixcafe.org>2022-09-28 02:33:23 +0000
commita1d252ff9b58c9c9bf3bf8765e4cf2c988ed51d4 (patch)
tree63261e6e69ead15b279d537dbc1f461577425e9e /sys/src/cmd/rio/xfid.c
parent03f9392b3a4583f36b8c5d961733bae00bc9417e (diff)
rio: ensure single reader and single writer for kbdtap
Multiple readers eat each other's lunch, and it makes more sense to limit use to one 'pipeline' then just one reader. This also brings back the 'focus' message from kbdtap used by ktrans to reset its line buffers when the user switches windows. An event file was considered, but deemed harmful to the artwork. To paraphrase an old excuse found in the code: "rio just isn't structured for that. Apologies."
Diffstat (limited to 'sys/src/cmd/rio/xfid.c')
-rw-r--r--sys/src/cmd/rio/xfid.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/src/cmd/rio/xfid.c b/sys/src/cmd/rio/xfid.c
index cee3c006d..7afe02353 100644
--- a/sys/src/cmd/rio/xfid.c
+++ b/sys/src/cmd/rio/xfid.c
@@ -247,6 +247,7 @@ xfidopen(Xfid *x)
{
Fcall t;
Window *w;
+ char *s;
w = x->f->w;
if(w != nil && w->deleted){
@@ -312,8 +313,12 @@ xfidopen(Xfid *x)
}
break;
case Qtap:
- chanprint(ctltap, "%c", Tapon);
- break;
+ chanprint(ctltap, "%c%c", Tapon, x->mode);
+ s = recvp(resptap);
+ if(s == nil)
+ break;
+ filsysrespond(x->fs, x, &t, s);
+ return;
}
t.qid = x->f->qid;
t.iounit = messagesize-IOHDRSZ;
@@ -369,7 +374,8 @@ xfidclose(Xfid *x)
w->wctlopen = FALSE;
break;
case Qtap:
- chanprint(ctltap, "%c", Tapoff);
+ chanprint(ctltap, "%c%c", Tapoff, x->f->mode);
+ recvp(resptap);
break;
}
if(w)
@@ -581,12 +587,18 @@ xfidwrite(Xfid *x)
}
e = x->data + cnt;
for(p = x->data; p < e; p += strlen(p)+1){
- if(*p == '\0'){
+ switch(*p){
+ case '\0':
fc.count = p - x->data;
filsysrespond(x->fs, x, &fc, "null message type");
return;
+ case Tapfocus:
+ /* cleanup our own pollution */
+ break;
+ default:
+ chanprint(fromtap, "%s", p);
+ break;
}
- chanprint(fromtap, "%s", p);
}
break;