summaryrefslogtreecommitdiff
path: root/sys/src/cmd/nusb/serial/ucons.c
blob: 8dcf6376ed321a384ec441ca451ece885563445d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <fcall.h>
#include <9p.h>
#include "usb.h"
#include "serial.h"
#include "ucons.h"

Cinfo uconsinfo[] = {
	{ Net20DCVid,	Net20DCDid },
	{ 0,		0 },
};

int
uconsmatch(char *info)
{
	Cinfo *ip;
	char buf[50];

	for(ip = uconsinfo; ip->vid != 0; ip++){
		snprint(buf, sizeof buf, "vid %#06x did %#06x",
			ip->vid, ip->did);
		dsprint(2, "serial: %s %s\n", buf, info);
		if(strstr(info, buf) != nil)
			return 0;
	}
	return -1;
}

static int
ucseteps(Serialport *p)
{
	Serial *ser;

	ser = p->s;

	p->baud = ~0;	/* not real port */
	ser->maxrtrans = ser->maxwtrans = 8;
	devctl(p->epin,  "maxpkt 8");
	devctl(p->epout, "maxpkt 8");
	return 0;
}

/* all nops */
Serialops uconsops = {
	.seteps = ucseteps,
};