Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-16-2013, 09:43 PM   #1
LQ Newbie
Registered: Apr 2012
Posts: 3

Rep: Reputation: Disabled
which ttyUSBx is mine?

the direction /dev/ has three ttyUSB, i know the ttyUSB1 is mine, but software dosen't know, so write demo use polling model detect ttyUSB, for every device use open(),write(), read(), when demo read ack from ttyUSB and think this is my device, but i think this model affect other programe, so if you has good way, please help me. very thank you
Old 09-17-2013, 08:09 AM   #2
Registered: Mar 2013
Posts: 627

Rep: Reputation: 137Reputation: 137
Have you checked sys?
1)Go to cd /sys/devices
2) If we find the directory of the ports: find -name "ttyUSB1". It will probably find them in something like ./pci0000:00/0000:00:1d.0/usb2/2-2/2-2.1/2-2.1:1.0/...
The pci* part is the USB controller. The interesting bit is the 2-2.1 which is the USB device.

If you want to differentiate different USB devices, you can differentiate them using their vendor id and product id.

Every usb device has it's unique vendor id and product id.
You can detect it easily using command
Now it will show the id in terms of something like ID 045e:00cb for every usb device, In this example 045e is vendor ID and 00cb is productid.


a) just run cd /sys/class/tty/
b) readlink ttyUSBn
will give you the full path of the device directory.

Last edited by eklavya; 09-17-2013 at 08:11 AM.
1 members found this post helpful.
Old 09-19-2013, 05:15 AM   #3
Registered: Jun 2013
Location: Ipswich, Australia
Distribution: Slackware
Posts: 74

Rep: Reputation: Disabled
You can add a udev rule that creates a symlink to your device when it is plugged in so no matter which tty it's assigned you can access it by the symlink.
1 members found this post helpful.
Old 09-26-2013, 05:39 AM   #4
LQ Newbie
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up Thank you

Thank you, very thanks, your advice is very good, I have solved the problem.
Old 09-26-2013, 05:47 AM   #5
LQ Newbie
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up THANK you

check vendor and product id is good way


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB 3G on ARM board Debian - not loading ttyUSBx serials vitoacmm Linux - Embedded & Single-board computer 2 11-09-2012 09:37 PM
[SOLVED] Trouble getting all data out of usbserial (/dev/ttyUSBx) rtmistler Linux - Software 3 10-09-2012 01:26 PM
[SOLVED] 3G modem not visible as /dev/ttyUSBX Aldebaran Slackware 4 01-27-2011 11:18 PM
Force a USB device to use a specific /dev/ttyUSBX garnser Linux - Software 4 02-10-2006 07:28 AM
USB pilot-link under Fedora Core 3: /dev/ttyUSBx there but not there reeder.29 Linux - Laptop and Netbook 2 10-17-2005 11:25 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration