HOWTO: Internet access by modem

Dialup by analog modem

I originally designed Puppy to access the Internet by conventional modem dialup to an ISP (Internet Service Provider), over the Public Switched Telephone Network (PSTN). The modem is called an analog modem, as it sends and receives data by audible-frequency tones -- which you can hear as the modem dials the ISP.

I have moved on to various modes of digital broadband access, however many people, in certain parts of the world, are still on analog dialup. Therefore, this section is still very relevant!

Traditionally, Linux only really worked with what we call "hardware" serial modems -- whereas many modems are what is called "soft" modems, only sold with drivers for Microsoft Windows. If your PC has an internal modem, or a external modem attached via a USB cable, it is most likely a soft-modem.
Please note that I am describing analog modems here, for dialing-up an ISP (Internet Service Provider) -- these are different from 3G, ADSL and cable modems that are used for broadband digital Internet access.

What is a soft-modem? Basically, it is a cheaper modem that does less processing within itself and makes the CPU do some of the processing work. This means that it places an overhead on the CPU, that you won't notice with modern fast CPUs, but it is a factor for old PCs. My personal experience also is that hardware modems tend to have higher transfer speed even with modern PCs.

The real down-side of a soft-modem however, is that to make the CPU do some of the processing work requires a special driver for that particular modem, and most manufacturers have only bothered to write drivers for Windows. However, some manufacturers have become more "Linux aware" and also some Linux enthusiasts have developed drivers.

Be warned, if you have a soft modem, it may not work with Puppy. Puppy-enthusiast 'ezeze5000' (forum name) sent me half-a-dozen old PCI soft-modem cards to test. That was in 2008, and at that time I only got one of them to work in Puppy. Since then, the success-ratio has improved, and in 2010 I have got half of them to work.

Note, if a soft-modem does work in Linux, there is a jargon name used for it -- it is called a "linmodem".

How to dialup

In a nutshell, Puppy will auto-detect your analog modem, and if it is a supported type then everything will be ready to connect. For serial modems this is straightforward, however Puppy now supports many soft-modems. If it's supported, it will most likely be autodetected.

Note: autodetection and auto-setup of some modems is a work-in-progress, and there is some on-going discussion on this topic in the Puppy forum.

To dialup, all you have to do is click the 'connect' icon on the desktop. This will bring up the "Internet Connection Wizard" in which you will see a a button labelled "Internet by dialup analog or wireless modem" -- just click that and you're in business -- a program I developed called PupDial runs, and it will tell you whether or not your modem is detected.

Note, in the Internet Connection Wizard you will see some radio-buttons at the bottom. These enable you to configure the desktop 'connect' icon to immediately launch PupDial, not the Wizard -- one less click to get online!

One thing though, although Puppy can autodetect many modems and automatically set things up so that the modem is ready to go, in some cases you may have to do some extra tweaking. For example, Puppy detects your modem, but it won't dialout -- you do some research and find that the modem "initialisation string" needs to be changed, then it works. Whatever, if you do tweak a soft-modem and get it going, please please let me know about it and I can build those tweaks into the next release of Puppy.
Example: some soft modems need the "dialtone check" in PupDial to be turned off.

Further useful information

If you need to troubleshoot your dialup modem, I recommend browse around on the Puppy Forum. There is a special section on dialup modems, with lots of feedback and solutions.

The main guy who can help is forum member 'rerwin', who is currently working toward getting modems to be autodetected and automatically setup. Rerwin is also updating PupDial.

If for some reason PupDial does not work for you, Puppy has two other modem dialer programs, called Gkdial and Xeznet, that are PET packages that you can install (see 'install' icon on desktop) -- be warned though that the former is a GTK1 application, the latter a Tcl/Tk application and in the case of Puppy 4.x and later these are dependencies that will also have to be installed (although 4.20 and 4.21 does have Tcl/Tk, 4.3 and later does not) -- so stay with PupDial if at all possible. Note on Xeznet: when adding an account, the "tty" field and the "speed" field do not need to have anything entered into them as they default to /dev/modem and 115200bps.

If you would like to experiment with sending Hayes commands to your modem, Puppy has a neat little commandline program called modem-stats. Open a terminal window and run it like this: # modem-stats -c "ATZ" /dev/ttyS0 This has a local help file. Puppy also has another tiny commandline serial-port communications utility called picocom. Online help for picocom: http://linux.die.net/man/8/picocom.

There is another application, called Cutecom, a GUI serial port terminal program, that you will find in the Utility menu (note, recent releases of Puppy do not have this program builtin -- it is a PET package: see the menu Setup --> Puppy Package Manager, or click the 'install' icon on the desktop -- it requires the Qt library package, which get automatically installed). It's very easy to use: for my modem I had to tick the "Handshake: software" checkbox and selected "CR,LF line end" from the listbox near bottom of the window. After opening the serial port for any Hayes commands that you type in "Input:" box, the response from the modem will appear in the top text box. For example, you type "AT" followed by the ENTER key, and the modem should respond with "OK".

This site has more info on soft-modems: linmodems.technion.ac.il/resources.html

Here are some URLs with lists of modem strings for particular modems:

www.56k.com/inits

www.west.net/~jay/modem

'Dialup' by wireless modem

Wireless modems are often referred to as 3G modems or HSDPA modems. In a nutshell, they give you Internet access without needing wiring. They also require a "dialup" operation similar to analog modems, so in Puppy we are able to use the same PupDial GUI tool for both.

However, there are many different technologies used for these modems, other than 3G or HSDPA, such as GPRS, the main difference from the user point of view being data transfer speed. Basically, the order of increasing speed is GPRS, 3G, HSDPA.

