Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, May 21, 2010

Viettel 3G USB Modem with Fedora

I got myself a Viettel 3G USB stick yesterday for the need of roaming access while I'm off the city. I tried it first with my colleague's Windows machine. The stick worked well with Windows but in ridiculous way. It shown up in a dedicated, silly designed window frame with the ISP heavily branded. That's still acceptable, anyway.

I booted up my laptop which has only Fedora 12 to see how the stick behaves in GNU/Linux. Plugging in the USB in with a really hopeless mind since I know clearly that Linux is not what they are willing to support. And that was clearly documented in the tiny user manual I got when purchasing the stick.

I was right. It did not work. To be honest, it actually worked as a storage device since I found a fake CD-ROM shown up with the name of D-COM.

And that was the interesting clue for me to solve the problem. I googled for the whole day, asked in the forum to have it finally solved in the sweetest way!

To save others' time, here follows a complete guide for Fedora users:

Background

Modems provided Viettel are produced by Huawei and the one I got is the Huawei E1750. Huawei and many other manufactures use a method (which they actually call 'technology') in which the device will behave as a fake CD-ROM when just plugged in. This is to allow the manufacture to ship the installation CD contents right within the device instead of having a real CD-ROM attached.

An autorun application for Windows is included in the fake CD-ROM to start the driver installation process.

After the installation is done the driver is up and to begin the use of the stick as a real modem, a special data sequence is sent by the driver to the device in order to ask it to switch the USB interface into the modem mode. From that on, the USB can be used as a 3G GSM modem. The USB will kept itself switched as long as the power to it is not cut.

This is really clever! A CD-ROM and GSM Modem within just a single USB stick.

Problem with GNU/Linux

The clever part of the device is also the problematic part of it in GNU/Linux. While Huawei GSM modem support is added into the kernel, the activation of the GSM modem mode is however not straightforward.

When the device is plugged in, the OS recognizes it as a storage device only. What we have to find out is how to switch the device into the GMS mode.

Fortunately, a dedicated project was created for just this purpose. The usb_modeswitch program! The latest version of this program is included in the Fedora 12 official repository.

Switching the mode with usb_modeswitch

usb_modeswitch is a helper application that integrates into udev to watch for USB devices. When a device is plugged in, usb_modeswitch lookups the just-plugged-in device vendor and product ID in its internal registry and carries out an appropriate operation in order to switch the device into the GMS modem mode. This perfectly fits our need for the Huawei device. The following steps help you install the switching:

Step 1: Installing usb_modeswitch

usb_modeswitch can be installed easily with yum:

#yum -y install usb_modeswitch

Step 2: Removing wrong udev entries

An important thing that you have to do is to resolve a conflicts in using the device. To do this, find the file at /lib/udev/-modem-modeswitch.rules and comment out the line that mentions the Huawei device (Huawei devices have the vendor:product id of 12d1:1446)

May thanks to Josh for guiding me in this section.

Step 3: Reboot

There may be other ways but this is the most simple one to get udev reloaded.

Configuring the connection

After rebooting and plugging in your device you can now configured the connection using NetworkManager. And this is what I found it is so sweet, the Linux way of configuring network connection. You have a single, united and well designed graphical user interface for all network connections of all types, all kind of devices.

Adding a new connection

Right-click the NetworkManager panel icon, select 'Edit Connections...', select the 'Mobile Broadband' and click 'Add'

The Huawei device should be listed in the device list, select it and click 'Forward'.

Since Vietnam may not be listed in this version of NetworkManager, just select 'My country is not listed' and then 'Forward'

Enter Viettel in the Provider box. This is not a configuration parameter, you can choose another name. However, this will be used in the default connection name so I suggest that you have the ISP name here.

Enter 'e-connect' as the Access Point Name. This is an important configuration parameter. I found it when inspecting the Windows application shipped with the modem. No information for this parameter is officially provided by the ISP.

Click 'Forward'.

Just click 'Apply' in this confirmation screen.

Modify the connection name if you want and click 'Apply'. The configuration is done you can now start using the connection.

Using the connection

Clicking the NetworkManager panel icon you will find that connection is now listed and ready for use:

Select the connection and wait for the modem to get connected, you can now start using the 3G connection!










Friday, July 10, 2009

Have my Fedora 11's cairo and freetype updated

with LCD filter enabled. Font rendering's now sweeeeet!

Some quick comparison:

Before updating, After updating with slight hinting and After updating with medium hinting.

Wednesday, June 10, 2009

Fedora 11

