0x0000
Posts: 137
Joined: Tue Aug 27, 2013 8:59 pm

What is /dev/ttyUSBX ?

Wed Jan 01, 2014 9:30 am

Hello,

I am currently connecting two USB devices on my Raspberry Pi , a Wifi Dongle and a GPS receiver. But even if i swap there positions the GPS data is always available at

Code: Select all

/dev/USB0
.

What I mean is,

If i connect GPS Rx to the first USB port , I could read its data from /dev/ttyUSB0
and even if i connects it to the 2nd USB port , I still have to read it from /dev/ttyUSB0.

Why the data is always available at /dev/ttyUSB0 , isn't there anything like /dev/ttyUSB1 for 2nd port ?

Also, If I'd connect self-powered USBhub, would there be /dev/ttyUSB2, /dev/ttyUSB3, /dev/ttyUSB4, etc ?

User avatar
rpdom
Posts: 17454
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: What is /dev/ttyUSBX ?

Wed Jan 01, 2014 10:11 am

The device numbering doesn't relate to which USB port it is plugged in to.

It is the order that the devices are detected. ttyUSB means "USB serial port adapter" and the "0" (or "1" or whatever) is the device number. ttyUSB0 is the first one found, ttyUSB1 is the second etc. (Note that if you have two similar devices, then the ports that they are plugged into may affected the order they are detected in, and so the names).

You only have one serial device, so it will always be ttyUSB0.

Your wifi dongle is not a serial port adapter, so doesn't get a ttyUSB created for it.

0x0000
Posts: 137
Joined: Tue Aug 27, 2013 8:59 pm

Re: What is /dev/ttyUSBX ?

Wed Jan 01, 2014 10:27 am

rpdom wrote:The device numbering doesn't relate to which USB port it is plugged in to.

It is the order that the devices are detected. ttyUSB means "USB serial port adapter" and the "0" (or "1" or whatever) is the device number. ttyUSB0 is the first one found, ttyUSB1 is the second etc. (Note that if you have two similar devices, then the ports that they are plugged into may affected the order they are detected in, and so the names).

You only have one serial device, so it will always be ttyUSB0.

Your wifi dongle is not a serial port adapter, so doesn't get a ttyUSB created for it.
Thank you very much...The Raspberry Pi books available around doesn't really explain everything.
This forum is a perfect place.

keyurthumar
Posts: 18
Joined: Fri Oct 04, 2019 8:49 am

Re: What is /dev/ttyUSBX ?

Mon Feb 17, 2020 1:05 pm

Thank you for the answer @rpdom.

How do I know that the name of the serial port adapter created for the device connected to nth number Port of USB HUB (Which is connected to Raspberry PI)

User avatar
B.Goode
Posts: 10448
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: What is /dev/ttyUSBX ?

Mon Feb 17, 2020 1:20 pm

keyurthumar wrote:
Mon Feb 17, 2020 1:05 pm
Thank you for the answer @rpdom.

How do I know that the name of the serial port adapter created for the device connected to nth number Port of USB HUB (Which is connected to Raspberry PI)



More than 6 years on the advice from @rpdom still looks accurate.

The port-to-name association you are seeking does not exist.

Return to “Beginners”