LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 01-02-2012, 10:24 AM   #1
elazarik
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu, Fedora
Posts: 14

Rep: Reputation: Disabled
Question How to find out which /dev/ttyUSB* can be used for 3G modem connection?


Hi

I am writing a Perl script that detects USB 3G modem (of various types), switches it and then creates a connection with the ISP provider.

My problem is that several /dev/ttyUSB* files are created, and most cannot be used to connect.
I managed to filter some out by using modem command such as "at+csq" or "ati" (I receive a "timeout" on unconnected ttyUSBs).
But in some cases I am left with more than one /dev/ttyUSB* that respond correctly to these commands, but only one ttyUSB will actually work correctly with pppd.

For a more concrete example: USB stick Alcatel X220 (Vendor 1bbb product 0017). Both ttyUSB3 and ttyUSB4 respond to ati commands, but only ttyUSB4 will actually create the ppp connection (on ttyUSB3 pppd sends configuration requests but no answers are received).

Is there a way I can find out which ttyUSB is usable through a script?
This way should be generic for all USB modem types

The only way I can think of now is to add specific udev rules for ALL supported USB modems. And every time we add another supported modem, to add another rule.
Will be very thankful if there is an easier way to find out which ttyUSB to use

Thank you
Karin
 
Old 01-02-2012, 10:27 AM   #2
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Ubuntu
Posts: 199

Rep: Reputation: 36
Have you tried using lsusb to locate the right one?.
 
Old 01-03-2012, 12:29 AM   #3
elazarik
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu, Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
Can you please elaborate?
lsusb returns "Bus 001 Device 003: ID 1bbb:0017"

How can I use this output to locate the correct /dev/ttyUSB*?

(I understand it helps me locate the /proc/bus/usb file that I can use for usbreset, but how else can I use this?)

Thank you
Karin
 
Old 01-03-2012, 01:37 AM   #4
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Ubuntu
Posts: 199

Rep: Reputation: 36
Is /dev/ttyUSB* a file or a link to a file in /dev/bus/usb/00?

If it is not a link then maybe you can get the information you need from dmesg, otherwise you can use udev rules (create your own in /dev/udev/rules.d) to map your device to the same filename when connected to the system.

You will have to read de documentation to create your own rule (check this link), but you can also look inside the ones already created by the system (the one for the CD could help) and you will get a notion about how you should create your own.

Last edited by rodrifra; 01-03-2012 at 01:58 AM.
 
Old 01-03-2012, 02:32 AM   #5
elazarik
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu, Fedora
Posts: 14

Original Poster
Rep: Reputation: Disabled
/dev/ttyUSB* are files and not symbolic links
Also dmesg offers no help

I guess I will have to create a rule for each supported modem type (sadly - a few hundreds... :-( ). I guess I will create a script for that ... ;-)

Thank you for your help
K
 
  


Reply

Tags
3g, modem, ttyusb


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
No /dev/ttyUSB<*> in CentOS 5.4 baig Linux - Newbie 1 03-05-2010 03:02 PM
/dev/ttyUSB* is getting locked shariefbe Linux - Software 1 02-09-2010 10:55 PM
CentOS: No /dev/ttyUSB chris24300 Fedora 4 08-05-2009 12:29 PM
no /dev/ttyUSB* with FC3 please help derddera Fedora 3 12-30-2004 07:43 AM
/dev/ttyUSB? disappaers on SuSE 9.1 with pilot-link gevard Linux - Laptop and Netbook 0 08-29-2004 02:44 PM


All times are GMT -5. The time now is 01:24 AM.

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
Open Source Consulting | Domain Registration