Just upgraded my laptop to Fedora 11. Everything seems OK, except Inkscape and SCIM.

Wednesday, March 04, 2009

xvnkb for Fedora 10 users

I have just dumped scim-unikey in favor of the old xvnkb. This time I did a plain installation using the traditional ./configure; make; sudo make install for xvnkb from the 0.2.9a source package.

It's normal that after installing, my dear Gimp stopped working. xvnkb and Gimp seem not to play well together and the reason may be that some of the system calls which were overrided by xvnkb preload so don't work with Gimp and cause it to crash.

As noted by Tinh in the installation of xvnkb for Arch, the workaround is to disable xvnkb.so overriding in case of launching Gimp.

The method to disable overriding provided by Tinh does not work in the case that xvnkb is installed using make install. This is simply because the installation script actively disabled the preloading method using env variable. Instead, it created its own entry in the /etc/ld.so.preload for loading its so. With this method, temporarily emptying the LD_PRELOAD variable does not prevent the system to preload the xvnkb.so.

The workaround's workaround is to roll back into using the environment variable based preloading method.

To do this, you have to first remove any xvnkb related entry in the /etc/ld.so.preload file and then put this in a file named xvnkb.sh in the /etc/profile.d
export LD_PRELOAD=/lib/xvnkb.so.0.2.9a
To fix the Gimp problem, in your root terminal, do this:
# cp /usr/bin/gimp-2.6 /usr/bin/gimp-2.6-orig
Create a text file at /usr/bin/gimp-2.6 and put this into that file
#!/bin/sh

export LD_PRELOAD=""
gimp-2.6-orig $1
Go back to your root terminal, add the execution permission to the file
# chmod +x /usr/bin/gimp-2.6
Reboot your box and both xvnkb and Gimp will work (but not together, unfortunately!)

Saturday, August 02, 2008

Đọc được trên VNOSS

Em chỉ thấy đang xài windows mà chuyển sang Linux cứ như đang trong bồn tắm tự nhiên được trôi ra biển vậy, thích lắm big_smile
http://forum.vnoss.org/viewtopic.php?pid=36006#p36006

Wednesday, June 04, 2008

Intel 945/965 mobile with Compiz

For ones that have just upgraded to Fedora 9 with the new Xorg 1.5 (actually 1.4.99 at the time this is posted), compiz performance may be a big problem on Intel 945/965 mobile cards. Fedora 9 was shipped with Xorg 1.5 which is too new and this makes Fedora 9 much more a bleeding edge release than ever.

The well known 'i810' driver in Xorg 1.3 is now deprecated and is shipped as a sym-link to the 'intel' experimental driver in the new Xorg. This resulted in a situation that there is only one way for you to run a 945/965 card with Fedora 9: use the experimental driver. And, this is not good.

The experimental 'intel' driver provides a very bad performance when working with Compiz in its default setting mode. I haved tried to enable the Desktop Effect with no errors but Firefox scrolling perfomance dropped down badly.

I am really disappointed with the way Fedora 9 is shipped with the brand new Xorg. Users with Intel cards have bad compiz performance; Users with Nvidia cards have only a 2D driver with no compiz at all, no 3D game at all (even when using livna). Who else can benefit the new Xorg?!?

I'm still waiting for the new updates from Fedora to have all Intel card problems fixed. The Fedora team has worked really hard to bring Sulphur to life. However, a little bit more efforts for fixing the Intel problems will be deeply appreciated :-x

For the time being, I have temporarily fixed to compiz performance by switching the acceleration mothod of the 'intel' driver to its old XAA mode. This makes Firefox scrolling performance acceptable when using it under Compiz.

Section "Device"
Identifier "Videocard0"
Driver "intel"
Option "AccelMethod" "XAA"
EndSection

Wednesday, May 21, 2008

sed + xargs + inkscape

to make a batch exporting of SVGs to PNGs at a specific size:

foo.sh:
#!/bin/sh

PNG=`echo $1 | sed s/scalable/$2x$2/ | sed s/.svg/.png/`
DIR=`dirname $PNG`

mkdir -p $DIR
inkscape $1 --export-png=$PNG -w$2 -h$2

and at the shell:
$ find . -iname *.svg | xargs -i ./foo.sh {} 32

Monday, May 14, 2007

Pidgin for Fedora Core 4, 5, 6 users

At your root shell:

# cd cd /etc/yum.repos.d/
# wget http://garimbo.org/rpms/fedora/pidgin.repo
# yum -y install pidgin