Archive for December, 2008

GNU Screen shortcuts

December 18, 2008 1 comment

I got tired of having a bunch of xterm windows running around on my Aspire One, so i decided to try GNU Screen. The Aspire One uses Linpus Linux , to install it all i had to do was :

sudo yum install screen

after the reboot i tried running screen but nothing happened (or so i thought). well time to jump to the web and find out…. a few minutes, and a couple of links later i found out that when i run screen nothing is supposed to happen ( nothing apparent at least), and all i had to do was start using it.

So here are the bits of information i gathered:

Screen uses the command “Ctrl-A” as a signal to send commands to screen instead of the shell.

Here are a few commands i found usefull:

  1. C-a c  – Creates a new screen shell where you can run your commands
  2. C-a n or C-a p – Move to the next or the previous screen
  3. C-a ” – List the existing screens
  4. C-a S – Split the screen in two
  5. C-a TAB – Switch between split screens
  6. On a  given screen terminal run “screen command name”  – opens a new screen running the given command and names it “name”


Categories: Linux Tags: , ,

Emacs Backup

December 14, 2008 Leave a comment

This is a simple hack.

If you want emacs to backup the files you edit just put this line on your .emacs file:

(setq home-backup “MyDir”)

just replace MyDir with the directory you wish to save your backup files to.

If you are like me you want to carry your emacs with you everywhere in your USB hard drive. PigPog has the solution here.

Using that hack you can use the following line to back up directly to your USB hard drive:

(setq home-backup (concat (getenv “HOME”) “Backup/”))

The above line backups the file to your %HOME%/Backup/

Categories: Emacs Tags: , ,

Setup ZTE MF622 USB Modem in Linux

December 2, 2008 4 comments

Recently I found myself needing to install a 3g Modem for a Portuguese Service Provider (TMN). When i tried plug in the modem in all it did was deploy a new USB drive showing me the contents of what seemed to be the windows installer for the manager application. After a little digging around i found the solutions for my troubles. This post shows the solution i found. this is how i got it to work, I’m not saying its the best and I’m sure its not the only one.

Getting Linux to detect the 3g modem side of the device instead of the USB pen side

This device works as two devices in one. In windows when you plug the modem in it first mounts a hard-drive/cdrom in order to install the drivers and applications for the modem. it later removes this drive and installs itself as a modem. this last part is done by the installer so in Linux this last part never happens when you plug in the modem. What you need to do is force the system to ignore the usb pen drive side of the device.

In order to do this you need to create a file named “15-zte-mf622.rules” and put it in : “/dev/udev/rules.d” (warning you need root privileges in order to do this)

Put the following content in this file you just created:

ACTION!=“add”, GOTO=“ZTE_End”

# Is this the ZeroCD device?

SUBSYSTEM==“usb”, SYSFS{idProduct}==“2000”,

SYSFS{idVendor}==“19d2”, GOTO=“ZTE_ZeroCD”

# Is this the actual modem?

SUBSYSTEM==“usb”, SYSFS{idProduct}==“0001”,

SYSFS{idVendor}==“19d2”, GOTO=“ZTE_Modem”


# This is the ZeroCD part of the card, remove

# the usb_storage kernel module so

# it does not get treated like a storage device

RUN+=“/sbin/rmmod usb_storage”


# This is the Modem part of the card, let’s

# load usbserial with the correct vendor

# and product ID’s so we get our usb serial devices

RUN+=“/sbin/modprobe usbserial vendor=0x19d2 product=0x0001”,

# Make users belonging to the dialout group

# able to use the usb serial devices.

MODE=“660”, GROUP=“dialout”


Note: this is the configuration for the ZTE MF622 modem.

After you have created this file run the following command, this will reload the device rules:

udevcontrol reload_rules

This rules file prevents the system from mounting the USB drive side of the device, but this constitutes a problem. Now your system wont be able to recognize USB hard drives. Don’t fret this can be solved by removing the file and reloading the rules. More on this further down the road.

