commit bb321970a561074141ef5dc59bdb7a8756e212bc
parent 1046a0b4cb1065640173c909adbfe1d04c61111d
Author: Brian Swetland <swetland@frotz.net>
Date: Tue, 21 Feb 2012 00:13:22 -0800
bail out early if hub info returns bogus data
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/jtag-virtual.c b/jtag-virtual.c
@@ -75,6 +75,11 @@ int jtag_open_virtual_device(unsigned iid) {
hub_nodecount = (bits >> 19) & 0xFF;
hub_mfg = (bits >> 8) & 0x7FF;
+ if (hub_mfg != 0x06e) {
+ fprintf(stderr,"HUB: Cannot Find Virtual JTAG HUB\n");
+ return -1;
+ }
+
/* altera docs claim this field is the sum of M bits (VIR field) and
* N bits (ADDR field), but empirical evidence suggests it is actually
* just the width of the ADDR field and the docs are wrong...