zzz: 3G: request: test /dev/ttyUSB* ports

I have been investigating if PupDial can do a good guess at the correct port to use.

If usb_modeswitch successfully switches the 3G modem from memory mode to modem mode, you may see more than one /dev/ttyUSB[n] entry.

My Optus Huawei E160E modem has four ports:
/dev/ttyUSB0, ttyUSB1, ttyUSB2, ttyUSB3

...and ttyUSB0 is the correct one to use.

Now, I found something very interesting. If I do this in a terminal:

# modem-stats -c "ATZ" /dev/ttyUSB0

OK


...that is, it returns a blank line and an "OK".

ttyUSB1 and ttyUSB2 do not respond.

However:
# modem-stats -c "ATZ" /dev/ttyUSB3


^BOOT:37673864,0,0,0,77

^BOOT:37673864,0,0,0,77

^BOOT:37673864,0,0,0,77

^BOOT:37673864,0,0,0,77

^BOOT:37673864,0,0,0,77

^BOOT:37673864,0,0,0,77

NO CARRIER

OK


...this is great! I can use the "NO CARRIER" response to determine that ttyUSB3 is not the one to use. Also, the non-response of ttyUSB1 and ttyUSB2 to rule them out.

I currently only have the Optus 3G modem to play with, so I have a request to you guys who have a 3G modem:

Feedback request
If it has switched to modem mode, look in /dev to see how many ttyUSB[n] ports you have, then try the above test on each port. Let me know if this method finds the correct port for you!

Please do this test before using PupDial (or any other method) to connect to the Internet.

I am eagerly awaiting feedback! Try this on any Puppy, not just Quirky.


Posted on 4 Dec 2010, 8:17


Comments:

Posted on 4 Dec 2010, 8:44 by BarryK
AT commands
Looking up Hayes AT commands, it seems might be necessary to send "V1" (verbose) command to get the error messages such as "NO CARRIER".

Um, I think?:

# modem-stats -c "ATV1Z" /dev/ttyUSB0



Posted on 4 Dec 2010, 8:46 by BarryK
Forum request
I also posted this request to the forum:

http://murga-linux.com/puppy/viewtopic.php?t=62658



Posted on 4 Dec 2010, 9:07 by BarryK
Re NO CARRIER
Another way to do it would be to attempt a dialout

# modem-stats -c "ATDT*99#" /dev/ttyUSB3

NO CARRIER


...might need CTRL-C to terminate.

If it does work, in my case of ttyUSB0, maybe can send a hangup command:

# modem-stats -c "ATH" /dev/ttyUSB0

...dunno, just guessing, as I don't have an Optus wireless signal to connect to at my home.



Posted on 4 Dec 2010, 12:03 by ozsouth
3g
Tested with Pup431, Quirky120 & Lupu510.
Huawei E1762. Same result for all distros.

If I plug modem in when desktop settles & wait for 'sr1' icon, I get:


# modem-stats -c "ATZ" /dev/ttyUSB0

OK


ttyUSB1 does not respond.


# modem-stats -c "ATZ" /dev/ttyUSB2

OK



# modem-stats -c "ATZ" /dev/ttyUSB3
modem-stats: Can't open /dev/ttyUSB3 for reading and writing.
Usage: modem-stats [-c command] [-e end string] device



ttyUSB2 refuses to connect, but ttyUSB0 works.


However, if I don't wait for the sr1 icon, just about 5 seconds after plugging in the modem, I get
the same BOOT... message you get for ttyUSB2.
Note: the 'OK' for ttyUSB0 is immediate; about 7 seconds before the ttyUSB2 BOOT... message appears. Hope this helps.








Posted on 4 Dec 2010, 16:54 by Dejan
pgprs patch
Hey Barry regarding 3G modems many users use pgprs setup/connect for connection and there's a bug in pgprs-setup in all puppy versions it needs to be fixed in woof so it can be applied to future puppy builds. I'm not really sure if someone already reported for wary/quirky but if you leave pin field empty you can't run setup again because it causes error in gtkdialog.
FIX: /usr/bin/pgprs-setup
Below line 60 that says
PIN=$"`grep CPIN /etc/ppp/peers/gprs-connect-chatmm | sed 's/\(.*CPIN=\"\)\([^\"]*\)\(.*\)/\2/'`"

I added simple fix:
#if there's no pin gtkdialog has errors, put 1234 instead blank

