Commit c13ea19f authored by Tomasz Wlostowski's avatar Tomasz Wlostowski Committed by Alessandro Rubini

tools/fmc-fdelay-term: minor bugfixes

- fix termination status printing (was showing null)
- error handling when setting termination
parent 04135aa1
......@@ -68,17 +68,26 @@ int main(int argc, char **argv)
}
hwval = fdelay_get_config_tdc(b);
int err = 0;
switch(newval) {
case 1:
hwval |= FD_TDCF_TERM_50;
fdelay_set_config_tdc(b, hwval);
err = fdelay_set_config_tdc(b, hwval);
break;
case 0:
hwval &= ~FD_TDCF_TERM_50;
fdelay_set_config_tdc(b, hwval);
err = fdelay_set_config_tdc(b, hwval);
break;
}
printf("%s: termination is %s\n", argv[0], hwval,
if (err)
{
fprintf(stderr, "%s: error setting termination: %s", argv[0], strerror(errno));
exit(1);
}
printf("%s: termination is %s\n", argv[0],
hwval & FD_TDCF_TERM_50 ? "on" : "off");
fdelay_close(b);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment