site  contact  subhomenews

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

December 04, 2010 — BarryK
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.

Comments

AT commands
Username: BarryK
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?: [i]# modem-stats -c "ATV1Z" /dev/ttyUSB0[/i]

Forum request
Username: BarryK
"I also posted this request to the forum: http://murga-linux.com/puppy/viewtopic.php?t=62658

Re NO CARRIER
Username: BarryK
"Another way to do it would be to attempt a dialout [i]# modem-stats -c "ATDT*99#" /dev/ttyUSB3 NO CARRIER[/i] ...might need CTRL-C to terminate. If it does work, in my case of ttyUSB0, maybe can send a hangup command: [i]# modem-stats -c "ATH" /dev/ttyUSB0[/i] ...dunno, just guessing, as I don't have an Optus wireless signal to connect to at my home.

3g
Username: ozsouth
"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.

pgprs patch
Username: Dejan
"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 [code]PIN=$"`grep CPIN /etc/ppp/peers/gprs-connect-chatmm | sed 's/(.*CPIN=")([^"]*)(.*)/2/'`"[/code] I added simple fix: [code]#if there's no pin gtkdialog has errors, put 1234 instead blank if [ "$PIN" = "" ]; then PIN="1234"; fi[/code] 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.)

Re PGPRS
Username: BarryK
"Dejan: http://bkhome.org/archive/blog2/201012/pgprs-modem-fix.html

Re ZTE MF626
Username: BarryK
"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.

Huawei K3765
Username: wombat01
"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

3G ports: oh well
Username: BarryK
"Well, at least this method can be used to eliminate some ports that don't respond at all.

finding the real modem
Username: zygo
"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 [code] # 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 # [/code] I connect on /dev/ttyUSB0 which returns 2 lines. Any good with your hw?

Re signal strength
Username: BarryK
"modem-stats -c "AT+CSQ?" /dev/ttyUSB2 ...no good with my Optus modem.

e169 results
Username: 01micko
"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

correction
Username: 01micko
"Sorry, second entry was wrong.. [i]# modem-stats -c "ATV1Z" /dev/ttyUSB0 >> modemfile (hangs for ages, ctrl-c) [/i] I was trying to log it should have read # modem-stats -c "ATV1Z" /dev/ttyUSB1 (hangs for ages, ctrl-c)

Mr.
Username: bijendrabajra
"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


Tags: quirky