fastmmi 底层cpp产测 分析

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lf12345678910/article/details/53442810

signal()函数理解

在<signal.h> 这个头文件中。

signal(参数1,参数2);

参数1:我们要进行处理的信号。系统的信号我们可以再终端键入 kill -l查看(共64个)。其实这些信号时系统定义的宏。

参数2:我们处理的方式(是系统默认还是忽略还是捕获)。

yanhaiqun@ubuntu-server:~/001-GL40A63$ kill -l
 1) SIGHUP     2) SIGINT     3) SIGQUIT     4) SIGILL     5) SIGTRAP
 6) SIGABRT     7) SIGBUS     8) SIGFPE     9) SIGKILL    10) SIGUSR1
11) SIGSEGV    12) SIGUSR2    13) SIGPIPE    14) SIGALRM    15) SIGTERM
16) SIGSTKFLT    17) SIGCHLD    18) SIGCONT    19) SIGSTOP    20) SIGTSTP
21) SIGTTIN    22) SIGTTOU    23) SIGURG    24) SIGXCPU    25) SIGXFSZ
26) SIGVTALRM    27) SIGPROF    28) SIGWINCH    29) SIGIO    30) SIGPWR
31) SIGSYS    34) SIGRTMIN    35) SIGRTMIN+1    36) SIGRTMIN+2    37) SIGRTMIN+3
38) SIGRTMIN+4    39) SIGRTMIN+5    40) SIGRTMIN+6    41) SIGRTMIN+7    42) SIGRTMIN+8
43) SIGRTMIN+9    44) SIGRTMIN+10    45) SIGRTMIN+11    46) SIGRTMIN+12    47) SIGRTMIN+13
48) SIGRTMIN+14    49) SIGRTMIN+15    50) SIGRTMAX-14    51) SIGRTMAX-13    52) SIGRTMAX-12
53) SIGRTMAX-11    54) SIGRTMAX-10    55) SIGRTMAX-9    56) SIGRTMAX-8    57) SIGRTMAX-7
58) SIGRTMAX-6    59) SIGRTMAX-5    60) SIGRTMAX-4    61) SIGRTMAX-3    62) SIGRTMAX-2
63) SIGRTMAX-1    64) SIGRTMAX

一些常用的Signal 如下:

注:下面是从百度文库中找的(*^__^*) 嘻嘻……

Signal Description
SIGABRT 由调用abort函数产生,进程非正常退出
SIGALRM 用alarm函数设置的timer超时或setitimer函数设置的interval timer超时
SIGBUS 某种特定的硬件异常,通常由内存访问引起
SIGCANCEL 由Solaris Thread Library内部使用,通常不会使用
SIGCHLD 进程Terminate或Stop的时候,SIGCHLD会发送给它的父进程。缺省情况下该Signal会被忽略
SIGCONT 当被stop的进程恢复运行的时候,自动发送
SIGEMT 和实现相关的硬件异常
SIGFPE 数学相关的异常,如被0除,浮点溢出,等等
SIGFREEZE Solaris专用,Hiberate或者Suspended时候发送
SIGHUP 发送给具有Terminal的Controlling Process,当terminal被disconnect时候发送
SIGILL 非法指令异常
SIGINFO BSD signal。由Status Key产生,通常是CTRL+T。发送给所有Foreground Group的进程
SIGINT 由Interrupt Key产生,通常是CTRL+C或者DELETE。发送给所有ForeGround Group的进程
SIGIO 异步IO事件
SIGIOT 实现相关的硬件异常,一般对应SIGABRT
SIGKILL 无法处理和忽略。中止某个进程
SIGLWP 由Solaris Thread Libray内部使用
SIGPIPE 在reader中止之后写Pipe的时候发送
SIGPOLL 当某个事件发送给Pollable Device的时候发送
SIGPROF Setitimer指定的Profiling Interval Timer所产生
SIGPWR 和系统相关。和UPS相关。
SIGQUIT 输入Quit Key的时候(CTRL+\)发送给所有Foreground Group的进程
SIGSEGV 非法内存访问
SIGSTKFLT Linux专用,数学协处理器的栈异常
SIGSTOP 中止进程。无法处理和忽略。
SIGSYS 非法系统调用
SIGTERM 请求中止进程,kill命令缺省发送
SIGTHAW Solaris专用,从Suspend恢复时候发送
SIGTRAP 实现相关的硬件异常。一般是调试异常
SIGTSTP Suspend Key,一般是Ctrl+Z。发送给所有Foreground Group的进程
SIGTTIN 当Background Group的进程尝试读取Terminal的时候发送
SIGTTOU 当Background Group的进程尝试写Terminal的时候发送
SIGURG 当out-of-band data接收的时候可能发送
SIGUSR1 用户自定义signal 1
SIGUSR2 用户自定义signal 2
SIGVTALRM setitimer函数设置的Virtual Interval Timer超时的时候
SIGWAITING Solaris Thread Library内部实现专用
SIGWINCH 当Terminal的窗口大小改变的时候,发送给Foreground Group的所有进程
SIGXCPU 当CPU时间限制超时的时候
SIGXFSZ 进程超过文件大小限制
SIGXRES Solaris专用,进程超过资源限制的时候发送

