User talk:Ubone

From ArchWiki
Jump to: navigation, search

Talks

If you would like to start a Discussion do so here. ― Ubone (talk) 08:17, 17 August 2018 (UTC)

Drafts

For various pages. ― Ubone (talk) 04:54, 17 August 2018 (UTC)


Merge into Huawei modems:


Category:Modems

Introduction

Marketed by various telecommunications companies in several countries, the E220 is a 3.5G HSDPA USB modem used mainly for wireless Internet access via mobile telephony networks. Technically it is a modem, USB and (due to the CDFS format) CD-ROM device. With a kernel version older than 2.6.20, getting Linux to recognize the device as a modem and accessing its functions requires a workaround.

"Linux kernel versions prior to 2.6.20 have some problems with it, as the SCSI CDROM fakevolume with drivers for Microsoft systems gets automounted by usbstorage.ko module, preventing serial device /dev/ttyUSB0 from working properly."

However, as support for it was added in 2.6.20 via modules usb-storage and usbserial, getting it to work is as simple as plugging it in and dialling up (the above statement is of no concern to us as we can load and unload modules at will, it was probably meant for pre-packaged GNU and Linux distributions). In fact, using the modem under Linux proves to be more reliable as there are no uncalled-for disconnections. This is probably due to the fact that we are communicating directly with the modem, whereas in Windows or Mac OS X drivers are installed on first run (that is what the storage portion is for) and connection is achieved through a thick software layer every time, leaving room for possible interferences and conflicts.

Plugging In

Quick Start

Easy Install using Network Manager

If you are using network-manager then this modem should be plug 'n play. I tested using Huawei E270, but since lsusb said that my modem is E220/E270, I assume it is the same. (Note: You can follow these instructions too if lsusb detects your Huawei E180 as E220.)

The required packages are modemmanager and network-manager-applet from extra. Install them if you haven't.

Start the networkmanager daemon from rc.conf or manually using /etc/rc.d/networkmanager start. Start the nm-applet if it hasn't started yet. Make sure the modem is connected; I used a cable with two usb port like the one for an external harddrive. Then, from nm-applet add a Mobile Broadband config via 'Edit Connections...'. Set the config according your network; usually apn, username, and password.

Activate the connection by choosing it on the Network Manager applet. If it is not showing up, unplug and plug in the modem again to refresh the connection. Now you should see it listed in the Network Manager applet. Click on it and it will try to connect. Once connected, the icon will change. You're good to go then.


For Vodafone brands of this device, you can use vodafone-mccd which is the Vodafone Mobile Connect Card Driver for Linux. The official name is very long, yes.

Bare Naked

You can just try Plug 'n Dial first to see if it works (I will give you free beer if it does!). After hooking up to the USB port (some say an upright position is best; let it hang over the edge of the desk), check to make sure it is detected.

$ cat /proc/bus/usb/devices

You should see Huawei somewhere there. If not, you are on your own. The usb-storage and/or usbserial modules must be loaded, whether manually or by HAL is up to you and/or your system.

# modprobe usb-storage
# modprobe usbserial
$ sleep 6 # the modem may take a while to initialize
$ ls /dev/ttyUSB*

You should see three renditions of ttyUSB. If not, we will get to that later. This is a "Quick Start" after all, no? The ports:

  • ttyUSB0 - Modem
  • ttyUSB1 - USB?
  • ttyUSB2 - Nothing

Now you need a dialler. Most convenient of all would be wvdial, so install it. You should have ppp already, if not just pull them both in by installing the wvdial and ppp packages.

Configure n' Dial

Most SIM and data services provided together with the device do not require special settings and work with similar configuration to get connected. They are almost "Plug n' Play", a special trait of Linux. Edit /etc/wvdial.conf and use something like the following:

[Dialer hsdpa]
Phone = *99***16#
Username = 65
Password = user123
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem

For providers that do require a specific Init string and user/password combination, mkwvconf-gitAUR in AUR can help generate a wvdial configuration (based on the mobile-broadband-provider-info-gitAUR package).

