ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年1月23日 星期四

kworker 的一些information

因為 kworker/u:3 持續佔用 17% 的 cpu time。
所以要看一下。

# cat /proc/1139/stack
[c0264f54] msleep+0x24/0x30
[c04f6ac0] mmc_power_up+0x88/0xb8
[c04f848c] mmc_rescan+0x278/0x33c
[c026e7d0] process_one_work+0x2b0/0x47c
[c0270dd0] worker_thread+0x200/0x320
[c0274dc4] kthread+0x98/0xa0
[c02342a0] kernel_thread_exit+0x0/0x8
[ffffffff] 0xffffffff
# cat /proc/1139/stack
[c0270ee0] worker_thread+0x310/0x320
[c0274dc4] kthread+0x98/0xa0
[c02342a0] kernel_thread_exit+0x0/0x8
[ffffffff] 0xffffffff
# cat /proc/1139/stack
[c0270ee0] worker_thread+0x310/0x320
[c0274dc4] kthread+0x98/0xa0
[c02342a0] kernel_thread_exit+0x0/0x8
[ffffffff] 0xffffffff
# cat /proc/1139/stack
[c0270ee0] worker_thread+0x310/0x320
[c0274dc4] kthread+0x98/0xa0
[c02342a0] kernel_thread_exit+0x0/0x8
[ffffffff] 0xffffffff
所以 有一次抓到是再 mmc_rescan( )...

2014年1月17日 星期五

Android : 一些 setting 的 default setting

ref: http://androidextrememodding.blogspot.tw/2012/10/android-default-parameters.html

整段 COPY:
There is a really simple way to set default values of Android settings when building a new custom firmware.

Most of those parameters are declared in a resource xml file from the SettingsProvider base package located at:

frameworks/base/packages/SettingsProvider/res/values/defaults.xml

Unfortunately not of all the default parameters can be set here. For some unknown reasons (you must ask Google for this) 
there are some other configuration items that are set in java code at:

frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

This is true, for example, for the "Stay awake" option.

Another suggestion : always check for specific device source overlay...sometimes there already are customized resource 
or java files in the "device" directory.


也就是說, checkout defaults.xml 和 DatabaseHelper.java


另外,有關 configuration 的部份...
ref: http://stackoverflow.com/questions/16770639/how-to-set-default-properties-in-aosp

內容 copy:
There are two main places I usually check for defaults: 
/frameworks/base/packages/SettingsProvider/res/values/defaults.xml 
and: 
/frameworks/base/core/res/res/values/config.xml

2014年1月15日 星期三

Note: VirtualKey in android

ref: https://source.android.com/devices/tech/input/touch-devices.html

Virtual Key Map Files

Touch devices are often used to implement virtual keys.

There are several ways of doing this, depending on the capabilities of the touch controller. Some touch controllers can
 be directly configured to implement soft keys by setting firmware registers. Other times it is desirable to perform 
the mapping from touch coordinates to key codes in software.

When virtual keys are implemented in software, the kernel must export a virtual key map file called virtualkeys.
(devicename) as a board property. For example, if the touch screen device drivers reports its name as "touchyfeely" 
then the virtual key map file must have the path /sys/board_properties/virtualkeys.touchyfeely.

A virtual key map file describes the coordinates and Linux key codes of virtual keys on the touch screen.

In addition to the virtual key map file, there must be a corresponding key layout file and key character map file to 
map the Linux key codes to Android key codes and to specify the type of the keyboard device (usually SPECIAL_FUNCTION).
Syntax

A virtual key map file is a plain text file consisting of a sequence of virtual key layout descriptions either 
separated by newlines or by colons.

Comment lines begin with '#' and continue to the end of the line.

Each virtual key is described by 6 colon-delimited components:

    0x01: A version code. Must always be 0x01.
    Linux key code: The Linux key code of the virtual key.
    centerX: The X pixel coordinate of the center of the virtual key.
    centerY: The Y pixel coordinate of the center of the virtual key.
    width: The width of the virtual key in pixels.
    height: The height of the virtual key in pixels.

