How to configure my component to access le_tty functions?


#1

Hello,

I am writing a Legato application that opens a USB port and communicates with another device connected to it.
I use Legato 16.07 on Ubuntu 16.04.

I want to use le_tty functions to do so (see tty api at http://legato.io/legato-docs/latest/c_tty.html).

My component source file looks like this:

include "legato.h"
include “interfaces.h”

COMPONENT_INIT
{
int fd;

LE_INFO("tty test started");

fd = le_tty_Open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd != -1)  {
	LE_INFO("ttyUSB0 port successfully opened");
}

}

When I compile the application that uses this component I get an error saying that the function le_tty_Open is not declared (implicit declaration).

I understand that I need to “inform” the system about le_tty.h interface file but I cannot find it in my $LEGATO_ROOT folder and its subdirectories. I do not find any le_tty.api either.

Is there a way to configure the component so that the le_tty.h is created and linked?
Or is there a problem with my host environment?

thanks
BR
Luigi


#2

Hi,

The le_tty functions were introduced in legato 16.10. You mentioned that you are using 16.07. Is there a reason why you can’t switch to 16.10?


#3

Hi,

thank you for the prompt answer!
Great! I have no reason not to install 16.10.
I will install 16.10 and I will try to use le_tty.

On a side note: it would be nice to have this piece of information (i.e. that le_tty is only available on 16.10 and onward) on legato.io, directly where le_tty is documented.

thanks
BR
Luigi


#4

A bit late, but for the benefit of anyone else finding this:

Note that you also need to request read/write access to the device in your .adef file - or run unsandboxed.

See: How to send and receive data using UART2 (RS232) interface

it would be nice to have this piece of information (i.e. that le_tty is only available on 16.10 and onward) on legato.io, directly where le_tty is documented.

Indeed!