If using PIN code add this before Init2

 Init1 = AT+CPIN=9999

where 9999 is changed for your PIN-code

There is an example here by a "Linux Guru". Then load the PPP module.

# modprobe ppp-generic

You can now connect immediately, but probably only as root, which is not a disadvantage.

# wvdial hsdpa

Slow Start

Edit: This section is nullified if you have UDEV and HAL workarounds, or a script, or a package from AUR.

So why then? Well, for some reason those of us on newer kernels still have to ride the old ways. In some cases, all that is needed to be done is to remove the usb-storage module first, then load usbserial with the device IDs. The first cat command on this page will have that information, while lsusb is an alternative. Anyhow, the IDs are the same for almost all E220s, so you can copy wholesale.

# modprobe -r usb-storage usbserial
# modprobe usbserial vendor=0x12d1 product=0x1003

In other cases, where the option module gets autoloaded for use by usbserial, you just have to blacklist it in rc.conf:

MOD_BLACKLIST=(option) 

When you cannot salvage anything from this either, you have to go Gentoo and compile something. Do not worry, it is only a script and we do things like this almost everyday, albeit in bash.

$ mkdir ~/huawei-e220 && cd ~/huawei-e220
$ wget http://www.kanoistika.sk/bobovsky/archiv/umts/huaweiAktBbo.c
$ gcc -lusb -o e220 *.c
# ./e220

This gets around the kernel to recognize the modem functionalities of the device. You can now carry on and connect using the above methods. If you had to follow this step, you will always need the script unless you set udev rules and such (package link below). So move it to a global PATH.

$ cd ~/huawei-e220
# mv e220 /usr/bin/e220

Now it is easier.

Extras

Note: It seems some people get it to work using ttyUSB1, which should not be the case, but rest assured that at least on recent kernels and systems ttyUSB0 is the correct port to dial with.

Port Testing

To check if the device is functioning alright on a particular serial port, there is a program for probing serial devices. Install the minicom.

Now run it.

# minicom -s

Change the serial port to /dev/ttyUSB1 and exit from the page, this will open the main program. When it initializes the modem, issue the command AT. The answer should be OK, which means the modem is working well on that port.

Troubleshooting

Hal

The hald daemon detects the SCSI CD-ROM drive and because of that it will try to change the modem to storage mode. To prevent this you need to create a Hal policy so it ignores the device.

Create a file the /usr/share/hal/fdi/preprobe/20thirdparty/10-huawei-e220.fdi and putt this in it

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="usb.vendor_id" int="0x12d1"> 
      <match key="usb.product_id" int="0x1003"> 
        <merge key="info.ignore" type="bool">true</merge>
      </match>
    </match>
  </device>
</deviceinfo>

With this, for my experience, only two USB serial ports are created and them vodafone-mccd doesn't recognize correctly the modem but you can connect correctly with wvdial.

Route

If problem with connection through ppp0 one might need to add the network manually:

 # ip route add ip route add 10.0.0.0/8 dev ppp0

if the remote adress starts on 10.

Then you add default route and dns as usually:

# ip route add default via 10.x.x.x

(change to remote adress recieved and viewed with command ip a)

See also

http://wwwu.uni-klu.ac.at/agebhard/HuaweiE220/
http://oozie.fm.interia.pl/pro/huawei-e220/
http://mybroadband.co.za/vb/showthread.php?t=21726
USB 3G Modem


Category:Modems

The HUAWEI EG162G is a EDGE/GPRS modem used for wireless internet access. Linux kernel support this at least from version 2.6.29.4 and thus setting this up is not very hard.

Plug it in

Plug in the device , wait for a few seconds and then run

$ ls /dev/ttyUSB*

you will see something like this:

/dev/ttyUSB1  /dev/ttyUSB2  /dev/ttyUSB3

the first one is the port of the modem.

Installation

Now install ppp and wvdial, which is a dialer.

Configure and dial

