Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 01 Oct 2016, 04:56
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
[SOLVED]How do I get a USB modem to connect on startup?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [38 Posts]   Goto page: 1, 2, 3 Next
Author Message
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Tue 19 Apr 2016, 10:35    Post subject:  [SOLVED]How do I get a USB modem to connect on startup?  

Puppy Precise 5.7.1 usually connects on startup to the last successful internet connection I think.

I find that when it is set to GPRS it does not do this and you must use either the connect icon or the tray icon to start the negotiation .

Is there a way to get the negotiation to start on boot up ?
Perhaps a script or something .
I would also like the Openvpn program to run thereafter if possible.

EDIT- Turns out the software install script is on the device when first plugged in. Follow the readme on the device and when properly installed it will show as an optical device for about 10 seconds and then that will disappear and the modem will connect as normal. No modeswitching needed these days.

Last edited by april on Sun 24 Apr 2016, 13:50; edited 2 times in total
Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 605

PostPosted: Tue 19 Apr 2016, 12:07    Post subject:  

Hi, April!

I don't have a gprs modem to work with, but I would be tempted to use a udev rule to automatically connect the modem up whenever it was plugged in. The udev rule would execute the script when the modem was inserted.

The problem is that there are many steps to get there.

First we would need to look in dmesg to see how the usb device is identified.
Second we would need to "udevadm" to dump the device stack for it.
Third would be to create the udev rule from the info we got in step 2
Fourth, we would write the connect script.

So, lots of steps, no? But once done, from then on, when you plug it in, it's all automatic.

This kinda demonstrates the end-to-end process to build it. Keep in mind you aren't interested in pppd/pptp, you will use OpenVPN. Near the bottom is all the techie stuff on how we would use udev to automate the proceess:
https://wiki.archlinux.org/index.php/3G_and_GPRS_modems_with_pppd

How bold do you feel today? Smile So what brand of gprs modem is it? Maybe we can find some breadcrumbs on the googles.
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Tue 19 Apr 2016, 16:39    Post subject:  

Its a Huawei E160E
Bus 001 Device 005: ID 12d1:140c Huawei Technologies Co., Ltd.

I take it the udev rule you are pointing to is
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="0612", DEVPATH=="*/ttyACM0", RUN+="pon"
which I should change to
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="140c", DEVPATH=="*/ttyUSB0", RUN+="pon"

Not sure what the last bit is "pon" ?
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 01:57    Post subject:  

atm when I click connect it comes up as ppp0 connects to ttyUSB0
little script I'm trying gets it connected with
Code:
#! /bin/bash
sleep 10

pgprs-connect
# script to start OpenVPN on startup
openvpn --config /vpnbook-ca1-tcp443.ovpn

THIS GETS CONNECTION UP but no VPN

But not so good . Just wondering why I cant start pgprs-connect in the start menu . Hmm

Certainly first you must setup the Internet connection using GPRS Connect
Then choose "Wireless GPRS Modem" and fill in the details needed.

Then in the Startup folder there must simply be a way to make the "Connect" icon on the desktop, or ,in the tray , run . How to do that?

The desktop icon has " /usr/local/apps/Connect" as a program to run so I tried that in a script and it does not work . I also tried creating a link to it directly in the Startup folder but again no luck. I think I need some delay to give the modem enough time to configure itself on bootup.

Last edited by april on Wed 20 Apr 2016, 05:33; edited 7 times in total
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 1669

PostPosted: Wed 20 Apr 2016, 03:51    Post subject:  

Hi, April
My HOWTO here: http://www.murga-linux.com/puppy/viewtopic.php?t=105455 may be of interest to you. To make an automatic connection at startup, you can copy the connection script to your Startup folder in /root. Edit: I see you have already been to that link, it wasn't of any use?
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 04:59    Post subject:  

It uses the old line modem dialler rather than the newer GPRS dialler nic007 and the GPRS dialler allows you to set the APN for the provider and the dial number in an easier fashion for the less technically minded like me .
Last edited by april on Wed 20 Apr 2016, 06:25; edited 1 time in total
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 1669

PostPosted: Wed 20 Apr 2016, 05:36    Post subject:  

april wrote:
It uses the modem dialler rather than the GPRS dialler nic007

Can you use dial-up (wvdial) instead?
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 05:48    Post subject:  

