Do not restart the modem if already started

This commit is contained in:
Pierre Pronchery 2014-09-08 06:01:36 +02:00
parent 8af66dbf2d
commit d298bfd4cc

View File

@ -609,15 +609,28 @@ static int _hayes_request(Hayes * hayes, ModemRequest * request)
/* hayes_start */
static int _start_is_started(Hayes * hayes);
static int _hayes_start(Hayes * hayes, unsigned int retry)
{
hayes->retry = retry;
if(_start_is_started(hayes))
return 0;
if(hayes->source != 0)
g_source_remove(hayes->source);
hayes->source = g_idle_add(_on_reset, &hayes->channel);
return 0;
}
static int _start_is_started(Hayes * hayes)
{
if(hayes->source != 0)
return 1;
if(hayes->channel.channel != NULL)
return 1;
return 0;
}
/* hayes_stop */
static void _stop_channel(Hayes * hayes, HayesChannel * channel);