All coordinates and sizes are specified in terms of the display coordinate system.

Here is a virtual key map file all written on one line.

# All on one line
0x01:158:55:835:90:55:0x01:139:172:835:125:55:0x01:102:298:835:115:55:0x01:217:412:835:95:55

The same virtual key map file can also be written on multiple lines.

# One key per line
0x01:158:55:835:90:55
0x01:139:172:835:125:55
0x01:102:298:835:115:55
0x01:217:412:835:95:55

In the above example, the touch screen has a resolution of 480x800. Accordingly, all of the virtual keys have a centerY 
coordinate of 835, which is a little bit below the visible area of the touch screen.

The first key has a Linux scan code of 158 (KEY_BACK), centerX of 55, centerY of 835, width of 90 and height of 55.
Example

Virtual key map file: /sys/board_properties/virtualkeys.touchyfeely.

0x01:158:55:835:90:55
0x01:139:172:835:125:55
0x01:102:298:835:115:55
0x01:217:412:835:95:55

Key layout file: /system/usr/keylayout/touchyfeely.kl.

key 158 BACK
key 139 MENU
key 102 HOME
key 217 SEARCH

Key character map file: /system/usr/keychars/touchyfeely.kcm.

type SPECIAL_FUNCTION


ref:http://www.cnblogs.com/aceheart/archive/2012/10/27/2742309.html
這一篇有說明 kernel driver 怎麼實做這個 virtual key, board_properties ..

2014年1月13日 星期一

use vimdiff to view svn diff --- just like git difftool

因為 git difftool 很好用,所以想 svn diff 是不是也可以用。
所以..
ref : http://blog.tplus1.com/blog/2007/08/29/how-to-use-vimdiff-as-the-subversion-diff-tool/


大概就是: # 寫一個 script invoke vimdiff,並且吃 svn diff 出來的參數。 # 修改 svn config,diff 時 用這個 shell script
script 就是:diffwrap.sh
#!/bin/sh
DIFF="/usr/bin/vimdiff"
LEFT=${6}
RIGHT=${7}
$DIFF $LEFT $RIGHT

把 script 放到 ~/bin/

然後修改 .subversion/config

裡面有一行, un-comment 掉,並且改成:
diff-cmd = /home/charles-chang/bin/diffwrap.sh

這樣,以後下 svn diff 就會用 vimdiff 一一打開 不同的檔案。


.. 但是這個還是跟 git difftool 不一樣。
這樣改,就沒辦法一次 show 出所有的 diff 了 (也就是原來的功能).....

注意事項: subversion 的 config 檔,每個 command 開頭不可以留 space...

其實也可以不用改 .subversion/config。只要在run svn diff 時 指定 diff-cmd tool 就可以:
svn diff --diff-cmd=diffwrap.sh

2014年1月8日 星期三

把 eclipse Android project 放到 Android source 中 build..

基本就是 create 一個 Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := eng

# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := MyTest

#LOCAL_SDK_VERSION := current
LOCAL_CERTIFICATE := platform

LOCAL_JAVA_LIBRARIES := my_sdk

include $(BUILD_PACKAGE)

# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
其中 LOCAL_JAVA_LIBRIES 就是指定你自己有用到,額外 的 jar

之後在 folder 用 mm 應該就能 build



比較嚴格的部份:
  • 引用的 text 都要在 strings.xml 中定義,不能值接寫內容。
有 aidl 的話。
把 aidl 加到 LOCAL_SRC_FILES := $(call all-java-files-under, src)
像:
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
       src/a/b/c/myinterface.aidl
這樣有時候會出現問題,發生 aidl interface class 重複宣告問題。
解法我也不知道 ...

還有 aidl 有些package 要寫明, 例如:Bitmap
就要寫:
import android.graphics.Bitmap;
否則會說 undefined

標籤

網誌存檔