core: refcount serial port open/close

This specifically fixes a regression with Novatel GSM secondary
AT port enablement, where the inital pin check closed the port
before the Novatel plugin could send the command to flip secondary
ports to AT mode.

But it's useful elsewhere too, and simplifies a bunch of the PIN
checking code which had to use various ugly methods to track whether
to close the port or not after checking the PIN.
This commit is contained in:
Dan Williams
2010-04-29 21:15:17 -07:00
parent 26a51d6ab9
commit bfe3dd49ed
5 changed files with 107 additions and 76 deletions
+3 -2
View File
@@ -67,8 +67,9 @@ dmat_callback (MMAtSerialPort *port,
/* Try it again */
if (mm_serial_port_open (MM_SERIAL_PORT (port), NULL))
mm_at_serial_port_queue_command (port, "$NWDMAT=1", 2, dmat_callback2, NULL);
} else
mm_serial_port_close (MM_SERIAL_PORT (port));
}
mm_serial_port_close (MM_SERIAL_PORT (port));
}
static gboolean