X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/usb-driver/blobdiff_plain/c6338a01c2a8ce409109418adb191b01e73efacf..HEAD:/config.c diff --git a/config.c b/config.c index 78de78b..2963129 100644 --- a/config.c +++ b/config.c @@ -23,6 +23,7 @@ static void read_config() { #ifdef JTAGKEY char *pbuf; unsigned short vid, pid; + unsigned short iface; int line, len, num; #endif @@ -143,7 +144,7 @@ static void read_config() { vid = 0; vid = strtol(pbuf, NULL, 16); - if (!num) { + if (!vid) { PARSEERROR; continue; } @@ -152,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; @@ -243,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