Page 1 of 1

GPRS modems work via Pupdial ?

Posted: Sun 27 Apr 2008, 09:36
by Kazm
GPRS modems gives devices like
/dev/ttyACM0, /dev/input/ttyACM0, /dev/input/ttyUSB0...

I try made simlink like this
# ln -s /dev/input/ttyACM0 /dev/ttySACM0

and Pupdial find this modem 8)

But now some problem in pupdial script.
For my GSM operator need this INIT2:
Init2 = AT+CGDCONT=1,"IP","internet.beeline.ru"

But script "eat" some part of string and I get this INIT2:
Init2 = AT+CGDCONT=1,

If we solve this problem, we get one program for all types of modems :roll:

Posted: Sun 27 Apr 2008, 10:56
by Aitch

Posted: Sun 27 Apr 2008, 11:45
by HairyWill
good call

The problem seems to be getting an init string with quotes into and back out of gtkdialog. Line 73 of /usr/sbin/pupdial needs something similar to

Code: Select all

INIT2M="`cat /etc/wvdial.conf | grep '^Init2 = ' | cut -f 3-12 -d ' '| sed 's/"/\\\\"/g;'`"
note this is wrong because it inserts an extra backslash. I can't get gtkdialog to display <edit>quotation marks without also showing a backslash</edit>.

There are more problems where the the output from the dialog is read.

Code: Select all

