Yellow Dog Solutions

TOPIC: How to use a `winmodem' on Apple hardware



1. INTRODUCTION
Modems have plagued Linux users for many years, but even this is an understatement when talking about software modems (aka winmodems, aka softmodems). Usually, they are all made by grumpy (i.e., non-cooperating with the open source community) companies, and unsupported, and often they simply do not work, period.

Of course, most (probably all) recent Apple notebooks come equipped with precisely this kind of modems, as they (the winmodems) draw little power and the electronics are small (most of the job is done in software). I believe that Apple desktops are also beginning to use such kind of modems.

Normally I do not use my tibook's modem (soft, of course) that often, but every now and then, e.g., when I am traveling, I would like the thing to be operational. And guess what, I recently discovered a binary package that made my Tibook modem work!

As far as I am concerned, this package is also able to drive winmodems on iBooks, with the reservation that I have not tried it and I have no means (i.e., no iBook) to do so (but I see no reason why it should not work either). I have read on some of the YDL lists about softmodems possibly being installed on iLamps as well. Chances are, these instructions will make them work too. Indeed, I quote the maintainers of the driver:
"[...] the hcfusbmodem driver [...] supports the Cadmus2 chipset internally used by Apple in later generation PowerPC desktop and notebook machines."
But then again I have no means to test it (feedback is most welcome, to bruda-at-ubishops-dot-ca).

Besides explaining how to install the package, this document also describes how to configure the dial up software, since I did encounter some particularities here as well. The document is in principle self-contained, i.e., you should be able to have your winmodem up and running by just following the instructions below. They are organized as follows: Section 2 presents the prerequisites; downloading and installing instructions are the subject of Sections 3 and 4, respectively. Section 5 deals with configuring wvdial for dialup, and Section 6 summarizes the things that are different from the configuration of normal modems. Non-beginners, you may want to skip Section 5 altogether. Section 7 wraps up the thing.

The package you need contains a binary-only driver. I am not a big fan of binary-only products, but hey, it works and it's better than nothing, eh?


2. BEFORE YOU BEGIN
Make sure you have USB and USB-serial support compiled in your kernel. To my knowledge, the YDL 2.3 compiled kernel does have such support, so unless you compiled your own kernel you should be fine. As well, the README of the package I shall refer to mentions the following:
"Apple Power Macintosh (PPC) systems need a special kernel extension so that the driver can enable the internal USB modem with pmac_call_feature(PMAC_FTR_MODEM_ENABLE, NULL, 0, 1). Applying the pmac_feature.patch might be necessary. We recommend using Benjamin Herrenschmidt's pmac kernel tree which already has the fix. (see "http://www.penguinppc.org/dev/kernel.shtml)." I did not encounter this problem since I am using a Benjamin Herrenschmidt's (benh) kernel already. The stock YDL kernels may work alright; however, I do recommend benh kernels which I used for some time and I am very happy with.

Of course you also need ppp support compiled in the kernel, but this is the case with all the standard kernels I have been working with. However, if you are like me and compiled your kernel without such, then now is the time for a recompilation (I compiled ppp support as modules, as I do not plan to use the modem except while traveling). Oh yeah, if you don't understand a thing from this paragraph then you are probably fine. [:-)]


3. SOFTWARE DOWNLOAD
A joint project of Mark Boucher, Conexant, and other people provides binary-only drivers for the Conexant family of modems. I have no idea whether the Tibook modem falls into this category (their detection program appears to work on x86 machines only, and Apple does not seem to publish such intimate details), but their drivers do work nonetheless, yay. The first step is to download these drivers. To do this, go to
http://www.mbsi.ca/cnxtlindrv/index.html
Then click on the link "Download" under the "HCF (controllerless) driver" heading (make sure you follow the link under the appropriate heading!). Agree to the license and you will face a page with many downloads, but only one for PPC machines. Scroll down until you see it. At the time of writing, this tarball is called "hcfusbmodem-0.98mbsibeta02090200ppc.tar.gz."


4. INSTALLING THE SOFTWARE
Unpack the tarball using, e.g., the following command:
zcat hcfusbmodem-0.98mbsibeta02090200ppc.tar.gz | tar xvf - [ENTER]
(replace the name of the file with the name of the thing you actually downloaded). Then change to the newly created directory (hcfusbmodem-0.98mbsibeta02090200ppc in my case) and read the INSTALL file. You should follow method C. In a nutshell, you should do the following:

As root, issue the command
make install [ENTER]
You may be asked whether it is OK with you to rebuild some kernel modules. Say yes. Also make sure to answer yes (or just press ENTER) when you see the message:Mbr

Should we attempt to automatically configure your hardware? [yes]

In case you don't see the message, after make install finishes issue the command (again, as root)
hcfpciconfig [ENTER]
... and answer yes when you see the above message. For some reasons, I had to run the said program twice: It ran automatically during the "make install" phase and reported no errors, but something was not in order and the whole thing refused to work until I called "hcfpciconfig" explicitly a second time.

If something goes wrong, go and read the INSTALL file carefully (I only summarized the whole procedure above). If you don't have a benh kernel already, I also suggest downloading and installing one (see Section 2 for downloading URL).


5. CONFIGURING THE DIALUP SOFTWARE (WVDIAL SPECIFIC)
There have been a couple of problems on my system. For one thing, no matter what I do, the modem is completely silent, including the connection phase. This is a bit unusual for me, but I can live with it (and you will have to too, unless you figure out how to make it work [:-)] ).

The real problem is that the modem does not appear to detect the dial tone. I could not make this work either, so I instructed it instead to ignore the tone altogether. This is accomplished by passing to the modem the init string ATX3.

The dialup tool that I used (or tried to) are kppp and wvdial. I could not figure out how to pass extra init strings to the modem under kppp, so wvdial is the only tool that I used successfully. I will therefore describe how to configure this one.

First thing first: you should have wvdial on your system. It is normally installed, but to make sure issue the command
which wvdial [ENTER]
You should see something like
/usr/bin/wvdial [ENTER]
If you don't, then install the corresponding RPM from the YDL CD-ROMs (I believe it is on the install CD), or use appt-get, or use whatever other system of installing things you are confortable with.

Then, as root, type
wvdialconf /etc/wvdial.conf [ENTER]
This will create a basic file /etc/wvdial.conf. Edit this file and first and foremost insert the new ATX3 init string. Wvdialconf already should have inserted a couple of such strings, you need to add a third. On my system, wvdialconf's opinion about proper ways of initializing the modem was:
    [Dialer Defaults]
    Modem = /dev/ttySHCFUSB0
    Baud = 115200
    Init1 = ATZ 
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
    
I inserted a new line obtaining:
    [Dialer Defaults]
    Modem = /dev/ttySHCFUSB0
    Baud = 115200
    Init1 = ATZ 
    Init2 = ATX3
    Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
    
(the order of Init2 and Init3 is irrelevant, I am still triyng to figure out why I inserted my new string as Init2 and not Init3 [:-)] ).

Then you have to insert the lines that specify the coordinates of your account (login name, password, phone number). Here is my final /etc/wvdial.conf:
    [Dialer Defaults]
    Modem = /dev/ttySHCFUSB0
    Baud = 115200
    Init1 = ATZ 
    Init2 = ATX3
    Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0
    Username = (login)
    Password = (password)
    Phone = 5627512
    Auto Reconnect = off
    
(of course, erase and and insert your login name and password for the ISP you want to connect to; change the phone number too unless you want to connect to Primus Canada from the Sherbrooke area). The last line says that if a connection drops it should not be reestablished, feel free to omit it if you want wvdial to redial automatically upon dropped connections. Take a look at
man wvdial [ENTER]
for more options and details, including ho to set up alternate phone numbers. Also see the YDL's "How to setup your modem" howto ( modem dialup). Finally, make sure that the file permissions are in order. First, /etc/wvdial.conf contains passwords, so it should be accessible to root only. These two commands will make sure this is the case:
chown root:root /etc/wvdial.conf [ENTER]
chmod go-rw /etc/wvdial.conf [ENTER]
Unless you want to connect only as root, the binary wvdial should have the suid bit set (it doesn't by default). Here is a command that accomplishes this:
chmod u+s `which wvdial` [ENTER]
(caution: both quotes are actually backquotes!). Finally (and again unless you want to connect as root only), make sure that the file /etc/ppp/peers/wvdial is world readable by issuing the command
chmod go+r /etc/ppp/peers/wvdial [ENTER]
It is dangerous to have /etc/ppp/peers/wvdial world writable, so it is a good idea to also issue the following command:
chmod go-w /etc/ppp/peers/wvdial [ENTER]
Yay, it is not time to connect. Make sure your modem is plugged into the phone jack on the wall and type
wvdial [ENTER]
You will see lines going by, and you will hear no sound from the modem (though it works!). A short time after you see a line saying something about "starting pppd" you are connected. You can also monitor the file /var/log/messages by issuing (as root, in another terminal) the command
tail -f /var/log/messages [ENTER]
and wait till you see the local/remote IP addresses appearing. You are now connected, fire up your browser or mailer and enjoy.

To close the connection, go to the terminal wvdial is running in, and type Control-C to stop it, or issue the command
killall wvdial [ENTER]
(for those of you who use big hammers, i.e., SIGKILL, do _not_ kill it with -KILL/-9, just use the above command as is; wvdial needs to receive a SIGQUIT signal in order to disconnect cleanly, otherwise there will be some lock files remaining which may prevent you from connecting again).


6. ON DIALUP SOFTWARE IN GENERAL
For those of you fancying some other dialer, I cannot help you, as I have not tried those. However, assuming you are comfortable enough with setting up a modem using your favourite piece of software, things should be quite easy: just configure the software as for any other modem, and in addition keep in mind the following:

(a) The modem will be viewed as a USB modem, with a specific driver. Thus, the modem device is not /dev/ttyS0 or /dev/ttyS1 as usual, but instead something like /dev/ttySHCFUSB0. However, an uneventful installation also symlinks /dev/modem to this, so you can use this instead, no problem.

(b) You should also ask the modem to ignore the dial tone. To do this, besides the normal init string, also pass to the modem the init string ATX3.

Everything else is configured exactly in the same way as for a normal modem.

The maintainers of the driver report possible problems with kppp (how right they are...), recommend wvdial, and report good results with rp3 and kwvdial which I have not tried.


7. DON'T PANIC!
So it worked like a charm, but you rebooted the machine and the modem no longer responds, what happened?

Well, sometimes (especially the first time after a reboot), the modem might time out (i.e., not answer within a given time period) when you try to dial up and then you will get a "modem not responding" message or something similar. Don't panic, it's normal (however annoying). The thing is, a number of kernel modules (pieces of code that load on demand and do useful things like driving your modem) might need to be loaded in order to make the modem operational. Loading these does take some time, and this time might just exceed what your dialer thinks it's a reasonable time to wait for an answer. The dialer then gives up.

So, if you see this, just try again to dial up; the modules have now been loaded, so everything should work fine. If you know how to do it, you might also want to increase the default timeout for your dialup software, which might make this problem disappear.

This HOWTO was written by Stefan Bruda



 
          Copyright ® 1999-2010. Fixstars Corporation. All rights reserved.
YDL.net Fixstars Corporation