Edit your /etc/wvdial.conf and use this if you are using an idea netsetter , else use google to find the right config for your provider

[Dialer Defaults]
Modem=/dev/ttyUSB1
Baud = 460800
Init 1 = AT+CGMM
Init 2 = AT+CMEE=1
Init 3 = ATE0
Init 4 = AT^HS=0,0
Init 5 = AT+CFUN?
Init 6 = AT+CLCK="SC",2
Init 7 = AT+CPIN?
Init 8 = AT+CLCK="SC",2
Modem Type = USB MODEM
Phone=*99#
Username = idea
Password = idea
Dial Command=ATDT
Stupid Mode=1
ISDN=0

Remember that the modem might get a different port each time you plug it in so you might need to change the 'Modem=/dev/ttyUSB1' each time, for example if the output of $ ls /dev/ttyUSB* is /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2, then you need to change the 2nd line in the wvdial config to 'Modem=/dev/ttyUSB0'.

If the output of $ ls /dev/ttyUSB* shows a /dev/ttyUSB_utps_modem, which will be a soft link to your Idea Netsetter's modem, change the 2nd line in the wvdial config to ' Modem=/dev/ttyUSB_utps_modem'. This link will not change every time you reconnect the device.

Now all you need to do is run wvdial as root

# wvdial

If you get an error 16 in wvdial it means that there is no modem present in the port specified by the config, so edit your config file accordingly.

If the connection is successfull you will see something like this:

# wvdial
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sun May 24 02:03:51 2009
--> Pid of pppd: 6361
--> Using interface ppp0
--> pppd: è|[01]¸8A[08]È@Þ[08]
--> pppd: è|[01]޸8A[08]È@Þ[08]
--> pppd: è|[01]޸8AÞ[08]È@Þ[08]
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> local  IP address 112.110.117.241
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> remote IP address 10.64.64.64
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> primary   DNS address 10.11.12.13
--> pppd: è|[01]¸8AÞ[08]È@Þ[08]
--> secondary DNS address 10.11.12.14
--> pppd: è|[01]¸8AÞ[08]È@Þ[08] 
Note: If you get an error 16 in wvdial it means that there is no modem present in the port specified by the config, so edit your config file accordingly.

You still will not be able to surf the net unless you have a nameserver in your /etc/resolv.conf. In this case add this line to it:

nameserver 208.67.222.222

If you are already conected to a LAN then change the subnet mask of the lan to 255.0.0.0 and you should be able to use the lan and the netsetter.


Category:Modems ja:Huawei E1550 3G モデム ru:USB 3G Modem

Introduction

This article describes how to configure Huawei E1550 3G modems.

This modem is generic modem device, but there are two kludges:

  • you need to switch it into modem mode
  • you need to load proper driver (usbserial)

Prepare device

Switch into modem mode

By default kernel recongnizes it as usb-storage device (SCSI CD-ROM). It is true, because of this modem contains MicroSD card (up to 4Gb) reader and internal flash.

To switch modem on you shoud run

$ /lib/udev/usb_modeswitch --vendor 0x12d1 --product 0x1446 --type option-zerocd

command.

See also the usb_modeswitch package, which you may need in future since in udev-157 modem-modeswitch has been renamed and changed as described in the commit. This package does not need any modifications, just install it.

Also you can create udev's config: /etc/udev/rules.d/15-huawei-e1550.rules

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="/lib/udev/usb_modeswitch --vendor 0x12d1 --product 0x1446 --type option-zerocd"

After that, modem changes its USB IDs to 12d1:140c and /proc/bus/usb/devices shows new USB endpoints.

Driver loading

usbserial is proper driver for this modem, but probably it does not recognize it, so you should force it, passing USB IDs.

 # modprobe usbserial vendor=0x12d1 product=0x140c

or put options into /etc/modprobe.d/modprobe.conf

 options usbserial vendor=0x12d1 product=0x140c

(do not forget to 'rmmod usbserial' if it is already loaded before)

Optional: device naming

You can generate symlinks to the ttyUSB* ports for a more human readable configuration with udev rules.

