2009年6月5日 星期五
Extra Keyboard Key
Extar Keyboaed Key
Console Mode:
/* check keycode */
# showkey
GNOME Sysyem :
/* check the key map */
# xmodmap -pke
/* see which keycode or behavior under GNOME */
# xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
/* check the GNOME keybinding status. */
# gnome-keybinding-properties"
Change HotKey Function :
1. /* Check X window default funtion */
# less /usr/share/X11/XKeysymDB
2. /* Check Hotkey keycode */
# xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
3. /* Change Hotkey function */
# xmodmap -e "keycode `number` = `function`"
缺少keysmdef.h的話
apt-get install libxcb-keysyms0-dev
2009年6月4日 星期四
2009年5月25日 星期一
GPIO Driver
1. Insert Module
#cd mtp_ios
#make --> mtp_io.ko
#insmod mtp_io.ko
#cat /proc/devices | grep mtp_io (Driver register name) --> get module major number 121
#mknod /dev/mtp_io0 (Ap open device name) 121 0
2. Compile AP
#cd mtp_api
#make --> mtp_api.so
#cp mtp_api.so /usr/lib/.
#cd test_mtp
#make
#./test_mtp
done!!
Character Device Driver (unregister_chrdev)
error: void value not ignored as it ought to be
意思是我把一個沒有回傳值的函數當成有回傳值來使用
看了一下程式碼,發現是在這行
if (unregister_chrdev(DEV_MAJOR, DEV_NAME))
翻了一下書,Driver老師講義和聖經黑馬書上是定義如下。
int unregister_chrdev(unsigned int major, const char *name)
但是我去看了一下在 include/linux/fs.h下的定義,卻是以下
extern void unregister_chredv(unsigned int, const char*)
所以在新版本核心提供的函式~他是沒有回傳值的!!
2009年5月21日 星期四
Trace Code Tools
之前上驅動程式課程的時候,老師有稍微提到過ctags的使用方法,但是由於上課的Code都沒有大到需要用這些工具,所以也很快的就遺忘了。一直到工作後,聽到小個兒師父再次提起ctags以及cscope是很好用的trace工具,我才認真的去考慮使用它。
Vim
Vim一直是我是最愛使用的編輯器,不然拿著滑鼠複製貼上實在是很麻煩...
但是由於Ubuntu預設安裝的vim是簡易版,沒有顏色那些,所以要我習慣會抓完整的來使用
#apt-get install vim-full
Ctags
Ctags會建立搜尋點,他會把原始碼內的函式名稱以及各種變數紀錄位置。使用上,只要把游標放在要搜尋的函式或者變數上,按 Ctrl+] 就會跳到函式或者變數的定義位置,按 Ctrl+t則是返回。
#apt-get install ctags
到所要建立ctags的目錄下 # ctags -R *,就會產生tags檔。
但是呢,基本上我看的code都還不會很大,所以只要有ctags就很好用了。像小個兒那些要看kernel source的才會比較需要cscope
Cscope
Cscope是我搞比較久,也不太熟悉的東西,學到什麼再補充什麼。
去http://cscope.sourceforge.net/cscope_maps.vim,把cscope_maps.vim抓下來放到/etc/vim/下, 再去修改/etc/vim/vimrc, 多加一行 source /etc/vim/cscope_maps.vim。
例 :
# cd /usr/src/linux
# ctag -R *
# cscope -R
# vi init/main.c, 就可以使用ctags以及cscope的功能
進入vim畫面,輸入:cs show,就可以看到你剛產生的cscope已經跟你的檔案連結。
c: Find functions calling this function (找出使用這個函式的函式)
d: Find functions called by this function (找出這個函式所使用到的函式)
e: Find this egrep pattern
f: Find this file
g: Find this definition (找出定義處, 同ctags的ctrl+])
i: Find files #including this file (列出include此檔案的檔案)
s: Find this C symbol (Symbol, 以此字串當作識別子, 可以搜尋到定義以及引用處 )
t: Find assignments to (找出有包含這個字串的地方)
參考網頁:http://www.gracecode.com/manual/cscope_vim_tutorial_zh.html
2009年5月19日 星期二
Update Kernel to 2.6.29.3 on Ubuntu 8.04
由於2.6.29.1跟Intel Video Driver好像有點問題,所以升級成2.6.29.3測試
參考文件: http://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=73830
1.
#wget http://mirrors.kernel.org/ubuntu/pool/main/w/wireless-crda/wireless-crda_1.7_i386.deb
#dpkg -i wireless-crda_1.7_i386.deb
#wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-headers-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
#wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29.3/linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
#dpkg -i linux-image-2.6.29-02062903-generic_2.6.29-02062903_i386.deb
開機後,X11也變成正常開啟了,Intel Driver問題自己消失了一 一
2009年5月18日 星期一
Bison Webcam Driver
2. #tar zxf luvcview-20070512.tar.gz
3. cd ./luvcview-20070512
4. #make
Error: SDL/SDL.h is not found
5. #apt-get install libsdl1.2-dev
6. #make
7. #make install