Allow waiting for attachment of USB device to be interrrupted.

This commit is contained in:
Oliver Schmidt 2022-08-28 17:57:12 +02:00
parent 7be6aed0b9
commit ea1f91044d
1 changed files with 8 additions and 0 deletions

View File

@ -653,13 +653,21 @@ openserial:
* Open serial port.
*/
while (!pathmatch(&devtty, ttypattern))
{
usleep(1000);
if (state == STOP)
die("interrupted");
}
prlog("a2pid: Open serial port\n");
#ifdef TRACE
printf("a2pid: open %s\n", devtty);
#endif
while ((a2fd = open(devtty, O_RDWR | O_NOCTTY)) < 0)
{
usleep(1000);
if (state == STOP)
die("interrupted");
}
tcflush(a2fd, TCIFLUSH);
tcgetattr(a2fd, &oldtio); /* save current port settings */
bzero(&newtio, sizeof(newtio));