More graceful error handling for ya_wifi internal block

In case the wireless connection was not yet established or has been lost,
the block should not immediately fall into an error state and exit.
Rather, print a warning message and keep trying...
This commit is contained in:
Jack Henschel 2017-03-30 08:34:40 +02:00
parent d682dd6c8d
commit 96714d0025

View file

@ -734,12 +734,13 @@ void ya_int_wifi(ya_block_t *blk) {
while(1) { while(1) {
if (ya_int_get_wireless_info(&ws, blk->internal->option[0]) || ws.link_qual_max == 0) { if (ya_int_get_wireless_info(&ws, blk->internal->option[0]) || ws.link_qual_max == 0) {
ya_block_error(blk, "Failed to retrieve wireless info for device %s", blk->internal->option[0]); ya_block_warning(blk, "Failed to retrieve wireless info for device %s", blk->internal->option[0]);
} sprintf(startstr, "- (0%%)");
} else {
sprintf(startstr, "%s (%d%%)", ws.essid, ws.link_qual*100 / ws.link_qual_max); sprintf(startstr, "%s (%d%%)", ws.essid, ws.link_qual*100 / ws.link_qual_max);
if(suflen) if(suflen)
strcat(blk->buf, blk->internal->suffix); strcat(blk->buf, blk->internal->suffix);
}
ya_draw_pango_text(blk); ya_draw_pango_text(blk);
sleep(blk->sleep); sleep(blk->sleep);