kopia lustrzana https://github.com/Hamlib/Hamlib
rodzic
617a38ff45
commit
2fb5343cc1
41
src/serial.c
41
src/serial.c
|
@ -224,25 +224,16 @@ int HAMLIB_API serial_open(hamlib_port_t *rp)
|
||||||
/*
|
/*
|
||||||
* Open in Non-blocking mode. Watch for EAGAIN errors!
|
* Open in Non-blocking mode. Watch for EAGAIN errors!
|
||||||
*/
|
*/
|
||||||
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
int i=1;
|
||||||
if (fd == -1) // some serial ports fail to open 1st time for some unknown reason
|
do { // some serial ports fail to open 1st time for some unknown reason
|
||||||
{
|
|
||||||
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#1\n", __func__, __LINE__);
|
|
||||||
hl_usleep(500*1000);
|
|
||||||
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
}
|
if (fd == -1) // some serial ports fail to open 1st time for some unknown reason
|
||||||
if (fd == -1)
|
{
|
||||||
{
|
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#%d\n", __func__, __LINE__, i);
|
||||||
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#2\n", __func__, __LINE__);
|
hl_usleep(500*1000);
|
||||||
hl_usleep(500*1000);
|
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
}
|
||||||
}
|
} while(++i <= 4 && fd == -1);
|
||||||
if (fd == -1)
|
|
||||||
{
|
|
||||||
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#3\n", __func__, __LINE__);
|
|
||||||
hl_usleep(500*1000);
|
|
||||||
fd = OPEN(rp->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
@ -719,13 +710,17 @@ int ser_open(hamlib_port_t *p)
|
||||||
/*
|
/*
|
||||||
* pathname is not uh_rig or uh_ptt: simply open()
|
* pathname is not uh_rig or uh_ptt: simply open()
|
||||||
*/
|
*/
|
||||||
ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
int i=1;
|
||||||
if (ret == -1) // some serial ports fail to open 1st time
|
do // some serial ports fail to open 1st time
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#1\n", __func__, __LINE__);
|
|
||||||
hl_usleep(500*1000);
|
|
||||||
ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
}
|
if (ret == -1) // some serial ports fail to open 1st time
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_WARN, "%s(%d): open failed#%d\n", __func__, __LINE__, i);
|
||||||
|
hl_usleep(500*1000);
|
||||||
|
ret = OPEN(p->pathname, O_RDWR | O_NOCTTY | O_NDELAY);
|
||||||
|
}
|
||||||
|
} while(++i <= 4 && ret == -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue