Difference between revisions of "Huawei E173s"

From ArchWiki
Jump to: navigation, search
(Running sakis3g at system startup: rm ck-launch-session, this is covered in xinitrc)
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This page describes how to set up Huawei E173s 3G USB modem on Arch Linux.
+
[[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.
== Check modem ==
+
== Activating the SIM ==
Plug in the modem and install usbutils (base):
+
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).
  pacman -Sy usbutils
+
== Checking modem ==
Run lsusb:
+
Install usbutils (base) if not installed:
 +
  pacman -S usbutils
 +
Plug in the modem and run lsusb:
 
  lsusb | grep Huawei
 
  lsusb | grep Huawei
 
The output should be something like this:
 
The output should be something like this:
Line 10: Line 12:
 
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).
 
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 ==
 
== Set up usb_modeswitch ==
Install usb_modeswitch (community):
+
Install usb_modeswitch (community) if not installed:
  pacman -Sy usb_modeswitch
+
  pacman -S usb_modeswitch
Create a configuration file for your modem:
+
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:
nano /etc/usb_modeswitch.d/12d1:1c0b
+
  usb_modeswitch -c /usr/share/usb_modeswitch/12d1\:1c0b -v 12d1 -p 1c0b
Paste the following:
+
 
DefaultVendor=0x12d1
+
DefaultProduct=0x1c0b
+
TargetVendor=0x12d1
+
TargetProduct=0x1c05
+
CheckSuccess=20
+
MessageEndpoint=0x0f
+
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
+
Save it (Ctrl+X).
+
At this point you can either remove your modem and re-insert it for it to be switched to modem mode automatically or use the following line to do it manually:
+
  usb_modeswitch -c /etc/usb_modeswitch.d/12d1:1c0b
+
 
== Check if the modem is switched ==
 
== Check if the modem is switched ==
 
  lsusb | grep Huawei
 
  lsusb | grep Huawei
Line 32: Line 24:
 
== Connecting ==
 
== Connecting ==
 
The easiest way to connect is with sakis3g.
 
The easiest way to connect is with sakis3g.
Install ppp (base) if not installed:
+
Install ppp (base) and net-tools (core) if not installed:
  pacman -Sy ppp
+
  pacman -S ppp net-tools
Download and install sakis3g from [http://www.sakis3g.org/]:
+
Download and install sakis3g from http://www.sakis3g.org/ (it's also available from [https://aur.archlinux.org/packages.php?ID=59017 AUR]):
 
  wget http://www.sakis3g.org/versions/latest/i386/sakis3g.gz
 
  wget http://www.sakis3g.org/versions/latest/i386/sakis3g.gz
  gunzip sakis3gz
+
  gunzip sakis3g.gz
 
  mv sakis3g /usr/bin
 
  mv sakis3g /usr/bin
 
Run sakis3g:
 
Run sakis3g:
 
  sakis3g --interactive
 
  sakis3g --interactive
You'll have to provide APN, username and password, assuming everything goes right you should be connected by now.
+
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.
== Connect at system startup with sakis3g ==
+
== Connecting at system startup ==
First you need to create a configuration file:
+
=== Creating a configuration file ===
 
  nano /etc/sakis3g.conf
 
  nano /etc/sakis3g.conf
This is how my configuration file looks like, it'll work if you're using T-Mobile in the UK (the first two lines should probably be left as is):
+
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):
  USBDRIVER="option"
+
  OTHER=CUSTOM_TTY
  APN="CUSTOM_APN"
+
CUSTOM_TTY="/dev/ttyUSB0"
 +
  APN=CUSTOM_APN
 
  CUSTOM_APN="general.t-mobile.uk"
 
  CUSTOM_APN="general.t-mobile.uk"
 
  APN_USER="t-mobile"
 
  APN_USER="t-mobile"
 
  APN_PASS="tm"
 
  APN_PASS="tm"
Save it (Ctrl+X) and now you're almost finished. What you need to do is to run sakis3g connect at system startup. For some reason putting it in /etc/rc.local doesn't work so a good option if you're using X but not using a login manager like GDM is to put it in your .xinitrc:
+
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 &
 
  sudo sakis3g connect &
  exec openbox
+
  exec gnome-session
For this you first need to edit /etc/sudoers and add the following line:
+
Although if you are using GNOME, you should add it in gnome-session-properties instead:
  username ALL=(ALL) NOPASSWD:/usr/bin/sakis3g
+
Name: sakis3g
Replace username with your username.
+
Command: sudo sakis3g connect
[[Category:Modems]]
+
For both of these to work you need to add the following line to /etc/sudoers:
 +
  <username> ALL=(ALL) NOPASSWD:/usr/bin/sakis3g
 +
Replace <username> with your username.
 +
 
 +
==External links==
 +
* http://wiki.sakis3g.org/wiki/index.php?title=Mode_switch

Latest revision as of 16:58, 24 October 2012

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 (base) if not installed:

pacman -S 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 (community) if not installed:

pacman -S 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 (base) and net-tools (core) if not installed:

pacman -S ppp 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

nano /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

Replace <username> with your username.

External links