fix set_restart callback

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
pull/106/head^2
Luotao Fu 2009-11-23 14:52:48 +01:00
parent bbac00bbc7
commit 022be45eb1
1 changed files with 12 additions and 4 deletions

View File

@ -501,14 +501,22 @@ int scan_set_restart(const char *name)
int fd;
int err = -1;
int state;
__u32 restart_ms;
/* first we check if we can restart the device at all */
state = scan_get_state(name);
if (state != CAN_STATE_BUS_OFF) {
fprintf(stderr,
"Device %s is not in BUS_OFF,"
" no use to restart it\n", name);
err = 0;
"Device is not in BUS_OFF,"
" no use to restart\n");
goto err_out;
}
restart_ms = scan_get_restart_ms(name);
if (restart_ms > 0) {
fprintf(stderr,
"auto restart with %ums interval is turned on,"
" no use to restart\n", restart_ms);
goto err_out;
}