For a Huawei device which identifies with the USB ID 12D1:1001 after modeswitching and has 3 serial ports:

 SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1001*", KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="00", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_modem"
 SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1001*", KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="01", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_diag"
 SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1001*", KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="02", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_pcui"

For a Huawei device which identifies with the USB ID 12D1:1003 after modeswitching and has 2 serial ports:

 SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1003*", KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="00", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_modem"
 SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1003*", KERNEL=="ttyUSB*", ATTRS{bInterfaceNumber}=="01", ATTRS{bInterfaceProtocol}=="ff", SYMLINK+="ttyUSB_utps_pcui"

Connecting internet

Now you have new 2 or 3 /dev/ttyUSB* devices.Most likely first of them (ttyUSB0 if you had not such devices before) is PPP compatible modem. Use it as usual with pppd, kppp, gnome-ppp, network-manager, etc.

Note: If you want to use your 3G modem with NetworkManager, you have to install the package modemmanager and then restart the NetworkManager.service. Now you can 'Enable Mobile Broadband' in the networkmanager applet.

AT commands

There are some useful commands:

  • AT^U2DIAG=0 - the device is only Modem
  • AT^U2DIAG=1 - device is in modem mode + CD ROM
  • AT^U2DIAG=255 - the device in modem mode + CD ROM + Card Reader
  • AT^U2DIAG=256 - the device in modem mode + Card Reader
  • AT+CPIN=<PIN-CODE> - enter PIN-code
  • AT+CUSD=1,<PDU-encoded-USSD-code>,15 - USSD request, result can be found (probably) in /dev/ttyUSB2.

Encode "*100#" to PDU format:

 perl -e '@a=split(//,unpack("b*","*100#")); for ($i=7; $i < $#a; $i+=8) { $a[$i]="" } print uc(unpack("H*", pack("b*", join("", @a))))."\n"'

Decode "AA180C3602" from PDU format:

 perl -e '@a=split(//,unpack("b*", pack("H*","AA180C3602"))); for ($i=6; $i < $#a; $i+=7) {$a[$i].="0" } print pack("b*", join("", @a)).""'

Answer decoding (this example is balance response: 151.25):

 perl -e 'print pack("H*", "003100350031002C003200350020044004430431002E0020");'

Some operators return USSD result in PDU encoding, so you should check proper decoding method.

  • AT+CSQ - get signal quality (AT+CSQ=?)
  • AT+GMI - get manufacturer
  • AT+GMM - get model
  • AT+GMR - get revision
  • AT+GMN - get IMEI
  • AT+COPS? - get operator info
  • AT^CARDLOCK="NCK-code" - unlock modem. NCK-code should be calculated by IMEI. After that modem can work with any GSM-provider.
  • AT^SYSCFG=mode, order, band, roaming, domain - System Config

Mode:

  • 2 Automatic search
  • 13 2G ONLY
  • 14 3G ONLY
  • 16 No change

Order:

  • 0 Automatic search
  • 1 2G first, then 3G
  • 2 3G first, then 2G
  • 3 No change

Band:

  • 80 GSM DCS systems
  • 100 Extended GSM 900
  • 200 Primary GSM 900
  • 200000 GSM PCS
  • 400000 WCDMA IMT 2000
  • 3FFFFFFF Any band
  • 40000000 No change of band

Roaming:

  • 0 Not supported
  • 1 Roaming is supported
  • 2 No change

Domain:

  • 0 CS_ONLY
  • 1 PS_ONLY
  • 2 CS_PS
  • 3 ANY
  • 4 No change

Sending SMS

You can use gammu.

Edit ~/.gammurc

 [gammu]
 port=/dev/ttyUSB0
 connection=at
 name=huawei e1550
 model=

The run command:

 gammu sendsms TEXT +7123456789 -text qwe

USSD Requests

Use huawei-ussdAUR[broken link: archived in aur-mirror] package. Or use ussd.php tool.

Success Stories