eval "$RETSTRING"
Is risky because it tries to evaluate all of the output. Some of this is not executable and there is always the risk that one of the expressions could be something downright dangerous. Which field do I have to type rm -f /* into to wipeout my installation?
Something like this is safer

Code: Select all

RETSTRING=(`gtkdialog3 --program=MAINDIALOG`)
for foo in ${RETSTRING[@]}; do
echo $foo
[ "$(echo $foo | grep -E 'CHECKBC|CHECKCC|CHECKDT|ENTRYACC1ISP|ENTRYACC1PASS|ENTRYACC1USER| #broken line for forum
ENTRYACC2ISP|ENTRYACC2PASS|ENTRYACC2USER|ENTRYBAUDM|ENTRYINIT1M|ENTRYINIT2M|EXIT|#broken line for forum
ynAUTO_RECONNECT1|ynAUTO_RECONNECT2|ynSTUPID_MODE1|ynSTUPID_MODE2')" ] && eval $foo 
done
but I haven't included specially handling for variables with quotes in this example.

This is so close to working, well done.

I messed around and got pupdial to work with my mobile but then it wrote quotes into wvdial.conf and which broke pupdial the next time it tried to load the gui. It can probably be made to work if you accept the backslash characters in the display.

Posted: Sun 27 Apr 2008, 15:09
by HairyWill
ok here is a patch for the pupdial in dingo beta 2

Code: Select all

# diff pupdial.orig pupdial.new 
73c73
<  INIT2M="`cat /etc/wvdial.conf | grep '^Init2 = ' | cut -f 3-12 -d ' '`"
---
>  INIT2M="`cat /etc/wvdial.conf | grep '^Init2 = ' | cut -f 3-12 -d ' '| sed 's/"/\\\\"/g;'`"
163c163
<     <default>\"${INIT2M}\"</default>
---
>     <input>echo \"${INIT2M}\"</input>
346,350c346,352
< 
< #RETSTRING="`echo "$MAINDIALOG" | gtkdialog3 --stdin`"
< RETSTRING="`gtkdialog3 --program=MAINDIALOG`"
< 
< eval "$RETSTRING" #v3.99
---
> #patched by hairywill to allow quotation marks in INIT2M
> RETSTRING=(`gtkdialog3 --program=MAINDIALOG`)
> for ONEEXPRESSION in ${RETSTRING[@]}; do
> [ "$(echo $ONEEXPRESSION | grep -E 'CHECKBC|CHECKCC|CHECKDT|ENTRYACC1ISP|ENTRYACC1PASS|ENTRYACC1USER|
ENTRYACC2ISP|ENTRYACC2PASS|ENTRYACC2USER|ENTRYBAUDM|ENTRYINIT1M|EXIT|
ynAUTO_RECONNECT1|ynAUTO_RECONNECT2|ynSTUPID_MODE1|ynSTUPID_MODE2')" ] && eval "$ONEEXPRESSION" 
> [ "$(echo ${ONEEXPRESSION} | grep 'ENTRYINIT2M')" ] && ENTRYINIT2M=$(echo $ONEEXPRESSION| sed 's/.*="//;s/"$//')
> done
> #end of patch
warning:I put a couple of line breaks in there to stop the page being so wide

Posted: Sun 27 Apr 2008, 18:12
by John Doe
Is the cdc-acm kernel module loaded automatically or does it need to be done manually?

We should work out a way to do it automatically if need be. Then it would be really easy for anyone with a GPRS modem.

Posted: Sun 27 Apr 2008, 19:31
by HairyWill
cdc_acm is not loaded automatically in dingo beta 2

Do all mobile phones use cdc_acm, and do these all present as the same device node?
The simplest would be a button "press this if you have connected a mobile".
I presume it could also be done automatically at boot by putting in all the usb ids. Though this is not so helpful if you plug the phone in after booting. What would be really helpful would be a list of countries, providers, contract type, connection strings and numbers as finding the connection string and correct number is a significant hurdle. A page for recording these on the wiki might be good.

Posted: Tue 29 Apr 2008, 01:33
by John Doe
just wanted to let you guys know i'm working out a big reply and a couple wizards.

more in a few hours.

Posted: Tue 29 Apr 2008, 19:15
by John Doe
passed out before I could finish it last night.

couple more hours, here's a progress report as an image.

i've got my phone modem recognized with a couple clicks off a fresh DingoBeta2.

Posted: Wed 30 Apr 2008, 17:20
by John Doe
Kazm, if you're out there, can you test this?

http://www.murga-linux.com/puppy/viewto ... 795#193795

I'm trying to automate it all.

You should be able to get your phone recognized by Pupdial with just a couple clicks of a fresh boot.

Whether or not you can connect after that....that's a different story.

Posted: Wed 30 Apr 2008, 19:56
by HairyWill
John this looks great.

I gave a whirl and hit several snags.
I pretended that I didn't know which device it would get connected to. I went through all of the usb device options then used an init2 string that I already knew works to try and dial out. It failed. I can't remember the exact message from wvdial. I checked which modules were loaded and I had ipaq and idtl_???? as well as cdc_acm, I unloaded those and pupdial worked and got me connected :-).

I haven't looked at the code at all so if any of my comments don't make sense I apologise.

It might be good to have a list of usb.ids to decide which driver to load. I suppose it would make sense to get Barry to add them to the main list.

As far as working out what node the device is on surely there must be a way of probing the node to see if something is on the other end of it.

After pupdial finds a device it automatically writes a connection string into init2. I don't expect that this can be filled automatically but it might be helpful if we can give the user some clues on where to search for this and the number to dial.

I also was intrigued to see the vpn options. I'm not convinced this is exactly the right place for them but its great you are having a bash at this. The loss of pptpconfig bothered me though I did finally work out how to get my vpn working by hand a few weeks ago.

I tried the ms pptp option and first had to lookup the ip of my server as I only know its name. I didn't really know what I was supposed to put in the default route or netmask, though I could probably work it out if I thought hard. I wasn't quite sure if the ppp0 referred to my current interface or the one the tunnel was going to create. Isn't this always one more than the existing ppp interface(s), I left all the other settings as default. I hit the connect button and was rewarded with an extra blinky but no other output. The network connection didn't work and it looked like the routing table was wrong, I presume I made the wrong choices in the config. When I disconnected the tunnel it didn't put back my original dns servers into resolv.conf though the routing table was fine.

Hope this helps, give me a shout if you want further clarification, I think this is a great project.

Posted: Thu 01 May 2008, 12:28
by Kazm
HairyWill and John, I hope we do it in service pack for Dingo 4 :roll:
And now I'm testing your new scripts in our PuppyRus (based on Puppy 3.01).

I tried make HairyWill's patch to pupdial, but I done something wrong and it's no working right :cry:

But then I tried use CDMA-phone modem that use such init2:
Init2 = at+crm=1;&C0

And thats work :lol:
But not connect :lol:
This is log:

Code: Select all

--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: at+crm=1;&C0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected.  Waiting for prompt.
--> Don't know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at Thu May  1 13:20:03 2008
--> pid of pppd: 23541
--> Disconnecting at Thu May  1 13:20:14 2008
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 160 seconds
I know there not some files...maybe...

Posted: Thu 01 May 2008, 19:47
by HairyWill
kazm
Try installing johns new version at the link above, that should work.

Barry has patched his copy to allow quotation marks in both init strings so the next iso he releases at the weekend should work for you as long as you load the module and make the dev link yourself.

Posted: Wed 07 May 2008, 08:31
by magerlab
will it also work on puppy 3?
i want to use a cell phone as a modem with eeepc

Posted: Sat 10 May 2008, 01:49
by John Doe
I think I have the finding of the device figured out, without resorting to simlinking stuff all over the place.

I looked through all the scripts and found that wvmodemscan was the app that detects the modems.

The 2.6x kernel seems to put them in different places than 2.4x.

I found the code, next I'll compile do a quick test and post it for everyone to test.

Code: Select all

static int fileselect(const struct dirent *e)
{
    return !strncmp(e->d_name, "ttyS", 4)      	// serial
       || !strncmp(e->d_name, "ttyLT", 5)	// Lucent WinModem
       || !strncmp(e->d_name, "ttyACM", 6)      // USB acm Modems
       || !strncmp(e->d_name, "ttyUSB", 6)      // Modems on USB RS232
       || !strncmp(e->d_name, "ircomm", 6)      // Handys over IrDA
       || !strncmp(e->d_name, "ttySL", 5);	// SmartLink WinModem

	// (no internal ISDN support)   || !strncmp(e->d_name, "ttyI", 4);
}

GPRS for Puppy

Posted: Fri 31 Oct 2008, 18:51
by lstandish
I just want to point out that Puppy 4.1 now has "pgprs," a generic wizard to detect and configure GPRS serial modem devices. It creates scripts that work directly with pppd.

I'm wondering if you ever got pupdial working with GPRS. The main catch I see to use of pupdial is the require to enter (once) the GSM PIN code to unlock the card. It is this requirement that has never allowed me to use common dialup programs.