From: Uffe Jakobsen Date: Mon, 16 Feb 2015 13:13:01 +0000 (+0100) Subject: Handle enumeration of native UART ports on FreeBSD X-Git-Tag: libserialport-0.1.1~85 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=54975208913f8f3f316173280a753a7322033575;p=libserialport.git Handle enumeration of native UART ports on FreeBSD --- diff --git a/freebsd.c b/freebsd.c index 4b41b2c..d1fabee 100644 --- a/freebsd.c +++ b/freebsd.c @@ -253,6 +253,15 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port) RETURN_ERROR(SP_ERR_ARG, "Device name not recognized."); } + /* Native UART enumeration. */ + if ((cua_sfx[0] == 'u') || (cua_sfx[0] == 'd')) { + port->transport = SP_TRANSPORT_NATIVE; + snprintf(tbuf, sizeof(tbuf) - 1, "cua%s", cua_sfx); + port->description = strdup(tbuf); + RETURN_OK(); + } + + /* USB device enumeration. */ dev = dev_last = NULL; be = libusb20_be_alloc_default(); cua_dev_found = 0; @@ -339,8 +348,8 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list) if (strend(entry.d_name, ".lock")) continue; - DEBUG_FMT("Found device %s", name); snprintf(name, sizeof(name), "/dev/%s", entry.d_name); + DEBUG_FMT("Found device %s", name); /* Check that we can open tty/cua device in rw mode - we need that. */ if ((fd = open(name, O_RDWR | O_NONBLOCK | O_NOCTTY | O_TTY_INIT | O_CLOEXEC)) < 0) {