static全局变量与普通的全局变量有什么区别:static全局变量只初使化一次,防止在其他文件单元中被引用;
static局部变量和普通局部变量有什么区别:static局部变量只被初始化一次,下一次依据上一次结果值;
static函数与普通函数有什么区别:static函数在内存中只有一份,普通函数在每个被调用中维持一份拷贝。

mmi.xml

        <module name="MSENSOR"
                lib_name="mmi_sensor.so"
                enable="0"
                automation="1"
                display_name="msensor"
                layout="layout_msensor.xml"
                parameter="type:magnetic;delay:20;"
                limit="x_min_limit:-1000;x_max_limit:1000;y_min_limit:-1000;y_max_limit:1000;z_min_limit:-1000;z_max_limit:1000;"/>

mmi.cpp

main(){

   pre_config;//path_config_android.xml-->strings_map   ;func_list---> func_map

   init_config;

   build_main_ui;

}

Layout_audio.xml (res\layout):    <include layout="footer.xml"/>
Layout_camera_back.xml (res\layout):   <include layout="footer.xml"/>
Layout_camera_front.xml (res\layout):   <include layout="footer.xml"/>
Layout_cb.xml (res\layout):    <include layout="footer.xml"/>
Layout_common.xml (res\layout):   <include layout="footer.xml"/>
Layout_feedback.xml (res\layout):   <include layout="footer.xml"/>
Layout_gsensor.xml (res\layout):    <include layout="footer.xml"/>
Layout_gyroscope.xml (res\layout):   <include layout="footer.xml"/>
Layout_handset.xml (res\layout):    <include layout="footer.xml"/>
Layout_headset.xml (res\layout):    <include layout="footer.xml"/>
Layout_headset_key.xml (res\layout):    <include layout="footer.xml"/>
Layout_key.xml (res\layout):    <include layout="footer.xml"/>
Layout_lcd.xml (res\layout):   <include layout="footer.xml"/>
Layout_loudearpiece.xml (res\layout):    <include layout="footer.xml"/>
Layout_loudspeaker.xml (res\layout):    <include layout="footer.xml"/>
Layout_lsensor.xml (res\layout):   <include layout="footer.xml"/>
Layout_msensor.xml (res\layout):   <include layout="footer.xml"/>
Layout_primary_mic.xml (res\layout):    <include layout="footer.xml"/>
Layout_psensor.xml (res\layout):    <include layout="footer.xml"/>
Layout_secondary_mic.xml (res\layout):    <include layout="footer.xml"/>

Draw.cpp

init_draw;

listview.cpp

set_items()

fastmmi/res/values/Android.mk

patch_config_android.xml --> /etc/mmi/patch_config.xml (资源配置文件)

fastmmi/res/config/Android.mk

mmi.xml --> /etc/mmi/mmi.xml

Log : /cache/FTM_AP/mmi.log

switch_module : (切换子界面)switch_cur_layout_locked   module_exec_ui  launch_module  launch_module_sensor

build_main_ui : 显示主界面   main.xml

draw_thread: sem_wait(&g_draw.sem); //绘制界面

update_main_status : 更新主界面的测试结果

start_threads: input_waiting_thread         input_handle_thread

                             draw_thread                         server_accepting_thread  

                             msg_waiting_thread          msg_handle_thread

key 测试:

key.cpp

run_test( if(!ev_wait(-1))  ev_dispatch();)

events.cpp

