96 lines
2.7 KiB
Diff
96 lines
2.7 KiB
Diff
--- usbutils-0.71/names.c 2005-01-23 00:03:47.000000000 +0100
|
|
+++ usbutils-0.72/names.c 2005-10-22 07:59:50.000000000 +0200
|
|
@@ -79,6 +79,12 @@
|
|
char name[1];
|
|
};
|
|
|
|
+struct videoterminal {
|
|
+ struct videoterminal *next;
|
|
+ u_int16_t termt;
|
|
+ char name[1];
|
|
+};
|
|
+
|
|
struct genericstrtable {
|
|
struct genericstrtable *next;
|
|
unsigned int num;
|
|
@@ -109,6 +115,7 @@
|
|
static struct subclass *subclasses[HASHSZ] = { NULL, };
|
|
static struct protocol *protocols[HASHSZ] = { NULL, };
|
|
static struct audioterminal *audioterminals[HASHSZ] = { NULL, };
|
|
+static struct videoterminal *videoterminals[HASHSZ] = { NULL, };
|
|
static struct genericstrtable *hiddescriptors[HASHSZ] = { NULL, };
|
|
static struct genericstrtable *reports[HASHSZ] = { NULL, };
|
|
static struct genericstrtable *huts[HASHSZ] = { NULL, };
|
|
@@ -236,6 +243,17 @@
|
|
return NULL;
|
|
}
|
|
|
|
+const char *names_videoterminal(u_int16_t termt)
|
|
+{
|
|
+ struct videoterminal *vt;
|
|
+
|
|
+ vt = videoterminals[hashnum(termt)];
|
|
+ for (; vt; vt = vt->next)
|
|
+ if (vt->termt == termt)
|
|
+ return vt->name;
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
static int new_vendor(const char *name, u_int16_t vendorid)
|
|
@@ -356,6 +374,25 @@
|
|
return 0;
|
|
}
|
|
|
|
+static int new_videoterminal(const char *name, u_int16_t termt)
|
|
+{
|
|
+ struct videoterminal *vt;
|
|
+ unsigned int h = hashnum(termt);
|
|
+
|
|
+ vt = videoterminals[h];
|
|
+ for (; vt; vt = vt->next)
|
|
+ if (vt->termt == termt)
|
|
+ return -1;
|
|
+ vt = malloc(sizeof(struct videoterminal) + strlen(name));
|
|
+ if (!vt)
|
|
+ return -1;
|
|
+ strcpy(vt->name, name);
|
|
+ vt->termt = termt;
|
|
+ vt->next = videoterminals[h];
|
|
+ videoterminals[h] = vt;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int new_genericstrtable(struct genericstrtable *t[HASHSZ], const char *name, unsigned int index)
|
|
{
|
|
struct genericstrtable *g;
|
|
@@ -564,6 +601,27 @@
|
|
DBG(printf("line %5u audio terminal type %02x %s\n", linectr, u, cp));
|
|
continue;
|
|
}
|
|
+ if (buf[0] == 'V' && buf[1] == 'T' && isspace(buf[2])) {
|
|
+ /* video terminal type spec */
|
|
+ cp = buf+3;
|
|
+ while (isspace(*cp))
|
|
+ cp++;
|
|
+ if (!isxdigit(*cp)) {
|
|
+ fprintf(stderr, "Invalid video terminal type at line %u\n", linectr);
|
|
+ continue;
|
|
+ }
|
|
+ u = strtoul(cp, &cp, 16);
|
|
+ while (isspace(*cp))
|
|
+ cp++;
|
|
+ if (!*cp) {
|
|
+ fprintf(stderr, "Invalid video terminal type at line %u\n", linectr);
|
|
+ continue;
|
|
+ }
|
|
+ if (new_videoterminal(cp, u))
|
|
+ fprintf(stderr, "Duplicate video terminal type spec at line %u terminal type %04x %s\n", linectr, u, cp);
|
|
+ DBG(printf("line %5u video terminal type %02x %s\n", linectr, u, cp));
|
|
+ continue;
|
|
+ }
|
|
if (buf[0] == 'H' && buf[1] == 'C' && buf[2] == 'C' && isspace(buf[3])) {
|
|
/* HID Descriptor bCountryCode */
|
|
cp = buf+3;
|