Ubuntu guide to using HSDPA USB-modem Huawei E220 with the Tre network

March 13th, 2007 by ltz

Using the Huawei E220 under Linux is not supported by the 3G operator 3 (in Swedish: Tre ..). Here’s a guide how to get it working on Ubuntu.

Your connection have a pin-code per default set. Its written on your larger sim-card adapter. In order to simplify alot, lets just remove this. Put the 3g data simcard in your 3g-phone and remove the sim pin. Then put the card into the USB-modem.

If you start up your Ubuntu machine and plug in the USB-modem, it will show as a cd-rom drive (atleast my does). Also I’m getting a folder popping up as if it would be a storage device (it does seems to be a storage device for windows drivers..).

- First step, right click on the newly auto-created cd-rom icon on your desktop and choose eject. Close any windows using the device.

- Start a terminal. The commands below should be ran as root.

rmmod usb-storage
rmmod usbserial

(the later might create an error.)

lsusb
- The last command shoul show the device connected similiar to:
Bus 001 Device 003: ID 12d1:1003

Run:
modprobe usbserial vendor=0×12d1 product=0×1003

Now, disconnect the Huawei E220 USB-modem and wait a few seconds before connecting it again.

- As soon as the device have stopped blinking green you should find three new USB-devices by running the command:
ls -al /dev/ttyU*

Now its time to setup the wvdial.conf file. This config works for me, given that the pin sim-code is removed it whould work right off for you aswell. That is if you have a swedish tre.se turbo3g or 3g data account.


[Dialer Defaults]
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyUSB0
Username = user
Dial Command = ATDT
Password = pass
Baud = 460800
Init4 = AT+CGDCONT=1,"IP","data.tre.se"

You should now be able to run the command:
wvdial

And the log might look something like this:

******@pierre-laptop:/# wvdial
--> WvDial: Internet dialer version 1.56
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","data.tre.se"
AT+CGDCONT=1,"IP","data.tre.se"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Tue Mar 13 21:46:20 2007
--> Pid of pppd: 4714
--> Using interface ppp0
--> local IP address 10.147.106.11
--> remote IP address 80.251.193.196
--> primary DNS address 80.251.192.244
--> secondary DNS address 80.251.192.245
--> Connect time 0.1 minutes.
--> local IP address 10.147.106.11
--> remote IP address 80.251.193.196
--> primary DNS address 80.251.192.244
--> secondary DNS address 80.251.192.245

Posted in *NIX, Comp, Ubuntu | 4 Comments »

Joomla template creation, Joom!Fish language detection.

February 19th, 2007 by ltz

Creating a Joomla template might be rather simple, when involving different languages on the text-level it all seems simple aswell. However when we want 100% of our website to change language when we swith languages, this requires a workaround. The Joom!fish component is very powerful, however you control 95% of the website content from Joom!fish, the rest should be handled some other way. I find it easy to manipulate these parts from ithin the template, creating a few language files containing the rest of the phrases/imagesfiles/meta tags etc that you whish to translate. Some example code below.

Retrieving the current language setting.

Given that the Joom!Fish component is installed, the following code in your template index.php should do the trick.


< ?php
/**
* @author Pierre Norraeus
*
* Return the current language. This variable is controlled by
* the Joom!Fish Joomla component. Having this function should enable
* a potential change in the Joom!Fish functionality.
*
*
*/
function getCurrentLanguage() {

global $mosConfig_lang;

return $mosConfig_lang;

}

/**
* @author Pierre Norraeus
*
* Detect the current language, for now only accept swedish, and if
* not swedish lets make english the default.
*
* @todo extend more languages..
*
*/
if (getCurrentLanguage() == "swedish") {

include_once ('language_texts_se.php');

} else {

include_once ('language_texts_en.php');

}

? >

Example language file.

The variablenames below should of course be according to your coding standard (aswell as the rest of this example..:) ).

< ?php
/*
* @author Pierre Norraeus
* English language file.
*
*/

define(main_userid, 'Username');
define(main_password, 'Password');

? >

HTML examples..

Importing a language-based javascript file..

..script language="JavaScript" type="text/javascript" src="< ?php echo $mosConfig_live_site;?>/templates/Templatename/js/menu_< ?php echo getCurrentLanguage();? >.js”>

Language specific image

...img src="< ?php echo $mosConfig_live_site;? >/templates/templatename/images/buttons/search_< ?php echo getCurrentLanguage();? >.gif” alt=”" /…

The rest should be handled by the Joom!Fish component, very smooth.

Posted in Programming, Comp, Joomla | No Comments »

ZD1211 Wireless LAN installation upon Ubuntu

January 31st, 2007 by ltz