if [ "$PIN" = "" ]; then PIN="1234"; fi


Also, pgprs-setup says "Run pgprs-connect from network menu" but it doesn't show in menu until you refresh menus.
Great that you work on 3G modems support, I have one particular that doesn't want to work it's ZTE MF626, I kinda did some testing thru PM with rerwin but it's tricky model and I didn't have enough patience I think it still doesn't work (I believe it has 3 modes since it also has part where you can plug in microSD card and it starts connecting if you specify ttyUSB1, rerwin even got it to recognize that port but it disconnects immidietly after connect.)


Posted on 4 Dec 2010, 18:29 by BarryK
Re PGPRS
Dejan:
http://bkhome.org/blog/?viewDetailed=02013



Posted on 4 Dec 2010, 18:39 by BarryK
Re ZTE MF626
As far as I can see, it should "just work" with the latest usb_modeswitch.

Well, I will be uploading another Quirky with latest 'zzz' package in 4-5 days, try that.



Posted on 5 Dec 2010, 6:14 by wombat01
Huawei K3765
With a Huawei K3765 I get the following:

# modem-stats -c "ATV1Z" /dev/ttyUSB0


OK
# modem-stats -c "ATV1Z" /dev/ttyUSB1
^C
# modem-stats -c "ATV1Z" /dev/ttyUSB2
^C
# modem-stats -c "ATV1Z" /dev/ttyUSB3


OK



Posted on 5 Dec 2010, 8:04 by BarryK
3G ports: oh well
Well, at least this method can be used to eliminate some ports that don't respond at all.



Posted on 6 Dec 2010, 10:55 by zygo
finding the real modem
Barry,

http://www.codeproject.com/KB/IP/3G_Modem_Internet_Dialer.aspx
2 thirds of the way down commands listed include signal strength.
On my Huawei E1550

# modem-stats -c "AT+CSQ?" /dev/ttyUSB2

ERROR

ERROR

^RSSI:23

^RSSI:23
^C
# modem-stats -c "AT+CSQ?" /dev/ttyUSB0

ERROR^C
# modem-stats -c "AT+CSQ?" /dev/ttyUSB1
^C
#

I connect on /dev/ttyUSB0 which returns 2 lines.
Any good with your hw?


Posted on 6 Dec 2010, 11:28 by BarryK
Re signal strength
modem-stats -c "AT+CSQ?" /dev/ttyUSB2

...no good with my Optus modem.



Posted on 6 Dec 2010, 11:53 by 01micko
e169 results
For Huawaei e169... Bus 002 Device 004: ID 12d1:1001

# modem-stats -c "ATV1Z" /dev/ttyUSB0

ATV1
NO CARRIER

OK

# modem-stats -c "ATV1Z" /dev/ttyUSB0 >> modemfile
(hangs for ages, ctrl-c)

# modem-stats -c "ATV1Z" /dev/ttyUSB2

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

^BOOT:18030308,0,0,0,72

(and still going.. for at least 5 mins, end up doing ctrl-c)

# modem-stats -c "ATV1Z" /dev/ttyUSB3
modem-stats: Can't open /dev/ttyUSB3 for reading and writing.
Usage: modem-stats [-c command] [-e end_string] device

Always uses /dev/ttyUSB0

Note that I'm with VirginBroadand (prepaid) and it seems to need CHAP authentication.. perhaps the only carrier to need this. I formerly appended "-chap" to /etc/ppp/options until Richard came up with a work around. There is a file, /etc/wvdial_options/APN-VirginBroadband which contains "-chap". Hope this info is useful
Cheers


Posted on 6 Dec 2010, 11:56 by 01micko
correction
Sorry, second entry was wrong..
# modem-stats -c "ATV1Z" /dev/ttyUSB0 >> modemfile
(hangs for ages, ctrl-c)

I was trying to log it


should have read
# modem-stats -c "ATV1Z" /dev/ttyUSB1
(hangs for ages, ctrl-c)


Posted on 11 Jan 2012, 7:31 by bijendrabajra
Mr.
Hi Barry I have strong rising china telcom modem.
Works great on Wary 5.2.2 automatic green txt with found usb modem shows, works with option module, pupdial guess correctly.
puppy lupu 5 works
puppy 4.3.1.1 little glitchy at least works with usbserial module.
my thread
http://www.murga-linux.com/puppy/viewtopic.php?t=74105