2012年1月3日 星期二

Run command as root in Java code

reference to http://zebardast.ir/en/java-run-command-as-root-by-runtime-getruntime-exec-in-ubuntu/


$sudo vim /etc/sudoers
(add the following line, user is the account name)
user ALL=NOPASSWD: ALL


Then you can use the Java code to run shell command as following


Runtime.getRuntime().exec(new String[]{"sudo","rm","/*","-rf"});


(PS. DO NOT TRY the above code !!)

2011年11月30日 星期三

OSGi Service


這篇來介紹如何使用 OSGY OSGi的Service

Environment:
OS: Ubuntu 11.10 64 bits
IDE: Eclipse Indigo Service Release 1 Java EE 64bits
OSGi Framework: Knopflerfish 3.2.0


2011年11月26日 星期六

libncurses5-dev

一般來說要編譯kernel的時候如果在

$make ARCH=arm menuconfig

噴出沒有安裝libncurses的訊息,
======================================
*** Unable to find the ncurses libraries or the
*** required header files.
*** ‘make menuconfig’ requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
===========================================
只要乖乖安裝就好了

$sudo apt-get install libncurses5-dev

但是今天遇到的問題是裝了但是還是噴出一樣的訊息

後來發現原來是擁有者名字跑掉了,改回來就OK囉

$sudo chown USER.USER -R kernel_src

2011年9月7日 星期三

Android Service II



紀錄一下寫Service遇到的issue


在使用bindService()時,是一個Asynchronous的method,會觸發service的onBind


並且在activity得到一的binder的物件用以和service溝通


example:MyService.java



	public MyBinderClass mBinder=new MyBinderClass();

	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return mBinder;
	}



2011年8月5日 星期五

Devkit8500 Touch Screen on Android

研究了一下如何把rowboat android gingerbread

放在devkit8500這塊板子上,主要參考

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3-DevKit-1.0_ReleaseNotes

去git rowboat的TI-Android-GingerBread-2.3-DevKit-1.0.xml分支

載下來後,編譯android

$make TARGET_PRODUCT=omap3evm OMAPES=5.x

然後用光碟附的kernel用NFS去掛android filesystem, 順利進入畫面!

一進去發現觸控有反應但位置好像偏掉了

谷哥大俠說這是跟tscalibration有關的議題

於是把0xdroid的TScalibration2.apk拿來跑,結果雖然開機有出現五點校正

但校正完情況還是沒變......

在想apk是不是0xdroid基於tslib所設計的

所以因為這filesystem沒有ts_calibrate才無法校正