I have only just started to write this section (as at December 2010), based on my experience with three different 3G modems. I present some notes on these that you might find useful. I live in Australia, so these notes will be particularly useful for other Aussies.

Vodafone
Access number: *99#
APN: vfprepaymbb
Optus Huwaei E160-E
Access number: *99#
APN: preconnect
Telstra
Access number: *99#
APN: telstra.internet
In PupDial, fill in the 'Access number' and 'APN' fields. The 'Username' and 'Password' fields do not matter, so leave them as they are -- do not set them to empty as the wvdial executable objects. Usually, everything else can be left as-is, and you just click the 'Connect' button.

if you live in Australia, this page is particularly useful. It has APN's for all the 3G vendors:
http://www.unlockguru.com/2011/06/australia-3g-apn-setting/

When PupDial is started and a new/changed modem is detected, PupDial tests that the modem responds and tries to determine a suitable "initialization string" -- these are commands that are sent to the modem, known as Hayes Commands. These are also used for analog modems, but with some extensions. This wikipedia page is a good introduction, and also outlines the 3G/GSM modem extensions:

http://en.wikipedia.org/wiki/Hayes_command_set

It may be that PupDial does not get the initialization string quite right for your modem. In that case, if you are able to find an alternate string that does work, let me know.

Here is various information that users have sent me, or that I have found:

Huawei E1550 3G USB modem Puppy Forum members 'zygo' and 'pakt' reported the default string did not work (1 2), but this did: AT &FE0 V1 X1 &D2 &C1 S0=0 Update: It seems that there is a problem with re-plugging this modem. Just plug it in once, and the default string generated by PupDial should work. It has also been found best to plug the modem in after bootup.
Huawei E160-E 3G USB modem This modem is interesting as it does not require a modeswitch. It is permanently in both storage and modem modes. Thus, when you plug it in you will see a optical-disc icon appear on the desktop, but it simultaneously works as a modem (at port /dev/ttyUSB0).
I would like feedback on any other modems that work this way, as I can make an entry for it in /etc/udev/rules.d/52-usb_modem_puppy.rules, to popup detection windows when the modem is plugged in.

Further hints/advice

  • You might get the best/consistent results if you plug the modem in after bootup. In theory, if the modem is already plugged-in at bootup it should still work, but some feedback reports inconsistent behaviour in this situation.
  • Some 3G modems do not need to be mode-switched. It may be that they got switched once and then remain permanently switched. You may get the situation where an optical-disc icon appears on the desktop when you plug-in the modem, but it still works as a modem -- meaning that it is simultaneously in both modes.
  • Setup in Windows first. I hate to recommend this, but if you have acess to a Windows system, plug-in your brand-new modem and get connected to the network with Windows. This may avoid some setup hassles. After that you can use the modem with Linux. I would like feedback on experiences with not using Windows at all, especially success stories!

Technical information

These are some notes for those who want to understand how Puppy is doing things "under the hood". Users don't need to know this stuff.

There are two types of modems, from the point of view of detection in Puppy: internal (fixed) or external (hotpluggable, or removable). The internal modems are detected when Puppy boots, the removable may be detected at bootup but also if the modem is plugged in after bootup.

At bootup, the script /etc/rc.d/rc.sysinit causes the correct drivers (modules) to load for detected hardware. If you look in rc.sysinit, you will see an important line of code: echo add > ${ONEPATH}/uevent #generates an 'add' uevent. This tells the kernel to generate what is called a 'uevent' for a detected item of hardware. There is a daemon program, 'udevd' that reads these uevents and in accordance with rules in /etc/udev/rules.d and /lib/udev/rules.d, causes the appropriate driver, firmware (etc.) to load/install.

The most important udev rules file is /etc/udev/rules.d/50-udev-puppy-basic.rules, which has these two lines in it:
# kernel firmware loader
SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/pup_event_backend_firmware"
# Module autoloading
ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/pup_event_backend_modprobe"
The two scripts 'pup_event_backend_firmware' and 'pup_event_backend_modprobe' take care of driver and firmware loading. Firmware are data files needed by some drivers, and these are kept in /lib/firmware.

All of Puppy's hardware detection and module loading is developed especially for Puppy and is different from all other Linux distributions. The firmware also (plus any other data files or executables) required by a driver, may not initially be in /lib/firmware, but in a 'firmware tarball' kept in /lib/modules/all-firmware -- pup_event_backend_modprobe takes care of expanding the appropriate firmware tarballs.

An important point to note is that wireless modems are often hybrid, or dual-personality devices. My 3G USB modems have two personalites -- they can behave either as a storage device or a modem. In most cases, when first plugged in, they are in storage mode and will not work as a modem. They have to be switched to modem-mode, and we have a software program called 'usb-modeswitch' to do that...

usb-modeswitch

There are special udev rules that will trigger the usb-modeswitch applicatiuon, /lib/udev/rules.d/40-usb_modeswitch.rules and /etc/udev/rules.d/41-usb_modeswitch-puppy.rules.

When you hotplug a USB modem, the usb-modeswitch should be triggered, and the modem will switch into modem-mode.

The sequence is that a udev rule for a particular USB hardware causes /lib/udev/usb_modeswitch to run, which in turn launches both /usr/sbin/usb_modeswitch_dispatcher and /usr/sbin/usb_modeswitch_status.
The former will perform the actual switch to modem-mode and if required load a driver needed by that modem. The latter is written especially for Puppy and puts up status messages on-screen.

In some cases usb-modeswitch does not get triggered, such as when the modem is already plugged in at bootup. In that case, when PupDial is run, it also runs /usr/local/pupdial/pupdial_init_hotpluggable, which detects the correct hotplugged modem and will rerun the kernel uevents if necessary (which will trigger usb-modeswitch).