Difference between revisions of "DSL SpeedTouch modem"

From ArchWiki
Jump to: navigation, search
m
m (Firmware: /lib -> /usr/lib merger and replace HTML tags)
(41 intermediate revisions by 19 users not shown)
Line 1: Line 1:
[[Category:DSL Modem]]
+
[[Category:Modems]]
<pre>
+
 
ATTENTION:
+
== Introduction ==
Newer udev (060 or so) puts itself as the hotplug program in
+
/proc/sys/kernel/hotplug, but doesn't handle firmware loading requests,
+
thus the automatic firmware loading as described below won't work. Best way
+
to solve this problem is yet unclear.
+
</pre>
+
  
 
This howto shows one way to get a working speedtouch USB modem. It uses the kernel driver, '''not''' the userspace driver. This howto assumes that your ISP uses PPPoA and not PPPoE. For info about PPPoE with these modems see first url below.
 
This howto shows one way to get a working speedtouch USB modem. It uses the kernel driver, '''not''' the userspace driver. This howto assumes that your ISP uses PPPoA and not PPPoE. For info about PPPoE with these modems see first url below.
  
 
Important sites where most info comes from:
 
Important sites where most info comes from:
* [http://www.linux-usb.org/SpeedTouch Link1]
+
* http://www.linux-usb.org/SpeedTouch
* [http://lkml.org/lkml/2004/12/27/63 Link2]
+
* http://lkml.org/lkml/2004/12/27/63
  
 
If the below instructions are not enough to get it working, then read the above sites.
 
If the below instructions are not enough to get it working, then read the above sites.
Line 18: Line 13:
 
The following steps are needed to get the modem working:
 
The following steps are needed to get the modem working:
  
1) Make sure you have a kernel with the proper support (at least the modules ppp''generic, pppoatm, slhc, atm, usb''atm and speedtch). The default Arch kernel should work.
+
== Kernel config and ppp ==
  
2) Install ppp: pacman -S ppp.
+
Make sure you have a kernel with the proper support (at least the modules ppp_generic, pppoatm, slhc, atm, usbatm and speedtch). The default Arch kernel should work.
  
3) Configure pppd's config files. I have:
+
Otherwise make sure that your kernel supports firmware loading:
 +
$ zgrep FW_LOADER /proc/config.gz
  
 +
Install ppp: <code>pacman -S ppp</code>
 +
 +
==The Arch Way==
 +
===netcfg===
 +
 +
Install the package {{AUR|netcfg-pppoa}}.
 +
 +
Alternately, follow the steps below. The files used are the same as those installed by the AUR package.
 +
 +
Create the file {{ic|/usr/lib/network/connections/pppoa}} with the following contents:
 +
<pre>
 +
#!/bin/bash
 +
. /usr/lib/network/network
 +
 +
_quotestring() {
 +
    echo "\"${1/\"/\\\"}\""
 +
}
 +
 +
