MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / port_open

Function port_open

src/iofunc.c:229–375  ·  view source on GitHub ↗

* \brief Open a hamlib_port based on its rig port type * \param p rig port descriptor * \return status */

Source from the content-addressed store, hash-verified

227 * \return status
228 */
229int HAMLIB_API port_open(hamlib_port_t *p)
230{
231 int status;
232 int want_state_delay = 0;
233
234 p->fd = -1;
235 init_sync_data_pipe(p);
236
237 if (p->asyncio)
238 {
239 status = create_sync_data_pipe(p);
240
241 if (status < 0)
242 {
243 return (status);
244 }
245 }
246
247 switch (p->type.rig)
248 {
249 case RIG_PORT_SERIAL:
250 status = serial_open(p);
251
252 if (status < 0)
253 {
254#if defined(WIN32)
255// rig_debug(RIG_DEBUG_ERR, "%s: serial_open(%s) status=%d, err=%s\n", __func__,
256// p->pathname, status, rigerror(status));
257#else
258 rig_debug(RIG_DEBUG_ERR, "%s: serial_open(%s) status=%d, err=%s\n", __func__,
259 p->pathname, status, strerror(errno));
260#endif
261 close_sync_data_pipe(p);
262 return (status);
263 }
264
265 if (p->parm.serial.rts_state != RIG_SIGNAL_UNSET
266 && p->parm.serial.handshake != RIG_HANDSHAKE_HARDWARE)
267 {
268 status = ser_set_rts(p,
269 p->parm.serial.rts_state == RIG_SIGNAL_ON);
270 want_state_delay = 1;
271 }
272
273 if (status != 0)
274 {
275 close_sync_data_pipe(p);
276 return (status);
277 }
278
279 if (p->parm.serial.dtr_state != RIG_SIGNAL_UNSET)
280 {
281 status = ser_set_dtr(p,
282 p->parm.serial.dtr_state == RIG_SIGNAL_ON);
283 want_state_delay = 1;
284 }
285
286 if (status != 0)

Callers 3

dttsp_openFunction · 0.85
rig_openFunction · 0.85
mainFunction · 0.85

Calls 12

init_sync_data_pipeFunction · 0.85
create_sync_data_pipeFunction · 0.85
serial_openFunction · 0.85
rig_debugFunction · 0.85
close_sync_data_pipeFunction · 0.85
ser_set_rtsFunction · 0.85
ser_set_dtrFunction · 0.85
hl_usleepFunction · 0.85
par_openFunction · 0.85
cm108_openFunction · 0.85
usb_port_openFunction · 0.85
network_openFunction · 0.85

Tested by

no test coverage detected