client: dont try get_info when brick isnt working

This commit is contained in:
Thomas Schoebel-Theuer 2017-01-10 12:52:43 +01:00
parent 4805d25cad
commit b7bd757d99
1 changed files with 4 additions and 2 deletions

View File

@ -182,17 +182,19 @@ static int client_get_info(struct client_output *output, struct mars_info *info)
int status; int status;
output->got_info = false; output->got_info = false;
if (!brick->power.led_on)
goto timeout;
output->get_info = true; output->get_info = true;
wake_up_interruptible(&output->event); wake_up_interruptible(&output->event);
wait_event_interruptible_timeout(output->info_event, output->got_info, io_timeout * HZ); wait_event_interruptible_timeout(output->info_event, output->got_info, io_timeout * HZ);
timeout:
status = -ETIME; status = -ETIME;
if (output->got_info && info) { if (output->got_info && info) {
memcpy(info, &output->info, sizeof(*info)); memcpy(info, &output->info, sizeof(*info));
status = 0; status = 0;
} }
//done:
return status; return status;
} }