pppoa_up() {
 +
    if [[ ! -d /proc/net/atm ]]; then
 +
        if ! modprobe -q pppoatm; then
 +
            report_fail "Kernel does not support PPP over ATM."
 +
            return 1
 +
        fi
 +
    fi
 +
 +
    local cfg
 +
    load_profile "$1"
 +
 +
    if [[ ${INTERFACE:0:3} != "ppp" ]]; then
 +
        report_fail "Expected INTERFACE to be pppX."
 +
        return 1   
 +
    fi
 +
 +
    if [[ -z ${PPPOA_VPI} || -z ${PPPOA_VCI} ]]; then
 +
        report_fail "Both PPPOA_VPI and PPPOA_VCI must be set."
 +
        return 1
 +
    fi
 +
 +
    mkdir -p "$STATE_DIR/pppoa.${INTERFACE}.$1/"
 +
    chmod 700 "$STATE_DIR/pppoa.${INTERFACE}.$1/"
 +
    cfg="$STATE_DIR/pppoa.${INTERFACE}.$1/options"
 +
    : > "${cfg}"
 +
    chmod 600 "${cfg}"
 +
 +
    echo "plugin pppoatm.so" >> "${cfg}"
 +
    echo "noauth" >> "${cfg}"
 +
    if checkyesno ${DEFAULTROUTE:-1}; then
 +
        echo "defaultroute" >> "${cfg}"
 +
    else
 +
        echo "nodefaultroute" >> "${cfg}"
 +
    fi
 +
    if checkyesno ${USEPEERDNS:-1}; then
 +
        echo "usepeerdns" >> "${cfg}"
 +
    fi
 +
    echo "linkname $(_quotestring "$1")" >> "${cfg}"
 +
    echo "unit $(_quotestring "${INTERFACE:3}")" >> "${cfg}"
 +
    echo "maxfail 5" >> "${cfg}"
 +
    echo "updetach" >> "${cfg}"
 +
    if [[ ${CONNECTION_MODE} == demand ]]; then
 +
        echo "demand" >> "${cfg}"
 +
        echo "idle ${IDLE_TIMEOUT}" >> "${cfg}"
 +
    else
 +
        echo "persist" >> "${cfg}"
 +
    fi
 +
    echo "user $(_quotestring "${USER}")" >> "${cfg}"
 +
    echo "password $(_quotestring "${PASSWORD}")" >> "${cfg}"
 +
 +
    echo "$(_quotestring "${PPPOA_VPI}.${PPPOA_VCI}")" >> "${cfg}"
 +
 +
    [[ -n ${LCP_ECHO_INTERVAL} ]] && echo "lcp-echo-interval ${LCP_ECHO_INTERVAL}" >> "${cfg}"
 +
    [[ -n ${LCP_ECHO_FAILURE} ]] && echo "lcp-echo-failure ${LCP_ECHO_FAILURE}" >> "${cfg}"
 +
 +
 +
    /usr/bin/ip link set dev "${INTERFACE}" up
 +
    /usr/bin/pppd file "${cfg}"
 +
 +
    if [[ $? -ne 0 ]]; then
 +
        rm "${cfg}"
 +
        rmdir "$STATE_DIR/pppoa.${INTERFACE}.$1/"
 +
        report_fail "Couldn't make pppd connection."
 +
        return 1
 +
    fi
 +
}
 +
 +
pppoa_down() {
 +
    load_profile "$1"
 +
    local cfg
 +
    cfg="$STATE_DIR/pppoa.${INTERFACE}.$1/options"
 +
    PIDFILE="/var/run/ppp-$1.pid"
 +
 +
    if [[ -e $PIDFILE ]]; then
 +
        read PID < "$PIDFILE"
 +
        [[ "$PID" ]] && kill "$PID"
 +
    fi
 +
 +
    rm "${cfg}"
 +
    rmdir "$STATE_DIR/pppoa.${INTERFACE}.$1/"
 +
}
 +
 +
pppoa_$1 "$2"
 +
exit $?
 +
 +
</pre>
 +
 +
Now configure the connection. We'll put it in {{ic|/etc/network.d/adsl}}:
 +
 +
<pre>
 +
CONNECTION='pppoa'
 +
DESCRIPTION='ADSL connection'
 +
INTERFACE='ppp0'
 +
USER='username'
 +
PASSWORD='password'
 +
PPPOA_VPI=8
 +
PPPOA_VCI=48
 +
 +
# This causes pppd to reconnect if the link goes down
 +
LCP_ECHO_INTERVAL=15
 +
LCP_ECHO_FAILURE=10
 +
</pre>
 +
 +
You should now be able to connect by calling {{ic|netcfg adsl}}. For more details, see the [[netcfg|netcfg wiki page]].
 +
 +
==The manual way==
 +
 +
===Configuring pppd===
 
<pre>
 
<pre>
 
###  /etc/ppp/peers/speedtch
 
###  /etc/ppp/peers/speedtch
Line 34: Line 156:
 
noipdefault
 
noipdefault
 
defaultroute
 
defaultroute
user "username@typeofadlsstuff"
+
user "username@ispname"
 
noauth
 
noauth
 
noaccomp
 
noaccomp
Line 46: Line 168:
 
usepeerdns
 
usepeerdns
 
plugin pppoatm.so
 
plugin pppoatm.so
# this one is important, make sure it is correct for your ISP:
+
# Following entry is country/ISP dependent
 
8.48
 
8.48
 
</pre>
 
</pre>
  
You also need to configure /etc/ppp/pap-secrets or chap-secrets, depending on your ISP. If you want to use the DNS servers provided by your ISP then make a symlink /etc/resolv.conf pointing to /etc/ppp/resolv.conf:
+
The last entry depends on your country/ISP and is created from the VPI and VCI setting in the format <code>VPI.VCI</code>. This page has a [http://www.linux-usb.org/SpeedTouch/faq/index.html#q12 VPI / VCI Setting List].
cd etc
+
rm resolv.conf
+
ln -s ppp/resolv.conf resolv.conf
+
  
4) Configure hotplug:
+
You also need to configure /etc/ppp/pap-secrets or chap-secrets, depending on your ISP.  pap-secrets files are of the format:
 
