LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-16-2013, 08:43 PM   #1
dk_embed
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, 07:09 AM   #2
eklavya
Member
 
Registered: Mar 2013
Posts: 553

Rep: Reputation: 113Reputation: 113
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
Code:
lsusb
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.

OR

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 07:11 AM.
 
1 members found this post helpful.
Old 09-19-2013, 04:15 AM   #3
briselec
Member
 
Registered: Jun 2013
Location: Ipswich, Australia
Distribution: Slackware
Posts: 32

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, 04:39 AM   #4
dk_embed
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, 04:47 AM   #5
dk_embed
LQ Newbie
 
Registered: Apr 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up THANK you

check vendor and product id is good way
 
  


Reply


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 08:37 PM
[SOLVED] Trouble getting all data out of usbserial (/dev/ttyUSBx) rtmistler Linux - Software 3 10-09-2012 12:26 PM
[SOLVED] 3G modem not visible as /dev/ttyUSBX Aldebaran Slackware 4 01-27-2011 10:18 PM
Force a USB device to use a specific /dev/ttyUSBX garnser Linux - Software 4 02-10-2006 06: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 10:25 AM


All times are GMT -5. The time now is 12:51 PM.

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