2010年6月4日 星期五
2010年6月3日 星期四
在linux 下使用rdesktop連線windows 遠端桌面
在ubuntu中可以使用內建的圖形化介面:tsclient
不過他預設的解析度只有固定幾個,無法改變
(就直接修改tsclient存下來的設定檔,也只會跳到最接近的選項)
所以可以使用rdesktop指令:
不過他預設的解析度只有固定幾個,無法改變
(就直接修改tsclient存下來的設定檔,也只會跳到最接近的選項)
所以可以使用rdesktop指令:
rdesktop -u cyl -p passwd -g 1280x1000 -a 24 192.168.0.XXX -x nr
rdesktop: A Remote Desktop Protocol client.
Version 1.6.0. Copyright (C) 1999-2008 Matthew Chapman.
See http://www.rdesktop.org/ for more information.
Usage: rdesktop [options] server[:port]
-u: user name
-d: domain
-s: shell
-c: working directory
-p: password (- to prompt)
-n: client hostname
-k: keyboard layout on server (en-us, de, sv, etc.)
-g: desktop geometry (WxH)
-f: full-screen mode
-b: force bitmap updates
-L: local codepage
-A: enable SeamlessRDP mode
-B: use BackingStore of X-server (if available)
-e: disable encryption (French TS)
-E: disable encryption from client to server
-m: do not send motion events
-C: use private colour map
-D: hide window manager decorations
-K: keep window manager key bindings
-S: caption button size (single application mode)
-T: window title
-N: enable numlock syncronization
-X: embed into another window with a given id.
-a: connection colour depth
-z: enable rdp compression
-x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex nr.)
-P: use persistent bitmap caching
-r: enable specified device redirection (this flag can be repeated)
'-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1
or COM1=/dev/ttyS0,COM2=/dev/ttyS1
'-r disk:floppy=/mnt/floppy': enable redirection of /mnt/floppy to 'floppy' share
or 'floppy=/mnt/floppy,cdrom=/mnt/cdrom'
'-r clientname=': Set the client name displayed
for redirected disks
'-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1
or LPT1=/dev/lp0,LPT2=/dev/lp1
'-r printer:mydeskjet': enable printer redirection
or mydeskjet="HP LaserJet IIIP" to enter server driver as well
'-r sound:[local[:driver[:device]]|off|remote]': enable sound redirection
remote would leave sound on server
available drivers for 'local':
alsa: ALSA output driver, default device: default
oss: OSS output driver, default device: /dev/dsp or $AUDIODEV
'-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard
redirection.
'PRIMARYCLIPBOARD' looks at both PRIMARY and CLIPBOARD
when sending data to server.
'CLIPBOARD' looks at only CLIPBOARD.
-0: attach to console
-4: use RDP version 4
-5: use RDP version 5 (default)
-y: use raw keyboard (default no)
2010年6月2日 星期三
簡易連線uart的程式
本來是想要把minicom搬到android上,不過他的source code很多,也蠻複雜的,
後來在網路上找到tick_minicom,只有幾個檔案,應該很容易讓他編進android
tick_minicom:簡單的uart程式
http://linuxocarina.blogspot.com/2007/09/minicom.html
不過我的連線設定跟他不一樣,所以參考以下網站對程式做了一些修改之後就可以使用了
http://book.51cto.com/art/200711/59758.htm
後來在網路上找到tick_minicom,只有幾個檔案,應該很容易讓他編進android
tick_minicom:簡單的uart程式
http://linuxocarina.blogspot.com/2007/09/minicom.html
不過我的連線設定跟他不一樣,所以參考以下網站對程式做了一些修改之後就可以使用了
http://book.51cto.com/art/200711/59758.htm
int
set_baud (int fd, int rate)
{
int i, rt;
u_int32_t bd = 0;
struct termios ti;
//select baudrate
for (i = 0; i < ARRAY_SIZE (bdrts); i++) {
if (bdrts[i].bps == rate) {
bd = bdrts[i].b;
debug("select baudrate: %d\n",rate);
break;
}
}
if (bd == 0) {
error ("Cannot set Baud Rate!!\n");
return -1;
}
//set baudrate
rt = tcgetattr (fd, &ti);
if (rt < 0) {
error ("Cannot get attr i=%d\n", rt);
return rt;
}
debug ("Open uart input with speed %d\n", bdrts[i].bps);
//rt = cfsetispeed (&ti, B0);
rt = cfsetispeed (&ti, bd);
if (rt < 0) {
//error ("Cannot set input baud to B0!!\n");
error ("Cannot set input baud to bd!!\n");
return rt;
}
debug ("Open uart output with speed %d\n", bdrts[i].bps);
rt = cfsetospeed (&ti, bd);
if (rt < 0) {
error ("Cannot set baud rate %d\n", bdrts[i].bps);
return rt;
}
rt=tcsetattr (fd, 0, &ti);
if(rt<0){
return rt;
}
//set no hareware conrtol
rt = tcgetattr (fd, &ti);
//ti.c_cflag |= CRTSCTS; // hardware control
ti.c_cflag &= ~CRTSCTS; // no hardware control
rt=tcsetattr (fd, 0, &ti);
if(rt<0){
return rt;
}
//set databit:8
rt = tcgetattr (fd, &ti);
ti.c_cflag&=~CSIZE;
ti.c_cflag |=CS8;
rt=tcsetattr (fd, 0, &ti);
if(rt<0){
return rt;
}
//set no parity bit
rt = tcgetattr (fd, &ti);
ti.c_cflag &= ~PARENB;
rt=tcsetattr (fd, 0, &ti);
if(rt<0){
return rt;
}
return rt;
}
標籤:
android,
C programming,
linux
2010年5月31日 星期一
使用shell script計算CPU使用率
PROGRAM_NAME --程式名稱DELAY ---------每隔多久看一次CPU usageNUMBER --------總共看幾次
top -b -n NUMBER -d DELAY | tee top.log
cat top.log | grep CPU: | awk '{print $8}' | sed s/%//g
cat top.log | grep -v grep | grep PROGRAM_NAME | awk '{print $7}'| sed s/%//g
example:
假設要看hello程式, 一分鐘內每隔一秒的CPU使用率:
top -b -n 60 -d 1 | grep -v grep | grep hello | awk '{print $7}'| sed s/%//g
輸出結果:
09521222422331232320.....
標籤:
linux,
shell script
2010年5月30日 星期日
腳踏車變速器/剎車調整
我是用:
SHIMANO TY-22中變速器
SHIMANO TOURNEY TX-31 FOR 21SPEED 後變速器
SHIMANO EF50上下按鍵式變把
SHIMANO MFTZ21 7速飛輪
中變:
1.在把手上有微調旋鈕,先調整至在中間那一檔能夠順利 往上下檔位切換
2.調整high/low螺絲限制最高與最低檔位的位置 至適當距離
後變:
1.微調旋鈕在後變上,調整至後變中間幾個檔位切換順暢
2.調整high/low螺絲限制後變最高與最低檔位的 位置至適當距離
剎車:
1.調整變速器上的微調旋鈕使剎車按壓的距離至適當位置
2.調整V型剎車組的彈簧微調螺絲使得兩邊彈力差不多, 剎車皮與輪圈之間距離相同
SHIMANO TY-22中變速器
SHIMANO TOURNEY TX-31 FOR 21SPEED 後變速器
SHIMANO EF50上下按鍵式變把
SHIMANO MFTZ21 7速飛輪
中變:
1.在把手上有微調旋鈕,先調整至在中間那一檔能夠順利
2.調整high/low螺絲限制最高與最低檔位的位置
後變:
1.微調旋鈕在後變上,調整至後變中間幾個檔位切換順暢
2.調整high/low螺絲限制後變最高與最低檔位的
剎車:
1.調整變速器上的微調旋鈕使剎車按壓的距離至適當位置
2.調整V型剎車組的彈簧微調螺絲使得兩邊彈力差不多,
在linux下使用LFTP多點下載
參考 http://yurinfore.blogspot.com/2009/10/linux.html
改成可以控制下載thread數量
function pget()
{
thread=5
case $# in
1)
addr=$1
;;
2)
thread=$1
addr=$2
;;
*)
echo "usage:"
echo "pget [URL] (default thread:5)"
echo "or"
echo "pget [thread] [URL]"
exit 1
;;
esac
echo thread : $thread
echo address : $addr
cmd="pget -n $thread $addr; exit"
lftp -e "$cmd"
}
改成可以控制下載thread數量
function pget()
{
thread=5
case $# in
1)
addr=$1
;;
2)
thread=$1
addr=$2
;;
*)
echo "usage:"
echo "pget [URL] (default thread:5)"
echo "or"
echo "pget [thread] [URL]"
exit 1
;;
esac
echo thread : $thread
echo address : $addr
cmd="pget -n $thread $addr; exit"
lftp -e "$cmd"
}
訂閱:
文章 (Atom)
