~foura/midifs

d084b72774385e5930b74cdfabca164768a39877 — james palmer 2 months ago efc223a
implement reads of the ctl file
2 files changed, 8 insertions(+), 0 deletions(-)

M main.c
M midi.c
M main.c => main.c +6 -0
@@ 84,12 84,18 @@ fsread(Req *r)
	Midi *dev = r->srv->aux;
	uvlong path = r->fid->qid.path;
	long count;
	char buf[512];
	
	switch(path) {
	case Qroot:
		dirread9p(r, rootgen, r);
		respond(r, nil);
		break;
	case Qctl:
		snprint(buf, sizeof buf, "channel %d\ncable %d\n", dev->chan, dev->cable);
		readstr(r, buf);
		respond(r, nil);
		break;
	case Qraw:
		/* FIXME: this may block the srv loop */
		count = read(dev->fd, r->ofcall.data, r->ifcall.count);

M midi.c => midi.c +2 -0
@@ 118,6 118,7 @@ mkusbdev(char *dev)
		return nil;
	}

	m->chan = 0;
	m->cable = 0;
	m->send = usbsend;
	m->recv = usbrecv;


@@ 140,6 141,7 @@ mkpipedev(char *prog)
		return nil;
	}

	m->chan = 0;
	m->cable = 0;
	m->send = midisend;
	m->recv = midirecv;