Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2040138
  • 博文数量: 220
  • 博客积分: 8531
  • 博客等级: 中将
  • 技术积分: 4976
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-18 13:33
文章分类

全部博文(220)

文章存档

2017年(1)

2015年(1)

2014年(5)

2013年(6)

2012年(6)

2011年(30)

2010年(37)

2009年(53)

2008年(41)

2007年(40)

分类: LINUX

2010-03-23 11:04:59

    上周末买了一块华为移动3g上网卡,在window和ubuntu910上分别驱动起来。
    在window上比较简单,插上上网卡,直接模拟出一个光盘,自动运行安装程序。安装完毕双击”3ge行“自动链接即可上网。
    在ubuntu上稍微费了点周折,主要是这几天在邮政测试,无法上网,只能在window上找到方法、下载相应的包在ubuntu上安装。
    参考linux-ren和网上其他资料,基本两个步骤:1、安装usb模式转换程序usb_modeswitch;2、安装拨号程序wvdial。
    首先从下载最新版本usb-modeswitch-1.1.1.tar.bz2,编译安装。安装过程并没有网上说的低版本那样顺利,首先安装时提示找不到/etc/usb_modeswitch.setup。这我倒不能说新版本Makefile有问题,也有可能是和ubuntu910不太兼容,不过我可以人工解决。解决方法就是将解压后目录里面的usb_modeswitch.setup拷贝到/etc目录,再次安装,成功。

root@fan3838:~# lsusb
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 008: ID 12d1:1d09 Huawei Technologies Co., Ltd.
Bus 006 Device 005: ID 04d9:0499 Holtek Semiconductor, Inc.
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


    系统中lsusb已经看到华为et128的卡信息了,ID也和网上说的12d1:1d09一样,按照网上说法修改/etc/usb_modeswitch.conf,添加相应部分,然后执行usb_modeswitch -W提示没有找到设备。我自己一看这个命令执行的过程才发现,根本不是从/etc/usb_modeswitch.conf中读取的配置信息,而是从/etc/usb_modeswitch.setup读取的:

root@fan3838:etc# usb_modeswitch -W
Reading config file: /etc/usb_modeswitch.setup

 * usb-modeswitch: handle USB devices with multiple modes
 * Version 1.1.1 (C) Josua Dietze 2010
 * Based on libusb0 (0.1.12 and above)

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor= 0x0000
DefaultProduct= 0x0000


    既然如此,删除/etc/usb_modeswitch.setup发现usb_modeswitch -W无法执行了,看来必须有usb_modeswitch.setup才行。那么修改usb_modeswitch.setup,在其中找到Huawei的部分,修改相应部分(网上有说明)。
    然后执行usb_modeswitch -W,一切正常。已经成功创建ttyACM0/ttyACM1/ttyACM2设备。
    从网上下载wvdial,本来下载源码想编辑呢,结果还需要其他依赖,只好去下载安装包。下载完毕,在ubuntu上安装还需要三个依赖,又回到window下载之后安装,安装一切正常。
    执行wvdialconf扫描硬件并生成配置文件,然后编辑/etc/wvdial.conf,在最后添加拨号配置信息:

Phone = *99***1#
Password = any
Username = any
Stupid Mode = 1


    执行wvdial拨号,成功上网。顺便写了一个脚本:

root@fan3838:~# cat /bin/cl
#!/bin/sh -x
ps -ef|grep wvdial |grep -v grep
if [ $? = 0 ]
then
echo "please kill the process of wvdial"
exit 2
fi



ls /dev/ttyACM0
if [ $? != 0 ]
then
/usr/sbin/usb_modeswitch -W
/bin/rm -f /etc/usb_modeswitch.setup
/bin/cp -f /etc/usb_modeswitch.conf /etc/usb_modeswitch.setup
/usr/sbin/usb_modeswitch -W
sleep 5
/usr/bin/wvdial
else
/usr/bin/wvdial
fi
root@fan3838:~#



root@fan3838:/etc# cat /etc/usb_modeswitch.conf
# Configuration for the usb-modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# This file is evaluated by the wrapper script "usb_modeswitch" in /lib/udev
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"


# Disable automatic mode switching globally (e.g. to access the original
# install storage)
DefaultVendor= 0x12d1
DefaultProduct= 0x1da1

#TargetVendor= 0x12d1   注释掉
#TargetProduct= 0x1da1

HuaweiMode=1
DetachStorageOnly=0

DisableSwitching=0


# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_"

EnableLogging=0



阅读(3732) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-01-03 01:30:49

你好 最后的脚本是做什么的?

chinaunix网友2010-06-08 17:04:36

我装的是ubuntu10.04LTS版,用的是ET128卡,看了N天试了M次,还是搞不定。希望博主能给个傻瓜版的指南,先谢谢您了。