UsbAdslModem/e-techV2

来自Ubuntu中文
Twthblzhm留言 | 贡献2008年3月2日 (日) 11:50的版本 (取消由Twthblzhm (对话)所作出的修订 76596)
跳到导航跳到搜索

This howto will help you to set up a e-tech V2 ADSL USB modem.

Item 1 - drivers for the USB modem
Step 1: obtain the drivers

A group of people in the sourceforge project is developing drivers for many USB ADSL modems. For my USB DSL modem (e-tech-V2 usb) with the conexant chip I found the following files (http://accessrunner.sourceforge.net/index.shtml):

/drivers/usb/atm/cxacru.c

/drivers/usb/atm/Kbuild

/drivers/usb/atm/Kconfig

/drivers/usb/atm/usbatm.c

/drivers/usb/atm/usbatm.h


Step 2: obtain firmware for the modem

Most USB modems contain a microprocessor (a 'simple' computer), which is programmable and therefore can do many different things, so it is sold a lot and can be cheap. The above driver (cxacru) will try to 'upload' a small program to the modem, allowing the microprocessor to do the 'modem-work'. This small program (called firmware) is often licensed.

The drivers (downloaded in Step 1) do not contain theis firmware (otherwise it would be illegal), but you probably got a CD with the modem, which contains many files, in which the firmware is also contained. If you have the modem working for Windows, the firmware is in the Windows partition. So you already have a legal copy of the firmware, the only problem is finding the firmware. The sourceforge site gives you some intsructions. I have found a programm called cxacru-fw.c (I lost the URL name, but you can trace it with Google). After compiling cxacru-fw.c (the URL gives you clear instructions), cxacru-fw can extract the firmware from a file called CnxEtU.sys on the modem CD, or the Windows partition. Make sure that you name the firmware file cxacru-fw.bin

Place the file cxacru-fw.bin in:

/lib/hotplug/firmware

Note: this is Ubuntu specific - other Linux distributions use other locations.

Note 2: the file cxacru-fw.bin is licensed, do not redistribute it.


Step 3: recompile the linux-kernel

(unfortunately this is difficult without an internet connection)

Step 3a: There is a HOWTO "Kernel Compilation for Newbies" at ubuntuforums.org. You need to do all obligatory steps mentioned there to recompile the kernel. The HOWTO aims at recompilation of the kernel to get a video card working, so a number of optional steps can be skipped.

However, the HOWTO assumes Ubuntu has a working internet connection.


Step 3b: This means that you cannot install all the packages you need to recompile the kernel. The files you need are somewhere in http://archive.ubuntu.com/ubuntu/

One of the packages you need is libncurses5-dev A trick to find the location is as follows: goto http://ftp.se.kde.org/ftpsearch.html Search for libncurses5-dev Now you get a reference to a location in the Debian FTP-archive. The Ubuntu archive has the same structure, so you can find libncurses5-dev in a similar location in the ubuntu archive.


The packages downloaded this way wil have the extension .deb. They can be installed manually through the command:

dpkg -i (package.deb)

To get a feeling for how to use this workaround, read the section 'compile from a vanila kernel' in HOWTO "Kernel Compilation for Newbies"

Step 3c: If you finished step 3 HOWTO "Kernel Compilation for Newbies" (congratulations if you got here), first exit menuconfig.

Look for the place where usb_atm.c is in the source tree. This is provbably /usr/src/linux/drivers/usb/atm/usb_atm.c Here, rename the files usb_atm.c, usb_atm.h, Kbuild and Kconfig (add something like .old). Copy the new drivers to this location:


/drivers/usb/atm/cxacru.c

/drivers/usb/atm/Kbuild

/drivers/usb/atm/Kconfig

/drivers/usb/atm/usbatm.c

/drivers/usb/atm/usbatm.h

I renamed usbatm.c and usbatm.h to usb_atm.c and usb_atm.h, but I am not sure whether this is necessary.

Now, type again

sudo make menuconfig

Now, in the submenu drivers-usb-atm I selected cxacru (the new driver!) and typed m (maybe * will do, I am not sure). Exit menuconfig and compile the kernel.

Step 3d (optional): Everything should go well, but it did not in my case. I got the error-message:

Inconsistent kallsyms data
Try setting CONFIG_KALLSYMS_EXTRA_PASS
make: *** [vmlinux] Fout 1

I don't know how to set CONFIG_KALLSYMS_EXTRA_PASS, so I did a bad thing, namely edit the Makefile. I looked for the place in Makefile that checks the parameter CONFIG_KALLSYMS_EXTRA_PASS, and changed the IF statement such that it acts as if CONFIG_KALLSYMS_EXTRA_PASS is true. This worked. (I hope somebody edits this, and explains how to do this nicely)

Step 3e (optional): Further in the proces I got the error message:

dpkg-gencontrol: error: package kernel-image-2.6.12-accessrunner not in control info
make[1]: *** [real_stamp_image] Fout 255
make[1]: Leaving directory `/usr/src/linux-source-2.6.12-10.25'
make: *** [kernel-image-deb] Fout 2

Here also I did a probably bad thing: I added something like this to debian/control

Package: kernel-image-2.6.12-accessrunner
Architecture: all
Section: devel
Priority: optional
Depends: 
Provides: ${kt-provides}
Description: Linux kernel image

I had to do this for two packages. (I hope somebody edits this, and explains how to do this nicely)

Step 3f: Eventually you have new kernel packages. If you couldn't do it, send me a line at [email protected], and I will e-mail the two package files (25 MB)

Step 4: Install the kernel-packages (see the HOWTO "Kernel Compilation for Newbies"). If you restart the computer, GRUB will give you the option to start the new kernel. After starting the new kernel and loggin in, check in Applications - System tools - System log. If everything went well you can see that the USB modem is detected and cxacru is activated. You also see messages from CXacru in /var/log/messages:

If everything went well you see


localhost kernel [4294759.585000] cxacru 1-1:1.0: ADSL line: training
localhost kernel [4294764.599000] cxacru 1-1:1.0: ADSL line: channel analysis
localhost kernel [4294769.585000] cxacru 1-1:1.0: ADSL line: up (384 Kib/s down | 128 Kib/s up)

Step 4a (optional): Initially I got errors:

localhost kernel [4300944.253000] cxacru 1-1:1.0: firmware unavailable (hotplug configuration problem?)
localhost kernel [4295543.593000] cxacru 1-1:1.0: poll status: error -5

The 1. problem was I put the firmware in a wrong location. The 2. problem may require newer firmware.

Closing remark: Since USB ADSL modems are relatively cheap and easy to install, they will be used more and more. I hope that in future releases of Ubuntu (I installed version 2.6.10) the number of USB ADSL modems drivers in the 'default' setup will be increased, or at least that it will be easier to install the drivers. Recompiling the kernel without internet-connection is very difficult for a newby. On the other hand, placing the licensed firmware in the suitable location is relatively easy and can be done without complications by the user him- or herself.


Note: the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will.



Item 2 - connect the modem to the ethernet 'talk' of Ubuntu

Dutch users (zonnet/versatel/tele2) should check this URL: http://www.dse.nl/~torch/usb_adsl_modem/

Setting up the bridge

The ethernet 'talk' of Linux needs to be bridged to the modem and its connection to the network. If the modem is connected to the provider by the telephone network (using the ADSL-splitter), it probably uses a communication mode called ATM (Asynchronous Transfer Mode). In my case the drivers (see Item 1 - Step 1) had to be placed in a atm subdirectory. The fact that this subdirectory already exists in Ubuntu is a good sign: the connection to atm modems is already foreseen in Ubuntu.

To start the 'bridge' between the ATM modem and Ubuntu type in a terminal:

sudo modprobe 2684

There are various 'languages' that can be used to communicate through ATM, with names like 'AAL type 5'. Specific AAL5 dialects (encapsulation protocols) exist, such as LLC and VC-MUX.

Remark further that more than one providers work through the same telecom-network, their datastreams are distuinguished by VPI.VCI codes.

The package to moderate the 'bridge' is the br2684ctl package. I couldn't find it in the Ubuntu-archive, but the br2684ctl package from debian works for me (see step 3b in Item 1 about acquiring and installing packages).

My provider:

  • uses LLC encapsualtion
  • VPI.VCI code is 0.0.32

The syntax of the command is the following :

br2684ctl [-c n -e 0|1 -b 0|1 -s buf_size -a [itf].vpi.vci ]+

-a [itf].vpi.vci : ATM PVC number, VPI and VCI. Mandatory
-c n : BR2684 interface number such as nas0,
nas1,... Mandatory
-e 0|1 : Encapsulation method. 0=LLC, 1=VC mux.
default is 0, LLC
-b 0|1 : Running background. 1=background,
0=foreground. Default is 0
-s buf_size : send buffer size. Default is 8192.

In my case the interface is created by: br2684ctl -b -e 0 -c 0 -a 0.0.32

Now an interface called nas0 is created. This interface can be pictured as a software version of an ethernetcard in the PC.

Login

Once the bridge is working, you have to login. Again this is provider specific. I have detected three alternative procedures:

  • DHCP
  • PPPoA
  • PPPoE

For DHCP you typically do not have to give a username and password (I guess the provider recognises you through your telephone number). For both PPP procedures you will have to provide your username and pasword.

DHCP

If you use DHCP to login (this is used when you don't have to provide a password for connecting), use the dhcpclient command (in other linux distribution sthis is dhcpcd):

dhclient nas0

It worked for me, although I always get a few warning-messages at the end)

sit0: unknown hardware address type 776
sit0: unknown hardware address type 776
Listening on LPF/nas0/00:d0:41:10:21:dc
Sending on LPF/nas0/00:d0:41:10:21:dc
Sending on Socket/fallback
DHCPREQUEST on nas0 to 255.255.255.255 port 67
DHCPACK from 82.172.112.1
bound to 82.172.112.235 -- renewal in 3125 seconds.


PPPoE and PPPoA

Since I use DHCP, the following is fully untested. For your convenience, I copied this from another website. I gues it will not work for Ubuntu without modifications.

if PPPoA , download from http://accessrunner.sourceforge.net/debian-scripts/

the peers-pppoa and put it in /etc/ppp/peers, edit that file especially the user and the VPC/VCI peers. Add also your login password in the /etc/ppp/pap-secrets /etc/ppp/chap-secrets in the form login * password *


insmod /lib/modules/2.6.10-5-386/kernel/net/atm/pppoatm.ko
pppd call peers-pppoa

if PPPoE Install apt-get install libatm1

also you ll need to download 2 package from the ubuntu

br2684ctl_20040226-1_i386.deb

atm-tools_2.4.1-16_i386.deb ( I m not sure if that one needed)


then install them with the command dpkg -i xxxxxfilexxxxx.deb


download from http://accessrunner.sourceforge.net/debian-scripts/ the peers-pppoe and put it in /etc/ppp/peers, edit that file especially the user. Add also your login password in the /etc/ppp/pap-secrets /etc/ppp/chap-secrets in the form login * password *


after that modify the /etc/network/interfaces and add :

auto nas0 iface nas0 inet static address 192.0.2.1 netmask 255.255.255.0 broadcast 192.0.2.255 0x0x gateway 192.0.2.254 pre-up br2684ctl -b -c 0 -a 0.0.100 post-down kill $(cat /var/run/$IFACE.pid) (the 0.0.100 is the form itf.vpi.vci you should set vpi/vci accordingly to what you have see your ISP for this infos.)


Restart the network to get the nas0 match the atm interface

insmod /lib/modules/2.6.10-5-386/kernel/net/atm/br2684.ko /etc/init.d/networking restart


And finally connect

pppd call peers-pppoe


I m sorry it s a bit hard and maybe not well organized but it should give you a better

idea of what you need to do.


Automated bridge and login

With the procedures above the login is manually. If it works the procedure can be automated. Presently I have a small executable text-file on my desktop:

#
sudo modprobe br2684
sudo br2684ctl -b -c 0 -a 0.0.32
sudo dhclient nas0
sleep 5d

If the connection is successfull the terminal window can be closed by typing Ctrl-C.

Note: the provider may assume that you logged in at the moment the firmware on the modem has connected to the network. This happens during linux startup. If you have to pay for the time being online, you have to dive in the details of cxacru to be able to logon and logoff at will.

Actually, the commands modprobe ..., br2684ctl .. and dhclient or ppp... can be executed during linux startup. I haven't tried it (yet), but you can check the site:

http://www.dse.nl/~torch/usb_adsl_modem/cxacru_auto.html

(in Dutch)





<a href="等待翻译">等待翻译</a>

<a href="Category:CategoryDocumentation">Category:CategoryDocumentation</a> <a href="Category:CategoryNetworking">Category:CategoryNetworking</a> <a href="Category:CategoryCleanup">Category:CategoryCleanup</a>