repo 是 google 在 Android Open Source Project 導入的原始碼管理工具, 用來同步許多 git repository 的動作, 同時也協助 source code review server 溝通。
用 repo 來開始抓遠端的 source code 時, 必須先指定 URL 及想抓取的分支, 如以下的指令就是抓出 AOSP 上 tag 為 android-4.0.1_r1 的版本 :
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
在下 repo sync 之前, 可以先看看抓下來的 manifest.xml 檔案 :
$ cat .repo/manifest.xml | head -9
<!--?xml version="1.0" encoding="UTF-8"?-->
<manifest>
<remote name="aosp" <="" p="">
fetch=".." />
<default <="" p="" revision="refs/tags/android-4.0.1_r1">
remote="aosp"
sync-j="4" />
很明顯, 剛剛所下的分支版號就紀錄於此, 此時我們再下一次 init, 改抓另個分支 :
$ repo init -b android-2.3.7_r1
.repo/manifests/: manifest switched android-4.0.1_r1...android-2.3.7_r1
.repo/manifests/: discarding 10 commits removed from upstream
再看一次 manifest.xml :
$ cat .repo/manifest.xml | head -9
<!--?xml version="1.0" encoding="UTF-8"?-->
<manifest>
<remote name="aosp" <="" p="">
fetch=".." />
<default <="" p="" revision="refs/tags/android-2.3.7_r1">
remote="aosp"
sync-j="4" />
的確紀錄的版本改變了, manifest.xml 上面所紀錄的分支名稱, 會用來當執行 repo sync 時, 把各個 git repository 照這分支抓下來。
$ repo sync bionic
Downloading bionic: 100% (3MB/3MB), done.
...
Unpacking objects: 100% (61/61), done.
From https://android.googlesource.com/platform/bionic
...
Fetching projects: 100% (1/1), done.
$ cd bionic/
$ git branch -a
* (no branch)
...
remotes/m/android-2.3.7_r1 -> refs/tags/android-2.3.7_r1
此時抓下來的分支, 就是後面改設的 android-2.3.7_r1, 這時試著改切回 4.0.1_r1 的分支
$ repo init -b android-4.0.1_r1
.repo/manifests/: manifest switched android-2.3.7_r1...android-4.0.1_r1
.repo/manifests/: discarding 1 commits removed from upstream
$ repo sync bionic
Fetching projects: 100% (1/1), done.
$ cd bionic/
$ git branch -a
* (no branch)
...
remotes/m/android-2.3.7_r1 -> refs/tags/android-2.3.7_r1
remotes/m/android-4.0.1_r1 -> refs/tags/android-4.0.1_r1
可以看到有兩個跟遠端的依從關係, 理論上這裡紀錄了 local repository 跟 remote repository 分支版本的關係, 這裡的資訊會來 commit 檔案到遠端的時候, 選擇正確的 branch, 不過這裡我尚無法實驗釐清。
當我們單獨 git clone 一個 project 時, -b 亦會產生相同的效果
Wednesday, December 07, 2011
Thursday, December 01, 2011
Vibrator function support in Android
Android application connect to HAL by JNI interface, for vibrator, the JNI interface is defined very simple.
JNI: frameworks/base/services/jni/com_android_server_VibratorService.cpp
vibratorOn, vibratorOff and vibratorExists just simple wrapper of vibrator_on, vibrator_off and vibrator_exists, which is provide by device maker, through HAL interface.
HAL: hardware/libhardware_legacy/vibrator/vibrator.c
#define THE_DEVICE "/sys/class/timed_output/vibrator/enable"
int vibrator_exists()
{
int fd;
#ifdef QEMU_HARDWARE
if (qemu_check()) {
return 1;
}
#endif
fd = open(THE_DEVICE, O_RDWR);
if(fd < 0)
return 0;
close(fd);
return 1;
}
int vibrator_on(int timeout_ms)
{
/* constant on, up to maximum allowed time */
return sendit(timeout_ms);
}
int vibrator_off()
{
return sendit(0);
}
HAL call into kernel space by sysfs, path at "/sys/class/timed_output/vibrator/enable"
It's a Android designed feature, a timed_output or timed_gpio device.
If you echo 10000 into this sysfs, then it will vibrate for ten seconds :
Inside kernel space, Android defined two new platform driver to be use for vibrator : timed_gpio and timed_output.
By grab HC kernel source that released by Acer/ASUS, found that they are using different of implementation.
Acer use a gpio pin, config with a timed_gpio driver, hook up with platform_device driver, and also to timed_output driver to provide vibrator interface from sysfs.
ASUS use an IC max1749, directly register a timed_output interface to provide vibrator interface from sysfs.
PS. Beside kernel source, above source code is trace from AOSP 4.0.1.
JNI: frameworks/base/services/jni/com_android_server_VibratorService.cpp
static jboolean vibratorExists(JNIEnv *env, jobject clazz)
{
return vibrator_exists() > 0 ? JNI_TRUE : JNI_FALSE;
}
static void vibratorOn(JNIEnv *env, jobject clazz, jlong timeout_ms)
{
// LOGI("vibratorOn\n");
vibrator_on(timeout_ms);
}
static void vibratorOff(JNIEnv *env, jobject clazz)
{
// LOGI("vibratorOff\n");
vibrator_off();
}
static JNINativeMethod method_table[] = {
{ "vibratorExists", "()Z", (void*)vibratorExists },
{ "vibratorOn", "(J)V", (void*)vibratorOn },
{ "vibratorOff", "()V", (void*)vibratorOff }
};
vibratorOn, vibratorOff and vibratorExists just simple wrapper of vibrator_on, vibrator_off and vibrator_exists, which is provide by device maker, through HAL interface.
HAL: hardware/libhardware_legacy/vibrator/vibrator.c
#define THE_DEVICE "/sys/class/timed_output/vibrator/enable"
int vibrator_exists()
{
int fd;
#ifdef QEMU_HARDWARE
if (qemu_check()) {
return 1;
}
#endif
fd = open(THE_DEVICE, O_RDWR);
if(fd < 0)
return 0;
close(fd);
return 1;
}
int vibrator_on(int timeout_ms)
{
/* constant on, up to maximum allowed time */
return sendit(timeout_ms);
}
int vibrator_off()
{
return sendit(0);
}
HAL call into kernel space by sysfs, path at "/sys/class/timed_output/vibrator/enable"
It's a Android designed feature, a timed_output or timed_gpio device.
If you echo 10000 into this sysfs, then it will vibrate for ten seconds :
$ echo 10000 > /sys/class/timed_output/vibrator/enable
If you cat it during the vibration, you will saw how many ms before it back to quiet :
$ cat /sys/class/timed_output/vibrator/enable
315
Inside kernel space, Android defined two new platform driver to be use for vibrator : timed_gpio and timed_output.
By grab HC kernel source that released by Acer/ASUS, found that they are using different of implementation.
Acer use a gpio pin, config with a timed_gpio driver, hook up with platform_device driver, and also to timed_output driver to provide vibrator interface from sysfs.
ASUS use an IC max1749, directly register a timed_output interface to provide vibrator interface from sysfs.
PS. Beside kernel source, above source code is trace from AOSP 4.0.1.
Thursday, March 03, 2011
Android-x86 ginerbread build failed
Same as below :
https://groups.google.com/group/android-building/browse_thread/thread/e9baa16a0b1e96f
Inside fedora14, update "make", then problem solved.
So seems newer version of make had released.
https://groups.google.com/group/android-building/browse_thread/thread/e9baa16a0b1e96f
Inside fedora14, update "make", then problem solved.
So seems newer version of make had released.
Friday, January 21, 2011
pidof script of mac OSX
Found at http://hints.macworld.com/article.php?story=20030618114543169
#!/bin/sh ps axc|awk "{if (\$5==\"$1\") print \$1}";
Saturday, January 15, 2011
Interface builder
Can't connect outlet from rounded button to file's owner.
Found same issues :
http://stackoverflow.com/questions/1746281/cant-connect-iboutlet-in-interface-builder
Solved by read class file again, wired !
Found same issues :
http://stackoverflow.com/questions/1746281/cant-connect-iboutlet-in-interface-builder
Solved by read class file again, wired !
Friday, January 14, 2011
SSH Over USB
From iPhone Development Wiki
SSH over USB using usbmuxd Tested on OS X. Works on Windows too, according to the README- Get usbmuxd source package and unpack
- Go into folder python-client
- chmod +x tcprelay.py
- Run ./tcprelay.py -t 22:2222
The -t switch tells tcprelay to run threaded and allow more than one ssh over the same port.
See ./tcprelay.py --help for further options.
Log from : http://iphonedevwiki.net/index.php/SSH_Over_USB
Subscribe to:
Posts (Atom)