- for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++) {
- p = sr_device_probe_find(device, pnum);
- if (p && p->trigger) {
- g_free(p->trigger);
- p->trigger = NULL;
- }
+#ifdef HAVE_LIBSERIALPORT
+
+/**
+ * @private
+ *
+ * Both parameters are copied to newly allocated strings, and freed
+ * automatically by sr_serial_dev_inst_free().
+ *
+ * @param pathname OS-specific serial port specification. Examples:
+ * "/dev/ttyUSB0", "/dev/ttyACM1", "/dev/tty.Modem-0", "COM1".
+ * @param serialcomm A serial communication parameters string, in the form
+ * of <speed>/<data bits><parity><stopbits>, for example
+ * "9600/8n1" or "600/7o2". This is an optional parameter;
+ * it may be filled in later.
+ *
+ * @return A pointer to a newly initialized struct sr_serial_dev_inst,
+ * or NULL on error.
+ */
+SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port,
+ const char *serialcomm)
+{
+ struct sr_serial_dev_inst *serial;
+
+ if (!port) {
+ sr_err("Serial port required.");
+ return NULL;