个人工具

UsbAdslModem/e-techV2

来自Ubuntu中文

Twthblzhm讨论 | 贡献2008年3月2日 (日) 12:12的版本

跳转至: 导航, 搜索

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

第1部分,USB猫驱动
步骤1:获得驱动

在sourceforge 项目中一组人正在为许多USB ADSL猫开发驱动。我的 USB ADSL猫(a-tech-V2 usb)集成conexant芯片,我找到了一些关于它的如下文件(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


步骤2:获取猫固件

大多数猫有一个可编程的微处理器(一台“简单的"的电脑),由于能做很多事,因此该处理器销售旺盛且非常便宜。上述驱动将会上载一个允许微处理器具备调制解调功能小程序到猫。这个小程序(叫做固件)常要求得到许可。


从步骤1下载的驱动不包含这些固件(否则它是非法的),但你可能得到一张包含许多文件的随猫CD,CD中含有该固件。如果你的猫工作在Windows下,固件就会在Windows区。因此你已经有了固件的合法复制品,唯一的问题是找到该固件。sourceforge站点给了你一些提示。我已经找到了一个叫做 cxacru-fw.c(我丢失了URL名,但是你可以通过google搜索到)的程序。在编译cxacru-fw.c(URL给你清晰指示)後,cxacru-fw会从CD上的一个叫做CnxEtU.sys文件中释放固件,或者释放Windows区,务必保证把把固件改名为cxacru- fw.bin,并把cxacru-bin放置在:


/lib/hotplug/firmware

''''注释:这是Ubuntu指定的,其它Linux释放版本用其它位置。

''''注释2:文件cxacru-fw.bin是被许可的,勿重新分配。


步骤3:重新编译linux-kernel

(不幸的是,若没有因特网连接该工作将很难进行)

步骤 3a:在ubuntuforums.org上有一篇关于“新手内核编译“如何操作的文章。在重新编译内核时,你必须完成该文中提到的所有必要步骤。该文章的目的是通过重新编译内核使显卡工作,因此有许多可选步骤可以省略。

然而,该文假设Ubuntu工作在有因特网连接的环境中。


步骤3b:这就意味着你不能安装重新编译内核所需的所有包。你需要的文件一些在http://archive.ubuntu.com/ubuntu/上

其中一个你需要的包是libncurses5-dev,一种找到该文件地址的方法如下:进入 http://ftp.se.kde.org/ftpsearch.html,搜索libncurses5-dev,现在你会在Debian FTP-文档中得到一些该位置的信息。Ubuntu文档和Debian是一样的结构,因此你可以在ubuntu文档的相同位置找到libncurses5 -dev。


通过这种方式下载的包会有一个扩展的.deb。该.deb可以通过下面命令手动安装:

dpkg -i (package.deb)

通过阅读vanila内核“新手内核编译“如何操作的编译部分,你能获得更多怎样利用这种变通方法的知识。

'

步骤3c:如果你完成步骤3“新手内核编译”如何操作(祝贺你已经到了这一步),首先退出配置菜单,查找usb_atm.c在原树中的位置。该位置很有可能在/usr/src/linux/drivers/usb/atm/usb_atm.c,在这里,重命名文件usb_atm.c,usb_atm.h, Kbuild和Kconfig(加了一些如.old的东西),复制新驱动到如下位置:



/drivers/usb/atm/cxacru.c

/drivers/usb/atm/Kbuild

/drivers/usb/atm/Kconfig

/drivers/usb/atm/usbatm.c

/drivers/usb/atm/usbatm.h

我把usbatm.c和usbatm.h重命名成usb_atm.c和usb_atm.h,但不能确认该操作是否有必要。

现在,再次输入:

sudo make menuconfig

现在,在子菜单driers-usb-atm我选择了cxacru(新驱动),而后输入m(可能*也行,我不确定)。退出配置菜单并编译内核。

''''步骤3d(可选):一切应该顺利,但在我的操作中并非如此,我得到一条错误信息:

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

我不知道如何设置CONFIG_KALLSYMS_EXTRA_PASS,因此我做了一件错误的事,按名编辑Makefile,查找 CONFIG_KALLSYMS_EXTRA_PASS在Makefile中的位置,且核对其参数,然后改变IF声明使它在 CONFIG_KALLSYMS_EXTRA_PASS为真时执行。这种方法是有用的(我希望有人编辑过这个,且能解释怎样漂亮地完成编辑)

''''步骤3e(可选):在安装过程中我再一次得到错误信息:

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

在这里,我也可能做了一件错误的事情,加了一些如下的东西到debian/control

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

因为有两个包,我不得不这样做,(我希望有人编辑过这个,且能解释怎样漂亮地完成编辑)

''''步骤3f:最终你会有新的内核包。如果你不能完成上述过程,通过[email protected]给我发信息,我会用email传给你两个包文件(25MB)

''''步骤4:安装内核包(查看“新手内核编译”如何操作一文)
如果你重启系统,GRUB将会给你一个启动新内核的选项。在启动新内核并登录后,核对应用程序,系统工具,系统日志。如果一切运行正常,你将会看到,USB 猫将被检测到,且cxacru已经被激活。你也会看到来在CXacru in /var/log/messages(如果你看到的一切运行正常的)的消息:

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)

'

步骤 4a(可选):起初我得到一些错误提示:

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

第1个问题是我把固件放在一个错误的位置。第2个问题可能需要一个更新的固件。

''''结束语:由于USB ADSL猫相对便宜且容易安装,以后应用会越来越多。我希望在以后的Ubuntu释放版本(我安装的是2.6.10版本)中通过默认设置就能完成USB ADSL猫安装的驱动程序数量能有所增加。或者至少安装驱动要变得容易。对一个新手来说没有因特网连接重新编译内核是很困难的事情。另一方面,放置许可固件到合适的位置要变的相对容易,而且能使用户自己在不复杂的情况下完成整个安装。


注释:在linux启动时,固件提供商可能认为你在登入时安装了固件的猫已经连接到网络。如果你必须支付在线时间,你不得不继续研究cxacru的详细内容,使之能够随意登入和登出。



第2部分-猫连接到Ubuntu的以太网对话中

荷兰用户(zonnet/versatel/tele2) 应该核对这个URL:http://www.dse.nl/~torch/usb_adsl_modem/

设置网桥

linux 的以太网对话需要把猫连接到网桥和网络。如果猫已经被连接到电话网络的服务提供商处(用ADSL分解器),那可能会采用一种叫做ATM(异步传输模式)的通讯方式。在我的情况中,驱动(见第1部分-步骤1)不得不放在一个atm子目录下。事实上在ubuntu中该子目录已经存在,且有一个好的暗示: ubuntu已经预测到atm猫的连接。

为了启动ATM猫和ubuntu之间的桥接,可以在终端输入:

sudo modprobe 2684

在ATM对话中有许多“语言”可以使用,名字是“AAL type5”的,指定了AAL5 拨号(解封装协议)等等的存在,例如:LLC和VC-MUX。

注意在同一个电话网络中有多个服务商起作用时,是通过VPI.VCI码区分各自的数据流。

调制网桥的包是br2684ctl包,在Ubuntu文档中我没有找到该包,但是用debian上的br2684ctl包也能起作用(看第1部分中关于获取和安装包的步骤3b)

我的提供商:

  • 用LLC解封装
  • VPI.VCI 码0.0.32

命令语法如下:

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.

我的界面: br2684ctl -b -e 0 -c 0 -a 0.0.32创建

现在一个叫做nas0的界面建立了,该界面像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>