+
Make an executable (chmod +x) file /etc/hotplug/usb/speedtch and put something like the next in it:
+
 
<pre>
 
<pre>
#!/bin/sh
+
# Secrets for authentication using PAP
case $ACTION in
+
# client        server  secret IP addresses
add)
+
"ISP-Username" * ISP-password *
if [[ ! -z "$SEQNUM" -a ! -f /tmp/bla ]]; then
+
sleep 1;
+
/usr/sbin/pppd call speedtch &> /tmp/bla;
+
echo -e "--- $SEQNUM ---\n$DEVPATH" >> /tmp/bla;
+
fi
+
;;
+
*)
+
echo -n "speedtch unknown action: $ACTION" >> /tmp/unknown-action;
+
esac
+
 
</pre>
 
</pre>
 +
See [http://www.tldp.org/HOWTO/PPP-HOWTO/x1005.html The PAP/CHAP secrets file] for more details.
  
 +
If you want to use the DNS servers provided by your ISP (you probably do!) then make a symlink /etc/resolv.conf pointing to /etc/ppp/resolv.conf:
 +
cd etc
 +
rm resolv.conf
 +
ln -s ppp/resolv.conf resolv.conf
  
5) Now you have everything except the firmware loading. Easiest is if you let hotplug do it. The above script assumes that. If you want to do it manually then you'll need to do it in the above speedtch script with the appropriate sleeps to give the modem enough time.
+
===Configure udev===
  
If you have a zip like e.g. rev4fw.zip, then unzip it. It probably contains two files, a small one and a big one. Copy the small file to:
+
Make a file {{ic|/etc/udev/rules.d/99-speedtouch.rules}} and put something like the following in it:
 +
ACTION=="add", SUBSYSTEM=="atm", KERNEL=="speedtch*", RUN="/usr/bin/pppd call speedtch"
  
<code>/lib/firmware/speedtch-1.bin</code>
+
With this Udev will start pppd automatically, if you do not want this you can simply bring up your modem using
 +
pppd call speedtch
  
and the big one to:
+
==Firmware==
 +
