X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/blobdiff_plain/61e0de7a4b7ed1b2c7a700a3b3db10ffacba9acb..HEAD:/config.c diff --git a/config.c b/config.c index e09d5ca..2963129 100644 --- a/config.c +++ b/config.c @@ -17,11 +17,15 @@ static struct parport_config pp_config[4]; static void read_config() { int i; - int line, len, num; static int config_read = 0; FILE *cfg; - char buf[LINELEN], *pbuf; + char buf[LINELEN]; +#ifdef JTAGKEY + char *pbuf; unsigned short vid, pid; + unsigned short iface; + int line, len, num; +#endif if (config_read) return; @@ -140,7 +144,7 @@ static void read_config() { vid = 0; vid = strtol(pbuf, NULL, 16); - if (!num) { + if (!vid) { PARSEERROR; continue; } @@ -149,20 +153,27 @@ static void read_config() { pbuf = buf + i; for (; i < len; i++) { - if (buf[i] == ' ' || buf[i] == '\t') + if (buf[i] == ' ' || buf[i] == '\t' || buf[i] == ':') break; } pid = 0; pid = strtol(pbuf, NULL, 16); - if (!num) { + if (!pid) { PARSEERROR; continue; } + iface = 0; + pbuf = buf + i; + if (pbuf[0] == ':') { + iface = atoi(pbuf + 1); + } + pp_config[num].real = 0; pp_config[num].usb_vid = vid; pp_config[num].usb_pid = pid; + pp_config[num].usb_iface = iface; pp_config[num].open = jtagkey_open; pp_config[num].close = jtagkey_close; pp_config[num].transfer = jtagkey_transfer; @@ -240,3 +251,20 @@ unsigned short config_usb_pid(int num) { return ret; } + +unsigned short config_usb_iface(int num) { + unsigned short ret = 0x00; + int i; + + read_config(); + + for (i=0; i