summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio/rio.c
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-08-19 23:35:41 +0000
committerJacob Moody <moody@posixcafe.org>2022-08-19 23:35:41 +0000
commit4009eb2feecfa4722d5cb22be4f5db9f26d15be3 (patch)
tree70861cb2df8a4a881110d1b57973fa23499095a0 /sys/src/cmd/rio/rio.c
parenta36f997368057fe298524de52310cc4e98bddba8 (diff)
rio: correct tap code
Remove tapmesg, allow the reads to accept flushes, accept writes of multiple messages, move open/close to Xfid code.
Diffstat (limited to 'sys/src/cmd/rio/rio.c')
-rw-r--r--sys/src/cmd/rio/rio.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c
index 9d666bf15..481451d56 100644
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -197,7 +197,7 @@ threadmain(int argc, char *argv[])
if(kbdchan == nil)
error("can't find keyboard");
totap = chancreate(sizeof(char*), 0);
- fromtap = chancreate(sizeof(Tapmesg), 0);
+ fromtap = chancreate(sizeof(char*), 0);
wscreen = allocscreen(screen, background, 0);
if(wscreen == nil)
@@ -340,11 +340,10 @@ void
keyboardthread(void*)
{
char *s;
- Tapmesg m;
Channel *out;
int mode;
enum { Kdev, Ktap, NALT};
- enum { Mnorm, Mfilt };
+ enum { Mnorm, Mtap };
threadsetname("keyboardthread");
@@ -353,7 +352,7 @@ keyboardthread(void*)
alts[Kdev].v = &s;
alts[Kdev].op = CHANRCV;
alts[Ktap].c = fromtap;
- alts[Ktap].v = &m;
+ alts[Ktap].v = &s;
alts[Ktap].op = CHANRCV;
alts[NALT].op = CHANEND;
@@ -362,24 +361,24 @@ keyboardthread(void*)
for(;;)
switch(alt(alts)){
case Ktap:
- switch(m.type){
+ switch(*s){
case 'K': case 'k': case 'c':
break;
- case Freset:
- if(mode != Mfilt)
- continue;
- s = smprint("%c", m.type);
+ case Tapreset:
+ if(mode != Mtap)
+ goto Next;
goto Send;
- case Foff:
+ case Tapoff:
mode = Mnorm;
- continue;
- case Fon:
- mode = Mfilt;
- continue;
+ goto Next;
+ case Tapon:
+ mode = Mtap;
+ /* fallthrough */
default:
+ Next:
+ free(s);
continue;
}
- s = smprint("%c%s", m.type, m.s);
out = input == nil ? nil : input->ck;
goto Send;
case Kdev:
@@ -387,7 +386,7 @@ keyboardthread(void*)
case Mnorm:
out = input == nil ? nil : input->ck;
break;
- case Mfilt:
+ case Mtap:
out = totap;
break;
}