OK got the connect to run OK and probably the vpn with this script in the Startup folder
It runs in the background and I would like it to run in a terminal window so I have to work that bit out yet.

Code:
#! /bin/bash
# script to start pgprs-connect on startup
sleep 05
pgprs-connect
# script to start OpenVPN on startup
openvpn --config /mnt/home/TempSave/OpenVPN/vpnbook-ca1-tcp443.ovpn --auth-user-pass [/mnt/home/Tempsave/OpenVPN/upfile]


Now the problem becomes VPN has a username "vpnbook" which has to go in and then it asks for a password which is "Suwrav4P" atm see the above line for entry .Those are placed on separate lines in the file "upfile" which is the User/Password file

That password changes and the current one is available from the web site http://www.vpnbook.com/ under the OpenVPN tab on that page .
So now how to get that automatically and how to get it into the upfile above?

Last edited by april on Wed 20 Apr 2016, 06:20; edited 3 times in total
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 06:10    Post subject:  

nic007 - Your barrow is too heavy . You may push it along as you wish but I look for the easy way .Thanks though Mate!
Back to top
View user's profile Send private message 
nic007


Joined: 13 Nov 2011
Posts: 1669

PostPosted: Wed 20 Apr 2016, 06:25    Post subject:  

april wrote:
nic007 - Your barrow is too heavy . You may push it along as you wish but I look for the easy way .Thanks though Mate!

Just trying to help. Good luck.
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 06:31    Post subject:  

jafadmin wrote:
Hi, April!
I don't have a gprs modem to work with, but I would be tempted to use a udev rule to automatically connect the modem up whenever it was plugged in. The udev rule would execute the script when the modem was inserted.
So, lots of steps, no? But once done, from then on, when you plug it in, it's all automatic.

I would like to understand this more . jafadmin
The glaring inadequacy of my above is that the modem must be plugged in already as it wont connect otherwise and must then be done manually anyway..
Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 605

PostPosted: Wed 20 Apr 2016, 09:16    Post subject:  

april wrote:
jafadmin wrote:
Hi, April!
I don't have a gprs modem to work with, but I would be tempted to use a udev rule to automatically connect the modem up whenever it was plugged in. The udev rule would execute the script when the modem was inserted.
So, lots of steps, no? But once done, from then on, when you plug it in, it's all automatic.

I would like to understand this more . jafadmin
The glaring inadequacy of my above is that the modem must be plugged in already as it wont connect otherwise and must then be done manually anyway..


Once the udev rule is installed, it gets invoked whenever the device is plugged in. So ...
Code:
RUN+="ConnectScript"

... is the part that does the work. Cool, no?
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Wed 20 Apr 2016, 14:43    Post subject:  

Well I f/mucked around with udev rules like this
Code:
ATTR{idVendor}=="12d1", ATTR{idProduct}=="140c", RUN+="/mnt/home/TempSave/Scripts/openvpn.sh"

and could not get it to work whatever.

By placing the script as a link in "/root/Startup" folder the connect part works every time .

Don't see what I have wrong pretty sure the device ID is OK as thats what I get on an "lsusb" but maybe I need the product ID before its switched . ie the default product ID
Back to top
View user's profile Send private message 
jafadmin

Joined: 19 Mar 2009
Posts: 605

PostPosted: Wed 20 Apr 2016, 20:54    Post subject:  

I usually create a test script that will just confirm the udev rule is working first.
Something like:
Code:
date >> /root/mydocuments/ruletest.out

call it "ruletester" or whatever and use that in the RUN+="ruletester"

once you get it to where it adds a time/date stamp every time you plug in the device, you can work with debugging your connect script.

Also: http://cafim.sssup.it/~giulio/other/huawei-E1692.html
Back to top
View user's profile Send private message 
april


Joined: 14 Sep 2013
Posts: 760
Location: Sunning up on the Great Barrier Reef (Mostly Dead or Dying(me too))

PostPosted: Fri 22 Apr 2016, 01:12    Post subject:  

Thanks . Thats a handy one for any situation . It goes into my script folder .
I am not getting a response however when I plug the modem in and it must be that I have the product ID wrong somehow .

lsusb only gives the product number after modeswitch has done the switch so now I have to find the ID before the switch . It seems to be switching so I assume its being done by a udev rule but perhaps thats not the case in newer hardware.

I'm studying that site you gave me atm.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [38 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0855s ][ Queries: 11 (0.0071s) ][ GZIP on ]