If you connect your modem at this point you will see that the system now installs it as a modem and you can find it in “/dev/ttyUSB0“.

You can now use your favorite dialer (wvdial, UMTSmon, …) to connect using this device.

The ability to connect thumb drives again.

After deploy the above rules file and reloading your rules you will lose the ability to connect thumb drives to the system. All you have to do to be able to use them is remove the file and reload the rules. I got the following solution from a comment by Dorothy Hyde to the post i mention in the reference part of this article:

1. Create a folder called “/udv-rls” and put the above rules file inside it

2. Create a bash script called 3up with the following code:


cp -v /udv-rls/15-zte-mf622.rules /etc/udev/rules.d/

devcontrol reload_rules

# end of script.

3. Create a bash script called usf with the following code:


rm -v -f /etc/udev/rules.d/15-zte-mf622.rules

udevcontrol reload_rules

#end of script

Now before you plug in the modem run 3up, and after the system has detected the modem run usf.

Connecting to the web:

After the system has detected your modem you now have to be able to connect. I tried using wvdial and all i managed was to get my modem blocked. No matter what i tried i could never get it to connect. So i resorted to UMTSmon. You can get binaries and source from here .

After you install it you can run UMTSmon to dial in. I ran into some trouble at this point:

  • UMTSmon did not detect the modem unless i ran it with root privileges – basically in order to use the installed devices you need to add your self to the uucp group. So you need the run the following commands:

usermod -a -G uucp username

  • If you run UMTSmon without root privileges pppd will ask for root when trying to connect – You need to SUID pppd. I found the following on this matter (Reference).

Because PPP needs to set up networking devices, change the kernel routing table and so forth, it requires root privileges to do this.

If users other than root are to set up PPP connections, the pppd program should be setuid root

-rwsr-xr-x 1 root root 95225 Jul 11 00:27 /usr/sbin/pppd

If /usr/sbin/pppd is not set up this way, then as root issue the command:-

chmod u+s /usr/sbin/pppd

You should now be able to connect to the Internet using your ZTE MF622 modem.

These are the configurations i had to use in UMTSmon in order to connect (these configurations work for TMN – Portuguese Service Provider).

UMTSmon Preferences

UMTSmon Preferences

I created the following bash script which i run before plug in in the modem, it basically automates the above process. Mind that you might be required to run it using root privileges.



echo “******************************”
echo “* ZTE MF622 – Startup Script *”
echo “*                            *”
echo “* Developed by NFurtado      *”
echo “* Date: 02/12/2008           *”
echo “******************************”
echo “”
#copy the rules and reload the udev
echo “Copying the rules file to $rulesFileDir”

cp $rulesFileOriginalPath $rulesFileDir || { echo “ERROR: Rules file could not be copied. Script exiting.”;  exit 1; }
echo “Reloading Rules”
/sbin/udevcontrol reload_rules || { echo “ERROR: Rules could not be reloaded. Script Exiting.”; exit 1;}

#output connect modem
echo “Please connect 3g Modem.”
echo “Waiting for modem…”

#loop and wait for modem to be connected
while [ -z $ttyGrep ]

ttyGrep=`ls  /dev/ |grep ttyUSB0`


echo “Modem Detected”
echo “Cleaning up:”

#remove rules file and reload rules
echo “Removing rules file from ${rulesFileDir}”

rm -v -f $rmCommand || { echo “ERROR: Rules file could not be Removed. Remove it manually.”;}
echo “Reloading Rules”
/sbin/udevcontrol reload_rules  || { echo “ERROR: Rules could not be reloaded. Script Exiting.”; exit 1;}
echo “”

echo “Modem is Setup. Use your favorite Dialer to connect.”

exit 0

As i said before I’m a newbie in these affairs so take the above instructions and scripts with a grain of salt. If you see any inconsistencies or errors just let me know


Categories: Linux Tags: , ,