2010年1月7日 星期四

Device Number Swap During Each Reboot on Arch Linux

to specify loading order of modules in /etc/rc.conf is not working

solution: write custom udev rules

1. get a list of all the attributes of a device

udevadm info -a -p $(udevadm info -q path -n /dev/video0)

first block of the result

looking at device '/devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/video4linux/video0':
KERNEL=="video0"
SUBSYSTEM=="video4linux"
DRIVER==""
ATTR{name}=="Logitech QuickCam Zoom"
ATTR{index}=="0"
ATTR{button}=="0"

2. create rules in /etc/udev/rules.d

vi /etc/udev/rules.d/10-local.rules
--

KERNEL=="video*" ATTR{name}=="Logitech QuickCam Zoom", SYMLINK+="webcam"
KERNEL=="video*" ATTR{name}=="saa7133*", SYMLINK+="tvcard"

10 is the number in sequence
* is wildcard character

3. the symbolic links, /dev/webcam and /dev/tvcard will be created and linked to the corrrect devices when loaded udev rules so you can use soft links instead

Sync File with Rsync between Windows and Arch Linux

1. install rsync on both sides

windows version of rsync is called cwRsync, can be download from http://www.itefix.no/i2/node/10650

2. add each module with the below format to /etc/rsyncd.conf on linux server side

[share]
# comment = Private Share
path = /home/share
# read only = yes
# list = yes
# hosts allow = 192.168.1.0/24
uid = nobody
gid = nobody
# auth users = username
# secrets file = /etc/rsyncd.secrets

3. auth users is read from secrets file

vi /etc/rsyncd.secrets
--

username:password

4. start rsync daemon

/etc/rc.d/rsyncd start

5. test client connection

"C:\Program Files\cwRsync\bin\rsync.exe" username@source_ip::share

6. start synchronizing command from windows client side

"C:\Program Files\cwRsync\bin\rsync.exe" -rt --delete source_ip::share /cygdrive/c/destination

-a, --archive # archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive # recurse into directories
-t, --times # preserve modification times
--delete #delete extraneous files from destination dirs

/cygdrive/c/destination is the destination format for cwrsync

2009年12月25日 星期五

PCI GW-MF54G2 Serial Output

RXD and TXD must be cross-connected to serial adapter

RXD GND TXD VCC
 ______
|  ....| <- serial
|      |
|      |
|      |
 ----||  <- antenna

2009年12月23日 星期三

Remove Orphan Packages on Arch Linux

1. remove a package's dependencies which are not required by any other installed package

sudo pacman -Rs

2. list all packages no longer required as dependencies

sudo pacman -Qdt

3. combine both commands

sudo pacman -Rns $(pacman -Qqtd)

-n, --nosave # delete .pacsave backup files
-q, --quiet # show less information for certain sync operations

2009年12月22日 星期二

Install Maemo 5 SDK on Arch Linux

1. download GUI Installer made with python from http://www.forum.nokia.com/Tools_Docs_and_Code/Tools/Platforms/Maemo/

2. according to http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation, the python script needs to be modified for non-debian linux

129c129
< SB_PATH = "/scratchbox"
---
> SB_PATH = "/opt/scratchbox"
2297a2298
> opt = opt + "-s /opt/scratchbox"
2351a2353
> cmd = cmd +" -s /opt/scratchbox"

3. then run the installer

sudo python ./maemo-sdk-install-wizard_5.0.py

4. start the Xephyr xserver

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &

-host-cursor # re-use exisiting X host server cursor
-screen WIDTHxHEIGHT # specify screen characteristics
-dpi # screen resolution in dots per inch
-ac # disable access control restrictions
-help # prints message with these options

5. disable vdso support in the host's kernel

vi /etc/sysctl
--

# Disable VDSO support
vm.vdso_enabled = 0

6. load in sysctl settings from the file

sudo sysctl -p

7. log out and log back or login to the new group in the current session

newgrp sbox

8. login to scratchbox

/opt/scratchbox/login

9. set the DISPLAY variable to match the display setting given for the Xephyr server

[sbox-FREMANTLE_X86: ~] > export DISPLAY=:2

10. start the ui framework

[sbox-FREMANTLE_X86: ~] > af-sb-init.sh start

11. method to shutdown

[sbox-FREMANTLE_X86: ~] > af-sb-init.sh stop

12. if your linux is non-debian based, start scratchbox manually when the system is rebooted

sudo /opt/scratchbox/sbin/sbox_ctl start

2009年12月15日 星期二

Check The Bandwidth of Network

iperf is a tool for performing network throughput measurements.

1. install iperf on both nodes

arch linux

sudo pacman -S iperf

windows version can be downloaded from http://www.noc.ucf.edu/Tools/Iperf/

2. one node acts as server, the other node would be client
start listening on server side

iperf -s

3. start connecting to server on client side

iperf -c -w 2m server_ip

# -w 2m adjust windows size to 2 mbytes

4. result should appear in a few secs like this

[1924] 0.0-10.0 sec 111 MBytes 92.9 Mbits/sec

2009年11月8日 星期日

Convert FLAC to MP3 on Arch Linux

1. install necessary packages to decode and encode

sudo pacman -S lame flac

2. pipe the decoded standart output for the encoder

flac -dc input.flac | lame -h - output.mp3

-d decode
-c write output to stdout

-h use some quality improvements