LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linux serial port enumeration

I want to be able to find all the serial ports of the connected devices, specially arduinos.

Can someone tell me how to do this in labview, for linux systems?

Thanks.

0 Kudos
Message 1 of 6
(4,268 Views)

I wish to use only the com port with the last number. for example if I have ports 1,2,3, I want to use 3 and if that on is disconnected the 2, and so on.

Can someone please tell me how to do this and If you could please give me an example?

I wrote the title wrong, I just want to be able to discover every serial port on a machine. I will be doing so in linux, but that does not matter.

Thanks.

0 Kudos
Message 2 of 6
(4,263 Views)
0 Kudos
Message 3 of 6
(4,222 Views)
I also wish to connect to the last serial port found. How can I do this?
0 Kudos
Message 4 of 6
(4,213 Views)
Index Array. Have you even tried the Find Resources function? You've had enough time to complete the free tutorials several times.
0 Kudos
Message 5 of 6
(4,211 Views)

Hello Nando,

 

It would be a similar solution than the solution of your other post:

 

Linux Battery Monitor:

http://forums.ni.com/t5/LabVIEW/Linux-Battery-Monitor/m-p/3108799#M891139

 

But in this case I only want to remind you that there are not a COM1 port on Linux, on Linux the serial ports resources are called tty's, for example, the COM1 port on Windows its called ttyS0 on Linux. Linux also differentiates the USB Serial Ports (like the USB Serial Port of the Arduino) and name them as ttyUSB*

 

You can run the following command to get a list of the tty's ports:

 

$ dmesg | grep tty

 

You can run the following command to get a list of the ttyUSB's ports (the Arduino uses FTDI, so you will find all the Arduino ttyUSB's):

 

$ dmesg | grep 'FTDI USB Serial Device converter now attached'

 

Output:

[36051.393350] usb 4-2: FTDI USB Serial Device converter now attached to ttyUSB1
[36061.823513] usb 4-1: FTDI USB Serial Device converter now attached to ttyUSB0

Once you have the output string, you only have to parse the strings and as  said, use the Array functions to get the last ttyUSB port.

 

Best regards.

David P.
National Instruments
Applications Engineer
www.ni.com/soporte
0 Kudos
Message 6 of 6
(4,199 Views)