1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-23 05:30:17 +02:00

tools/lib/misctxrx.c (wait_for_interrupt): restore signal also after timeout

This commit is contained in:
Werner Almesberger 2011-01-10 13:52:57 -03:00
parent 110d5abe32
commit 6ff235e8ea

View File

@ -42,8 +42,10 @@ uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
while (run) { while (run) {
while (run && !atrf_interrupt(dsc)) { while (run && !atrf_interrupt(dsc)) {
usleep(sleep_us); usleep(sleep_us);
if (timeout && !--timeout) if (timeout && !--timeout) {
return 0; irq = 0;
goto out;
}
} }
irq = atrf_reg_read(dsc, REG_IRQ_STATUS); irq = atrf_reg_read(dsc, REG_IRQ_STATUS);
if (atrf_error(dsc)) if (atrf_error(dsc))
@ -74,6 +76,7 @@ uint8_t wait_for_interrupt(struct atrf_dsc *dsc, uint8_t wait_for,
if (irq & wait_for) if (irq & wait_for)
break; break;
} }
out:
signal(SIGINT, old_sig); signal(SIGINT, old_sig);
if (!run) if (!run)
raise(SIGINT); raise(SIGINT);