Now you have everything except the firmware loading. The easiest way is to let udev do it.  Download [http://steve-parker.org/speedtouchconf/rev4fw.zip rev4fw.zip] (note disclaimer [http://speedtouchconf.sourceforge.net/ here]) and  unzip it. It contains two files, a small one and a big one. Copy the small file to {{ic|/usr/lib/firmware/speedtch-1.bin}} and the big one to {{ic|/usr/lib/firmware/speedtch-2.bin}}
  
<code>/lib/firmware/speedtch-2.bin</code>
+
# mkdir -p /usr/lib/firmware
 +
# cp small_file /usr/lib/firmware/speedtch-1.bin
 +
# cp large_file /usr/lib/firmware/speedtch-2.bin
  
The first one should be about 990 bytes, and the second one about 660Kb. If you don't get those two files, but only one, then follow the instructions of the second link above and use the firmware extractor (or download another firmware which has the two files). The lib/firmware/ most likely doesn't exist yet, just make it.
+
If you cannot download this file then follow the instructions of the second link above and use the firmware extractor (or download another firmware which has the two files).
  
Make sure that the kernel supports firmware loading:
+
==Troubleshooting==
$ zcat /proc/config.gz || grep FW_LOADER
+
  
should tell that. The default Arch kernel is ok.
+
If the modem is being detected correctly and the firmware is loading, you should see something like the following in dmesg:
 
+
Now reboot and pray that it works. In dmesg you'll get something like the following if everything goes alright:
+
  
 
<pre>
 
<pre>
Line 105: Line 220:
 
</pre>
 
</pre>
  
And the content of the /tmp/bla file should be something like:
+
pppd output in /var/log/messages should look something like:
  
 
<pre>
 
<pre>
Line 119: Line 234:
 
primary  DNS address 195.121.1.34
 
primary  DNS address 195.121.1.34
 
secondary DNS address 195.121.1.66
 
secondary DNS address 195.121.1.66
--- 363 ---
 
/devices/pci0000:00/0000:00:02.1/usb2/2-1/2-1:1.2
 
 
</pre>
 
</pre>
 +
 +
If you are having problems you can check pppd debug messages by adding '''debug''' to /etc/ppp/peers/speedtch.  This can help identify authentication problems (e.g. pap vs chap auth), etc.  Otherwise make sure you check your VPI/VCI settings!
  
 
----
 
----
For the origin of this doc, feedback or requests go to the [http://bbs.archlinux.org/viewtopic.php?p=80638 Forum discussion]
+
For the origin of this doc, feedback or requests go to the [https://bbs.archlinux.org/viewtopic.php?p=80638 Forum discussion]

Revision as of 21:32, 23 June 2013


Introduction

This howto shows one way to get a working speedtouch USB modem. It uses the kernel driver, not the userspace driver. This howto assumes that your ISP uses PPPoA and not PPPoE. For info about PPPoE with these modems see first url below.

Important sites where most info comes from:

If the below instructions are not enough to get it working, then read the above sites.

The following steps are needed to get the modem working:

Kernel config and ppp

Make sure you have a kernel with the proper support (at least the modules ppp_generic, pppoatm, slhc, atm, usbatm and speedtch). The default Arch kernel should work.

Otherwise make sure that your kernel supports firmware loading:

$ zgrep FW_LOADER /proc/config.gz 

Install ppp: pacman -S ppp

The Arch Way

netcfg

Install the package netcfg-pppoaAUR.

Alternately, follow the steps below. The files used are the same as those installed by the AUR package.

Create the file /usr/lib/network/connections/pppoa with the following contents:

#!/bin/bash
. /usr/lib/network/network

_quotestring() {
    echo "\"${1/\"/\\\"}\""
}

pppoa_up() {
    if [[ ! -d /proc/net/atm ]]; then
        if ! modprobe -q pppoatm; then
            report_fail "Kernel does not support PPP over ATM."
            return 1
        fi
    fi

    local cfg
    load_profile "$1"

    if [[ ${INTERFACE:0:3} != "ppp" ]]; then
        report_fail "Expected INTERFACE to be pppX."
        return 1    
    fi

    if [[ -z ${PPPOA_VPI} || -z ${PPPOA_VCI} ]]; then
        report_fail "Both PPPOA_VPI and PPPOA_VCI must be set."
        return 1
    fi

    mkdir -p "$STATE_DIR/pppoa.${INTERFACE}.$1/"
    chmod 700 "$STATE_DIR/pppoa.${INTERFACE}.$1/"
    cfg="$STATE_DIR/pppoa.${INTERFACE}.$1/options"
    : > "${cfg}"
    chmod 600 "${cfg}"

    echo "plugin pppoatm.so" >> "${cfg}"
    echo "noauth" >> "${cfg}"
    if checkyesno ${DEFAULTROUTE:-1}; then
        echo "defaultroute" >> "${cfg}"
    else
        echo "nodefaultroute" >> "${cfg}"
    fi
    if checkyesno ${USEPEERDNS:-1}; then
        echo "usepeerdns" >> "${cfg}"
    fi
    echo "linkname $(_quotestring "$1")" >> "${cfg}"
    echo "unit $(_quotestring "${INTERFACE:3}")" >> "${cfg}"
    echo "maxfail 5" >> "${cfg}"
    echo "updetach" >> "${cfg}"
    if [[ ${CONNECTION_MODE} == demand ]]; then
        echo "demand" >> "${cfg}"
        echo "idle ${IDLE_TIMEOUT}" >> "${cfg}"
    else
        echo "persist" >> "${cfg}"
    fi
    echo "user $(_quotestring "${USER}")" >> "${cfg}"
    echo "password $(_quotestring "${PASSWORD}")" >> "${cfg}"

    echo "$(_quotestring "${PPPOA_VPI}.${PPPOA_VCI}")" >> "${cfg}"

    [[ -n ${LCP_ECHO_INTERVAL} ]] && echo "lcp-echo-interval ${LCP_ECHO_INTERVAL}" >> "${cfg}"
    [[ -n ${LCP_ECHO_FAILURE} ]] && echo "lcp-echo-failure ${LCP_ECHO_FAILURE}" >> "${cfg}"


    /usr/bin/ip link set dev "${INTERFACE}" up
    /usr/bin/pppd file "${cfg}"

    if [[ $? -ne 0 ]]; then
        rm "${cfg}"
        rmdir "$STATE_DIR/pppoa.${INTERFACE}.$1/"
        report_fail "Couldn't make pppd connection."
        return 1
    fi
}

pppoa_down() {
    load_profile "$1"
    local cfg
    cfg="$STATE_DIR/pppoa.${INTERFACE}.$1/options"
    PIDFILE="/var/run/ppp-$1.pid"

    if [[ -e $PIDFILE ]]; then
        read PID < "$PIDFILE"
        [[ "$PID" ]] && kill "$PID"
    fi

    rm "${cfg}"
    rmdir "$STATE_DIR/pppoa.${INTERFACE}.$1/"
}

pppoa_$1 "$2"
exit $?

Now configure the connection. We'll put it in /etc/network.d/adsl:

CONNECTION='pppoa'
DESCRIPTION='ADSL connection'
INTERFACE='ppp0'
USER='username'
PASSWORD='password'
PPPOA_VPI=8
PPPOA_VCI=48

# This causes pppd to reconnect if the link goes down
LCP_ECHO_INTERVAL=15
LCP_ECHO_FAILURE=10

You should now be able to connect by calling netcfg adsl. For more details, see the netcfg wiki page.

The manual way

Configuring pppd

###  /etc/ppp/peers/speedtch

# To connect to using this configuration file, do
#       pppd call speedtch

lcp-echo-interval 10
lcp-echo-failure 10
noipdefault
defaultroute
user "username@ispname"
noauth
noaccomp
nopcomp
noccp
novj
holdoff 4
persist
maxfail 25
updetach
usepeerdns
plugin pppoatm.so
# Following entry is country/ISP dependent
8.48

The last entry depends on your country/ISP and is created from the VPI and VCI setting in the format VPI.VCI. This page has a VPI / VCI Setting List.

You also need to configure /etc/ppp/pap-secrets or chap-secrets, depending on your ISP. pap-secrets files are of the format:

# Secrets for authentication using PAP
# client        server  secret		IP addresses
"ISP-Username"	*	ISP-password	*

See The PAP/CHAP secrets file for more details.

If you want to use the DNS servers provided by your ISP (you probably do!) then make a symlink /etc/resolv.conf pointing to /etc/ppp/resolv.conf:

cd etc
rm resolv.conf
ln -s ppp/resolv.conf resolv.conf

Configure udev

Make a file /etc/udev/rules.d/99-speedtouch.rules and put something like the following in it:

ACTION=="add", SUBSYSTEM=="atm", KERNEL=="speedtch*", RUN="/usr/bin/pppd call speedtch"

With this Udev will start pppd automatically, if you do not want this you can simply bring up your modem using

pppd call speedtch

Firmware

Now you have everything except the firmware loading. The easiest way is to let udev do it. Download rev4fw.zip (note disclaimer here) and unzip it. It contains two files, a small one and a big one. Copy the small file to /usr/lib/firmware/speedtch-1.bin and the big one to /usr/lib/firmware/speedtch-2.bin

# mkdir -p /usr/lib/firmware
# cp small_file /usr/lib/firmware/speedtch-1.bin
# cp large_file /usr/lib/firmware/speedtch-2.bin

If you cannot download this file then follow the instructions of the second link above and use the firmware extractor (or download another firmware which has the two files).

Troubleshooting

If the modem is being detected correctly and the firmware is loading, you should see something like the following in dmesg:

usbcore: registered new driver speedtch
usb 1-1: found stage 1 firmware speedtch-1.bin
CSLIP: code copyright 1989 Regents of the University of California
PPP generic driver version 2.4.2
usb 1-1: found stage 2 firmware speedtch-2.bin
ip_tables: (C) 2000-2002 Netfilter core team
ADSL line is synchronising
DSL line goes up
ADSL line is up (800 Kib/s down || 256 Kib/s up)

pppd output in /var/log/messages should look something like:

Plugin pppoatm.so loaded.
PPPoATM plugin_init
PPPoATM setdevname - remove unwanted options
PPPoATM setdevname_pppoatm - SUCCESS:8.48
Using interface ppp0
Connect: ppp0 <--> 8.48
PAP authentication succeeded
local  IP address 123.45.67.89
remote IP address 195.190.249.10
primary   DNS address 195.121.1.34
secondary DNS address 195.121.1.66

If you are having problems you can check pppd debug messages by adding debug to /etc/ppp/peers/speedtch. This can help identify authentication problems (e.g. pap vs chap auth), etc. Otherwise make sure you check your VPI/VCI settings!


For the origin of this doc, feedback or requests go to the Forum discussion