2010-August-03: I didn't do anything, I just installed usb_modeswitch-1.1.3-2 and my kernel is 2.6.33. In the syslog (/var/log/messages.log) the usb_modeswitch can automatically configure the modem correctly but I still cannot connect to the internet using gnome network manager applet, then I installed the modemmanager package and restart the networkmanager service. Everything is working properly now.

References


Category:Modems

This page describes how to set up Huawei E173s 3G USB modem on Arch Linux. It involves switching the USB stick from CD-ROM mode to modem mode using usb_modeswitch, making a connection to the network with sakis3g and setting it up to run at system startup.

Activating the SIM

Before using a brand new SIM (or a USB stick with SIM included) for the first time in Linux it may need to be activated first by using the Windows-only software on the stick, otherwise it won't connect no matter how many times you try (was true in my case).

Checking modem

Install usbutils.

Plug in the modem and run lsusb:

$ lsusb | grep Huawei

The output should be something like this:

Bus 003 Device 003: ID 12d1:1c0b Huawei Technologies Co., Ltd.

The ID 12d1:1c0b refers to vendor id and product id. If you get different values, it means your modem is not Huawei E173s (of course, you can always open the USB stick to double check).

Set up usb_modeswitch

Install usb_modeswitch.

At this point, if you remove your modem and re-insert it udev should switch to modem mode automatically but sometimes it just doesn't work (on my system for example) so you have to do it manually as root:

# usb_modeswitch -c /usr/share/usb_modeswitch/12d1\:1c0b -v 12d1 -p 1c0b

Check if the modem is switched

$ lsusb | grep Huawei

The output should be something like this:

Bus 003 Device 003: ID 12d1:1c05 Huawei Technologies Co., Ltd.

Note that the product ID has changed from 1c0b to 1c05. It means that the USB stick can now be used as a modem. Also note that it can take some time (probably not more than 15 seconds) for the modem to switch if you removed and re-inserted it instead of running usb_modeswitch manually.

Connecting

The easiest way to connect is with sakis3g.

Install ppp and net-tools.

Download and install sakis3g from http://www.sakis3g.org/ (it's also available from AUR):

$ wget http://www.sakis3g.org/versions/latest/i386/sakis3g.gz
$ gunzip sakis3g.gz
$ mv sakis3g /usr/bin

Run sakis3g:

$ sakis3g --interactive

You will have to provide your APN, username and password, assuming everything goes right you should be connected by now. Note while sakis3g should detect your modem, sometimes it just doesn't (it's the case on my system). If that's the case you have to specify CUSTOM_TTY, for example /dev/ttyUSB0.

Connecting at system startup

Creating a configuration file

Create /etc/sakis3g.conf.

Add the following lines (CUSTOM_APN, APN_USER and APN_PASS refer to your APN, username and password respectively, you may have to adjust them):

OTHER=CUSTOM_TTY
CUSTOM_TTY="/dev/ttyUSB0"
APN=CUSTOM_APN
CUSTOM_APN="general.t-mobile.uk"
APN_USER="t-mobile"
APN_PASS="tm"

This configuration file works very well on my system but you may have to adjust CUSTOM_TTY as well if you have more than one USB modem. Note that it's also modem-independent - if you start using a different modem you shouldn't have to change anything.

Running sakis3g at system startup

What you need to do is to run sakis3g connect at system startup. The easiest way to do this is to add these lines to /etc/rc.local (it doesn't always work, I don't know why):

sakis3g connect --console
sleep 3

The second line gives you time to examine the output of sakis3g at system startup to see if everything is working as it should, if it is, you can just remove it later. Another option, if you are using X but not using a login manager like GDM, is to put it in your .xinitrc (see the first line):

sudo sakis3g connect &
exec gnome-session

Although if you are using GNOME, you should add it in gnome-session-properties instead:

Name: sakis3g
Command: sudo sakis3g connect

For both of these to work you need to add the following line to /etc/sudoers:

username ALL=(ALL) NOPASSWD:/usr/bin/sakis3g

External links