ev_init(){opendir("/dev/input");   "/dev/input/event"}  ev_fdinfo[ev_count].cb = input_cb;   epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev)

ev_wait(epoll_wait(epollfd, polledevents, ev_count, timeout);)

ev_dispatch(){ev_callback(fdi->fd, polledevents[n].events, fdi->data); }

input.cpp

input_callback()-->adjust_ev()--->invoke_listener(g_input_listener->dispatch_event)-->key_callback

input_listener_key.cpp

dispatch_event() --->set_color()

key_down_cb

key_callback

01-01 15:20:27.714   392  1461 I mmi     : mmi, hook_vkey(): Got virtual keycode:158
01-01 15:20:27.714   392  1461 E mmi     : ==============---btn_name =  back
01-01 15:20:27.714   392  1461 E mmi     : ==============---mod= KEY
01-01 15:20:27.714   392  1461 I mmi     : mmi, dispatch_event(): button(back) press down, code=158
01-01 15:20:27.714   392  1461 I mmi     : mmi, key_down_cb(): input key code=158
01-01 15:20:27.714   392  1461 I mmi     : mmi, key_down_cb(): key(key_name=back) test pass

01-01 15:20:25.891   392  1461 I mmi     : mmi, dispatch_event(): button(power) press down, code=116
01-01 15:20:25.891   392  1461 I mmi     : mmi, key_down_cb(): input key code=116
01-01 15:20:25.891   392  1461 I mmi     : mmi, key_down_cb(): key(key_name=power) test pass
01-01 15:20:25.891   392  1461 I mmi     : mmi, key_callback(): key:116 press down

01-01 15:20:26.061   392  1461 E mmi     : ==============---btn_name =  power
01-01 15:20:26.061   392  1461 E mmi     : ==============---mod= KEY
01-01 15:20:26.061   392  1461 I mmi     : [dispatch_event]key:116 release
01-01 15:20:26.061   392  1461 I mmi     : mmi, key_callback(): key:116 release

parse_vkey_map()

/sys/board_properties/virtualkeys.**

/sys/board_properties/virtualkeys.ft5x06_ts

cat virtualkeys.ft5x06_ts
0x01:139:120:1315:240:56
0x01:172:360:1315:240:56
0x01:158:600:1315:240:56

kernel/include/uapi/linux/input.h

#define KEY_HOME        102

#define KEY_HOMEPAGE        172    /* AC Home */

55/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi


&soc {
    i2c@78b9000 { /* BLSP1 QUP5 */
        focaltech@38 {
            compatible = "focaltech,fts";
            reg = <0x38>;
            interrupt-parent = <&msm_gpio>;
            interrupts = <13 0x08>;
            vdd-supply = <&pm8909_l17>;
            vcc_i2c-supply = <&pm8909_l6>;
            focaltech,name = "fts";
            focaltech,family-id = <0x54>;
            focaltech,reset-gpio = <&msm_gpio 12 0x00>;
            focaltech,irq-gpio = <&msm_gpio 13 0x08>;
            focaltech,display-coords = <0 0 720 1280>;
            focaltech,panel-coords = <0 0 720 1400>;
            focaltech,button-map= <158 172 139>;
            focaltech,no-force-update;
            focaltech,i2c-pull-up;
            focaltech,group-id = <1>;

50/kernel/arch/arm/boot/dts/qcom/msm8909-qrd-skua.dtsi

&soc {
    i2c@78b9000 { /* BLSP1 QUP5 */
              focaltech@38{
            compatible = "focaltech,fts";
            reg = <0x38>;
            interrupt-parent = <&msm_gpio>;
            interrupts = <13 0x2008>;
            vdd-supply = <&pm8909_l17>;
            vcc_i2c-supply = <&pm8909_l6>;
            focaltech,name = "ft6x06";
            focaltech,family-id = <0x54>;
            focaltech,reset-gpio = <&msm_gpio 12 0x00>;
            focaltech,irq-gpio = <&msm_gpio 13 0x00>;
            focaltech,display-coords = <0 0 720 1280>;
            focaltech,panel-coords = <0 0 720 1280>;
            focaltech,button-map= <139 102 158>;
            focaltech,no-force-update;
            focaltech,i2c-pull-up;
            focaltech,group-id = <1>;

猜你喜欢

转载自blog.csdn.net/lf12345678910/article/details/53442810