When doing "detect" you always get a syntax error if a valid part is found.
bus_init is returning 0 (as it supposed to) but the code in detect.c looks like this:
abus = buses.buses[i];
if(abus->driver->init)
{
if(!abus->driver->init(abus))
It checks for a none 0 value!
Should the code really return just 0, -1 and simular? Shouldn't there be #defines like:
#define URJTAG_STATUS_OK 0
#define URJTAG_STATUS_FAIL -1
?
Could you please post the error message and also provide the commands/scripts involved?
Sorry for not being detailed enough.
Error message is: "detect: syntax error!"
this after doing cable-command followed by "detect".
This is with my own added part and bus. But when reading the source code I can see that it will happen for all parts with "initbus" in their parts file, an example is /usr/local/share/urjtag/ibm/ppc405ep/ppc405ep
if(!abus->driver->init(abus)) checks for the return value NOT to be 0 (zero). But the busdriver init code I've read all returns 0 (zero) for successful init.
Thanks for clarifying - I didn't get the link from detect to bus drivers.
Really puzzling this wasn't fixed already. It's a hard error that'll surface reproducibly for such part files. Please check whether the problem is gone with latest SVN.
I'll open up an enhancement item for the status macros. UrJTAG is close to the next release and I don't think it's a good idea to mess with return codes right now. Having these defines is a good idea, for sure :-)
Working fine now. The error wasn't that serious since the businit was the last code executed before returning. So it worked fine before but there was that annoying error message.
I really recommend using defines also when checking for error, no risc for misinterpretation that way. It would also be good thing for a future urjtag library. After cleanup I will also submit a patch for the busdriver I have implemented.
Fine.
Feel free to submit your patch to the enhancement tracker, we'll add it to SVN after the next release.