8/12/09

Run USB 3G Modem from Linux Ubuntu

Most USB modem nowadays have dual mode. First it act as storage-drive which enable users to install the modem flawlessly. After it installed, it then change mode to 3G Modem. Unfortunately, this does not works well in Linux system. Most of recent Linux distribution can be used to run 3G modem without having to install driver.

This dual made system make users confuses when using wvdial to connect to the internet. wvdial will not detect a serial modem even if users plug the modem properly. To make the usb modem recognized as a modem (not storage) we need to manually detach the usb modem as a storage (or you can automate it using usb_modeswitch - http://www.draisberghof.de/usb_modeswitch/ - maybe I'll try to explain how to use this tools later)

To do this manually, all you have to do is unmount the usb, remove the usb-storage and usbserial module, then reinstate the module. This is how you do it ubuntu.

1. Unmount the usb modem. You can achieve this by right clicking the usb icon in the desktop and klik eject. But, if you like me, you will like more straightforward technique using the terminal by using unmount command.
# unmount /media/xxxx

2. Remove the usbserial and usb-storage module. Before you remove it run the lsusb command first to check the vendor and the product id of the usb modem (act as storage). This is useful as reference for the 3rd step.
# modprobe -r usb-storage
# modprobe -r usbserial

3. Reinstate the modul back using the correct vendor-id and product-id. To get vendor and product id you can use lsusb command. Compare it with the first lsusb command you issue. There should be a change of value in one of the usb devices. The vendor id will be the same, but the produt id is different.
# modprobe usbserial vendor=0x0xxxx product=0x0xxxx

4. Done. The modem will be recognized as a serial modem. You should now can use your usb modem. Use your favourite dialer such as wvdial. Youcan use wvdialconf to verify whether your usb modem is detected properly. Example of wvdial configuration as follows.

============
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
New PPPD = yes
Phone = *99#
Modem = /dev/ttyUSB0
Username =
Password =
Baud = 9600

[Dialer Telkomsel]
Init3 = AT+CGDCONT=1,"IP","internet"
Phone= *99#
Username = – (whatever you want)
Password = – (whatever you want)
==============

You than can connect to the internet by using wvdial command
#wvdial telkomsel

more ...

DOS batch script to modify windows task scheduler

Recently I was annoyed by one rules which force me to get into the office on time. So I made a little script to automate my attendance. I then scheduled the script to run at a specified time. To make the scheduled time a little random I made a second simple script that change the scheduled tasks so the first script will run at random time from 7:10 to 7:49.

This is the script

====================
REM Script for change schedule

SCHTASKS /Delete /TN attend_in_khairil /F

REM attend_in_khairil
set /a menit_kiri_khairil=%random% %% 4 + 1
set /a menit_kanan_khairil=%random% %% 9
schtasks /create /RU DOMAIN\Username /RP Password /TN attend_in_khairil /TR "D:\absen\absen_in_khairil.bat" /ST 07:%menit_kiri_khairil%%menit_kanan_khairil%:00 /SC WEEKLY /D MON,TUE,WED,THU,FRI /SD 08/01/2009
====================

Simple huh ... I then just schedule this script to run everyday.

This way I will never be late at the office, hehehehe.





more ...