Seems like the wireless area in ubuntu lacks some usable guides. I am trying to configure a standard, very cheap piece of USB Wireless stick of the brand Sweex (model: LC100040. based upon the Zydas 1211 chipset) on an old laptop COMPAQ armada M700 series. Found som standard drivers in the ubuntu universe repository and even thou I can find some networks with this driver, I cannot connect to any of them. Not even my own wlan-router, which worked fine in windows. Next step is trying out a zd1211 guide I found at an ubuntu forum (Howto Zydas 1211 with Ubuntu EDGY). Will get back to the result of this one..

Several “Invalid” messages when entering lwconfig
eth1 802.11g zd1211 ESSID:"test" Mode:Ad-Hoc Frequency:2.472 GHz Cell: Invalid Bit Rate=1 Mb/s Encryption key:off Link Quality=93/100 Signal level=93/100 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0

Posted in *NIX, Comp | No Comments »

Ubuntu PHP5, MySQL, Apache2 installation order..

January 22nd, 2007 by ltz

Installing the Ubuntu Server distribution and perhaps only using the php5-cli module (= php interpreted at the command line..) together with MySQL works fine. However if you want apache2 installed later on, the installation might result in an errormessage not very unlike:

Call to undefined function mysql_pconnect() …..
This is because of php not finding the mysql addon. The installation order in ubuntu messed ut the automatic configuration and the config file will not be able to find the correct mysql.so file. This is of course given that you have installed all the required modules correctly (php5, php5-mysql, apache2, mysql ….+ libs).

Try this for a solution..

Update the database..
sudo slocate -u

Find the mysql.so file.
locate mysql.so

Probably returns /usr/lib/php5/20051025/mysql.so, create and copy this file to a extensions directory to the php5.
sudo mkdir /usr/lib/php5/ext
sudo cp /usr/lib/php5/20051025/mysql.so /usr/lib/php5/ext/

Last, edit the php.ini file.
sudo pico /etc/php5/apache2/php.ini

Look for a mysql.so entry. (Search in pico by using ctrl+w). It should look like:
extension = mysql.so
Save the php.ini file. (ctrl+x then enter y)
Restart the apache2 webbserver:
sudo apache2ctl restart
This should do it..

Edit:
Link: ubuntu forum guide surrounding the same problem.

Posted in *NIX, Comp | No Comments »

Camera live motion detection recording with ubuntu linux..

October 28th, 2006 by ltz

This is rather old news, however since I found guides from people explaining how they have spend 10 hours to get this working, I just might have an ubuntu-related guide that does this faster..

Given my local dev-server (1000mhz, 400mb ram) running the latest ubuntu server installation together with my cheap usb1.1 webcam.

Since I’m using the server version, this is the text-based install guide.

  • Given that you have ubuntu installed.
  • Make sure the /etc/apt/sources.list have both universe and backports enabled. (also run “apt-get update” after any change)
  • Run “apt-get -s install motion” and have a quick lock so that any unwanted parts your system installation won’t be removed.
  • run “apt-get install motion”
  • run “apt-get install ffmpeg” (add -s if you which to look over the changes..)
  • plug-in your usb-webcam.
  • run “dmesg” and check if the plug and play detection went ok. It should probably be in any of the later rows if you just recently plugged it in.
  • open /etc/motion/motion.conf (for instance: “pico /etc/motion/motion.conf”)
  • change the settings of your choosing (also check the video-device link).. check the motion website for a good explanation of the settings.. http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome
  • after completing the config, run “motion”.. Any errors will display.
  • Check the given directory for image/video-files. given that the camera install went fine.
  • Your installation is complete. Run motion in deamon mode next time (”motion -d”)

Posted in *NIX, Comp | No Comments »

Small scale servers and power consumtion.

October 28th, 2006 by ltz

Electricity costs is a big and growing issue within the IT world. The fact that larger server parks consume large amounts of electricity is given, however how often do you calculate how much electricity that server you got running somewhere in your house is actually consuming? Here’s my findings in this subject, having a small server currently running barely any load. The question is if its worth even having it running at all.

According to this article from the University of Waterloo, a 40 watt fluorecent overhead lamp draws more power overnight then a modern PC running in safe mode. My guess is that this applies to a client computer and that it would be hard to have a server unit run in safe mode (given that there are some server-load).

An actual electricity measurment would be prefferable, but in my case I have no such tools, and I am willing to settle for an estimate on the consumtion of my servers.

Given the PSU-calculator on this site, the old server computer should draw around 119w / hour. Which totals to around 85 Kw’s per month and around 1020 Kw’s per year.

No monitors, only the server hardware and perhaps some usb devices attached.

Posted in Comp | No Comments »

Pierre Norraeus
Joomla! 1.5 Beta 2 - Red Barchetta