From dec68ac1814d0500e4b7fdc7fe7afdcf0ff5a155 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Tue, 31 Dec 2019 11:17:00 +0800 Subject: [PATCH] cleanup: remove _LITE_VERSION and _STAND_ALONE macros --- Version.md | 9 +- configure.ac | 12 +- {src => obsolete}/ime/CMakeLists.txt | 0 {src => obsolete}/ime/Makefile.am | 0 {src => obsolete}/ime/hzinput.c | 0 {src => obsolete}/ime/hzinput.h | 0 {src => obsolete}/ime/pinyin.c | 0 {src => obsolete}/ime/pinyin.h | 0 {src/include => obsolete}/oldgal.h | 0 {include => obsolete}/vcongui.h | 0 src/ial/2410.c | 51 +- src/ial/2440.c | 50 +- src/ial/abs_signal_driver.c | 804 +++++++++++++-------------- src/ial/abssig.c | 38 +- src/ial/ads.c | 112 ++-- src/ial/ads7846.c | 45 +- src/ial/arm3000.c | 38 +- src/ial/auto.c | 30 +- src/ial/c33l05.c | 64 +-- src/ial/calib.c | 172 +++--- src/ial/cisco_touchpad.c | 71 +-- src/ial/comminput.c | 2 +- src/ial/davinci6446.c | 68 +-- src/ial/dfb.c | 227 ++++---- src/ial/dm270.c | 35 +- src/ial/dmg-stb.c | 42 +- src/ial/em85.c | 270 +++++---- src/ial/em86.c | 269 +++++---- src/ial/em8620.c | 306 +++++----- src/ial/embest2410.c | 36 +- src/ial/embest44b0.c | 37 +- src/ial/ep7211.c | 139 +++-- src/ial/evmv10.c | 46 +- src/ial/fft7202.c | 36 +- src/ial/figueroa.c | 178 +++--- src/ial/fip.c | 29 +- src/ial/fxrm9200.c | 43 +- src/ial/fz_custom.c | 55 +- src/ial/helio.c | 50 +- src/ial/hh2410r3.c | 50 +- src/ial/hh2440.c | 60 +- src/ial/hh5249kbdir.c | 104 ++-- src/ial/hi3510.c | 213 ++++--- src/ial/ial.c | 2 +- src/ial/init_ts.c | 168 +++--- src/ial/ipaq-h3600.c | 41 +- src/ial/ipaq-h5400.c | 49 +- src/ial/jz4740.c | 143 +++-- src/ial/l7200.c | 30 +- src/ial/lide.c | 147 +++-- src/ial/mc68x328.c | 36 +- src/ial/mgsock.c | 18 +- src/ial/mpc823.c | 76 ++- src/ial/mstarial.c | 95 ++-- src/ial/palm2.c | 88 ++- src/ial/pcxvfbial.c | 126 ++--- src/ial/ps2-conv.c | 24 +- src/ial/px255b.c | 76 ++- src/ial/qemu.c | 218 ++++---- src/ial/qvfb.c | 24 +- src/ial/rtos_xvfb.c | 46 +- src/ial/skyeye-ep7312.c | 42 +- src/ial/svgalib.c | 24 +- src/ial/svpxx.c | 24 +- src/ial/t800.c | 47 +- src/ial/tf-stb.c | 741 ++++++++++++------------ src/ial/thor.c | 167 +++--- src/ial/tslibial.c | 26 +- src/ial/ucb1x00.c | 111 ++-- src/ial/usvfbinput.c | 20 +- src/ial/utpmc.c | 50 +- src/ial/vp2008.c | 653 +++++++++++----------- src/ial/vr4181.c | 57 +- src/ial/vxi386_input.c | 172 +++--- src/ial/vxppc_input.c | 160 +++--- src/ial/winial.c | 58 +- src/ial/wvfbial.c | 24 +- 77 files changed, 3519 insertions(+), 4055 deletions(-) rename {src => obsolete}/ime/CMakeLists.txt (100%) rename {src => obsolete}/ime/Makefile.am (100%) rename {src => obsolete}/ime/hzinput.c (100%) rename {src => obsolete}/ime/hzinput.h (100%) rename {src => obsolete}/ime/pinyin.c (100%) rename {src => obsolete}/ime/pinyin.h (100%) rename {src/include => obsolete}/oldgal.h (100%) rename {include => obsolete}/vcongui.h (100%) diff --git a/Version.md b/Version.md index 5b969dca..d8cf4557 100644 --- a/Version.md +++ b/Version.md @@ -1,8 +1,9 @@ -Version 4.0.4 (2019/12/24) +Version 4.1.0 (2019/01/22) -This release needs the following packages: +This is a developing version, an unstable version. +It needs the following packages: - The resource package: `minigui-res-4.0.0.tar.gz` -- The sample package: `mg-samples-4.0.1.tar.gz` -- The test cases package: `mg-tests-4.0.4.tar.gz` +- The test cases package: `mg-tests-4.1.0.tar.gz` +- The sample package: `mg-samples-4.1.0.tar.gz` diff --git a/configure.ac b/configure.ac index 442297fe..46938275 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.60) -AC_INIT(libminigui, 4.0.4) +AC_INIT(libminigui, 4.1.0) AC_CONFIG_SRCDIR(src/main/main.c) dnl Set various version strings - taken gratefully from the SDL sources @@ -15,8 +15,8 @@ dnl Set various version strings - taken gratefully from the SDL sources # set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0. # MINIGUI_MAJOR_VERSION=4 -MINIGUI_MINOR_VERSION=0 -MINIGUI_MICRO_VERSION=4 +MINIGUI_MINOR_VERSION=1 +MINIGUI_MICRO_VERSION=0 MINIGUI_INTERFACE_AGE=0 MINIGUI_BINARY_AGE=0 MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION @@ -1707,10 +1707,6 @@ case "$runtime_mode" in sa) AC_DEFINE(_MGRM_STANDALONE, 1, [Define if build MiniGUI-Standalone]) - AC_DEFINE(_STAND_ALONE, 1, - [Define if build MiniGUI-Standalone (back-compatibility definition)]) - AC_DEFINE(_LITE_VERSION, 1, - [Define if build MiniGUI-Standalone (back-compatibility definition)]) MINIGUI_RUNMODE="sa" ;; ths) @@ -1722,8 +1718,6 @@ case "$runtime_mode" in *) AC_DEFINE(_MGRM_PROCESSES, 1, [Define if build MiniGUI-Processes]) - AC_DEFINE(_LITE_VERSION, 1, - [Define if build MiniGUI-Processes (back-compatibility definition)]) MINIGUI_RUNMODE="procs" ;; esac diff --git a/src/ime/CMakeLists.txt b/obsolete/ime/CMakeLists.txt similarity index 100% rename from src/ime/CMakeLists.txt rename to obsolete/ime/CMakeLists.txt diff --git a/src/ime/Makefile.am b/obsolete/ime/Makefile.am similarity index 100% rename from src/ime/Makefile.am rename to obsolete/ime/Makefile.am diff --git a/src/ime/hzinput.c b/obsolete/ime/hzinput.c similarity index 100% rename from src/ime/hzinput.c rename to obsolete/ime/hzinput.c diff --git a/src/ime/hzinput.h b/obsolete/ime/hzinput.h similarity index 100% rename from src/ime/hzinput.h rename to obsolete/ime/hzinput.h diff --git a/src/ime/pinyin.c b/obsolete/ime/pinyin.c similarity index 100% rename from src/ime/pinyin.c rename to obsolete/ime/pinyin.c diff --git a/src/ime/pinyin.h b/obsolete/ime/pinyin.h similarity index 100% rename from src/ime/pinyin.h rename to obsolete/ime/pinyin.h diff --git a/src/include/oldgal.h b/obsolete/oldgal.h similarity index 100% rename from src/include/oldgal.h rename to obsolete/oldgal.h diff --git a/include/vcongui.h b/obsolete/vcongui.h similarity index 100% rename from include/vcongui.h rename to obsolete/vcongui.h diff --git a/src/ial/2410.c b/src/ial/2410.c index 1246ee61..a2cf476b 100644 --- a/src/ial/2410.c +++ b/src/ial/2410.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -111,13 +111,8 @@ static int mouse_getbutton(void) return ts_event.pressure; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -130,29 +125,23 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { - int rs; + int rs; FD_CLR (ts, in); ts_event.x=0; ts_event.y=0; printf ("begin to read\n"); - rs = read (ts, &ts_event, sizeof (TS_EVENT)); - printf ("rs = %d\n", rs); - if (rs != sizeof(TS_EVENT)) - return -1; - + rs = read (ts, &ts_event, sizeof (TS_EVENT)); + printf ("rs = %d\n", rs); + if (rs != sizeof(TS_EVENT)) + return -1; + if (ts_event.pressure > 0) { mousex = ts_event.x; mousey = ts_event.y; @@ -167,7 +156,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, retvalue |= IAL_MOUSEEVENT; } - } + } else if (e < 0) { return -1; } @@ -196,14 +185,14 @@ BOOL Init2410Input (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; ts_event.x = ts_event.y = ts_event.pressure = 0; - + return TRUE; } -void Term2410Input(void) +void Term2410Input(void) { if (ts >= 0) - close(ts); + close(ts); } #endif /* _SMDK2410_IAL */ diff --git a/src/ial/2440.c b/src/ial/2440.c index 52abdc5d..2ac99b3f 100644 --- a/src/ial/2440.c +++ b/src/ial/2440.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -110,13 +110,8 @@ static int mouse_getbutton(void) return ts_event.pressure; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -129,28 +124,21 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { - int rs; + int rs; FD_CLR (ts, in); ts_event.x=0; ts_event.y=0; - rs = read (ts, &ts_event, sizeof (TS_EVENT)); - //rs = read (ts, &ts_event, sizeof (TS_EVENT)); - if (rs != sizeof(TS_EVENT)) - return -1; - + rs = read (ts, &ts_event, sizeof (TS_EVENT)); + if (rs != sizeof(TS_EVENT)) + return -1; + if (ts_event.pressure > 0) { mousex = ts_event.x; mousey = ts_event.y; @@ -164,7 +152,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, retvalue |= IAL_MOUSEEVENT; } - } + } else if (e < 0) { return -1; } @@ -191,14 +179,14 @@ BOOL Init2440Input (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; ts_event.x = ts_event.y = ts_event.pressure = 0; - + return TRUE; } -void Term2440Input(void) +void Term2440Input(void) { if (ts >= 0) - close(ts); + close(ts); } #endif /* _SMDK2410_IAL */ diff --git a/src/ial/abs_signal_driver.c b/src/ial/abs_signal_driver.c index 3e53d4fa..f1fef259 100644 --- a/src/ial/abs_signal_driver.c +++ b/src/ial/abs_signal_driver.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** abs_signal_driver.c: this is the process file of abs signal driver module ** -** Author: zangguangtong +** Author: zangguangtong */ #include @@ -67,162 +67,162 @@ int __mg_g_abssig_debug_mode = 0; int __mg_g_abssig_fd = ABSSIG_INVALID_FD; int ABSSIG_open_tel_device (ABS_SIG_INFO *asi) -{ +{ #ifndef SIGNAL_SOCKET_TEST - - if (NULL == asi) - { - return ABSSIG_FAIL; - } - - asi->dev_fd = ABSSIG_INVALID_FD; - switch(asi->dev_type) - { - case UD_DSP_1: - { - int socket_val; - char name[20]; - - sprintf(name, "/dev/tel"); - socket_val = open(name,O_RDWR); - if(socket_val == ABSSIG_INVALID_FD) - { - DBGABSSIG_ERR(("Can't open tel device in ABSSIG_open_tel_device!\n")); - asi->dev_fd = ABSSIG_INVALID_FD; - return ABSSIG_INVALID_FD; - } - - __mg_g_abssig_fd = asi->dev_fd = socket_val; + if (NULL == asi) + { + return ABSSIG_FAIL; + } + + asi->dev_fd = ABSSIG_INVALID_FD; + + switch(asi->dev_type) + { + case UD_DSP_1: + { + int socket_val; + char name[20]; + + sprintf(name, "/dev/tel"); + socket_val = open(name,O_RDWR); + if(socket_val == ABSSIG_INVALID_FD) + { + DBGABSSIG_ERR(("Can't open tel device in ABSSIG_open_tel_device!\n")); + asi->dev_fd = ABSSIG_INVALID_FD; + return ABSSIG_INVALID_FD; + } + + __mg_g_abssig_fd = asi->dev_fd = socket_val; fprintf(stderr, "opened dev_fd %d\n", socket_val); - return ABSSIG_SUCCESS; - } - default: - return ABSSIG_FAIL; - } + return ABSSIG_SUCCESS; + } + default: + return ABSSIG_FAIL; + } #else - int test_socket; - struct sockaddr_in sin; - int tos; - int opt; - int len; + int test_socket; + struct sockaddr_in sin; + int tos; + int opt; + int len; - int socket_val; - char name[20]; - sprintf(name, "/dev/tel"); - socket_val = open(name,O_RDWR); - if(socket_val == ABSSIG_INVALID_FD) - { - DBGABSSIG_ERR(("Can't open tel device in ABSSIG_open_tel_device!\n")); - return ABSSIG_INVALID_FD; - } + int socket_val; + char name[20]; + sprintf(name, "/dev/tel"); + socket_val = open(name,O_RDWR); + if(socket_val == ABSSIG_INVALID_FD) + { + DBGABSSIG_ERR(("Can't open tel device in ABSSIG_open_tel_device!\n")); + return ABSSIG_INVALID_FD; + } - test_socket = socket(AF_INET, SOCK_DGRAM, 0); - if (test_socket == -1) - { - DBGABSSIG_ERR(("UDP socket open failed!")); - return -1; - } + test_socket = socket(AF_INET, SOCK_DGRAM, 0); + if (test_socket == -1) + { + DBGABSSIG_ERR(("UDP socket open failed!")); + return -1; + } - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = htonl(INADDR_ANY); - sin.sin_port = htons(1556); - if (bind(test_socket, (struct sockaddr *)&sin, sizeof(sin)) == -1) - { - DBGABSSIG_ERR(("UDP(%d) socket bind failed!\n")); - close(test_socket); - return -1; - } - /* - opt = 1; - len = sizeof(opt); - setsockopt(test_socket,SOL_SOCKET,SO_REUSEADDR,&opt,&len); - if (fcntl(test_socket, F_SETFL, O_NONBLOCK) == -1) - { - DBGABSSIG_ERR(("fcntl fail!\n")); - close(test_socket); - return -1; - } - */ - - __mg_g_abssig_fd = test_socket; - return test_socket; + bzero(&sin, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = htonl(INADDR_ANY); + sin.sin_port = htons(1556); + if (bind(test_socket, (struct sockaddr *)&sin, sizeof(sin)) == -1) + { + DBGABSSIG_ERR(("UDP(%d) socket bind failed!\n")); + close(test_socket); + return -1; + } + /* + opt = 1; + len = sizeof(opt); + setsockopt(test_socket,SOL_SOCKET,SO_REUSEADDR,&opt,&len); + if (fcntl(test_socket, F_SETFL, O_NONBLOCK) == -1) + { + DBGABSSIG_ERR(("fcntl fail!\n")); + close(test_socket); + return -1; + } + */ + + __mg_g_abssig_fd = test_socket; + return test_socket; #endif } int ABSSIG_close_tel_device (ABS_SIG_INFO *asi) { - if (NULL == asi) - { - return ABSSIG_FAIL; - } - - switch(asi->dev_type) - { - case UD_DSP_1: - { - close(asi->dev_fd); - __mg_g_abssig_fd = ABSSIG_INVALID_FD; - asi->dev_fd = ABSSIG_INVALID_FD; - } - break; - default: - return ABSSIG_FAIL; - } - /* - if(fd != __mg_g_abssig_fd) - { - DBGABSSIG_ERR(("Input fd is wrong in ABSSIG_close_tel_device!Input fd is %d and fd of tel device is %d \n",fd,__mg_g_abssig_fd)); - return ABSSIG_FAIL; - } - close(fd); - __mg_g_abssig_fd = ABSSIG_INVALID_FD; - */ - return ABSSIG_SUCCESS; + if (NULL == asi) + { + return ABSSIG_FAIL; + } + + switch(asi->dev_type) + { + case UD_DSP_1: + { + close(asi->dev_fd); + __mg_g_abssig_fd = ABSSIG_INVALID_FD; + asi->dev_fd = ABSSIG_INVALID_FD; + } + break; + default: + return ABSSIG_FAIL; + } + /* + if(fd != __mg_g_abssig_fd) + { + DBGABSSIG_ERR(("Input fd is wrong in ABSSIG_close_tel_device!Input fd is %d and fd of tel device is %d \n",fd,__mg_g_abssig_fd)); + return ABSSIG_FAIL; + } + close(fd); + __mg_g_abssig_fd = ABSSIG_INVALID_FD; + */ + return ABSSIG_SUCCESS; } int ABSSIG_receive_msg_from_driver(ABS_SIG_INFO *asi) { #ifndef SIGNAL_SOCKET_TEST - int translate_result = ABSSIG_FAIL; - if (NULL == asi) - { - return ABSSIG_FAIL; - } - - switch(asi->dev_type) - { - case UD_DSP_1: - { - telesignal_msg tel_msg; + int translate_result = ABSSIG_FAIL; + if (NULL == asi) + { + return ABSSIG_FAIL; + } - if(asi->dev_fd == ABSSIG_INVALID_FD) - { - DBGABSSIG_ERR(("FD of tel device is invalid in ABSSIG_receive_msg_from_driver!\n")); - return ABSSIG_FAIL; - } + switch(asi->dev_type) + { + case UD_DSP_1: + { + telesignal_msg tel_msg; - read(__mg_g_abssig_fd,&tel_msg,sizeof(tel_msg)); - translate_result = ABSSIG_translate_msg_from_driver_to_app(&tel_msg, asi); - } - break; - default: - break; - } - return translate_result; -#else - struct sockaddr from; - socklen_t len; - telesignal_msg tel_msg; - int translate_result; - - recvfrom(__mg_g_abssig_fd, &tel_msg, sizeof(telesignal_msg), 0, &from, &len); - tel_msg.type = ntohl(tel_msg.type); - translate_result = ABSSIG_translate_msg_from_driver_to_app(&tel_msg); - return translate_result; + if(asi->dev_fd == ABSSIG_INVALID_FD) + { + DBGABSSIG_ERR(("FD of tel device is invalid in ABSSIG_receive_msg_from_driver!\n")); + return ABSSIG_FAIL; + } + + read(__mg_g_abssig_fd,&tel_msg,sizeof(tel_msg)); + translate_result = ABSSIG_translate_msg_from_driver_to_app(&tel_msg, asi); + } + break; + default: + break; + } + return translate_result; +#else + struct sockaddr from; + socklen_t len; + telesignal_msg tel_msg; + int translate_result; + + recvfrom(__mg_g_abssig_fd, &tel_msg, sizeof(telesignal_msg), 0, &from, &len); + tel_msg.type = ntohl(tel_msg.type); + translate_result = ABSSIG_translate_msg_from_driver_to_app(&tel_msg); + return translate_result; #endif } @@ -232,298 +232,298 @@ int ABSSIG_send_msg_to_driver (ABS_SIG_INFO *asi) { #ifndef SIGNAL_SOCKET_TEST - if (NULL == asi) - { - return ABSSIG_FAIL; - } + if (NULL == asi) + { + return ABSSIG_FAIL; + } - switch(asi->dev_type) - { - case UD_DSP_1: - { - telesignal_msg tel_msg; - int translate_result; + switch(asi->dev_type) + { + case UD_DSP_1: + { + telesignal_msg tel_msg; + int translate_result; - if(asi->dev_fd == ABSSIG_INVALID_FD) - { - DBGABSSIG_ERR(("FD of tel device is invalid in ABSSIG_send_msg_to_driver!\n")); - return ABSSIG_FAIL; - } + if(asi->dev_fd == ABSSIG_INVALID_FD) + { + DBGABSSIG_ERR(("FD of tel device is invalid in ABSSIG_send_msg_to_driver!\n")); + return ABSSIG_FAIL; + } - translate_result = ABSSIG_translate_msg_from_app_to_driver(&tel_msg, asi); - if(translate_result == ABSSIG_FAIL) - { - DBGABSSIG_ERR(("Fails when translate the message from application,so can't send message to driver in ABSSIG_send_msg_to_driver! \n")); - return ABSSIG_FAIL; - } - write(asi->dev_fd, &tel_msg, sizeof(tel_msg)); - } - break; - default: - return ABSSIG_FAIL; - } - return ABSSIG_SUCCESS; + translate_result = ABSSIG_translate_msg_from_app_to_driver(&tel_msg, asi); + if(translate_result == ABSSIG_FAIL) + { + DBGABSSIG_ERR(("Fails when translate the message from application,so can't send message to driver in ABSSIG_send_msg_to_driver! \n")); + return ABSSIG_FAIL; + } + write(asi->dev_fd, &tel_msg, sizeof(tel_msg)); + } + break; + default: + return ABSSIG_FAIL; + } + return ABSSIG_SUCCESS; #else - char message_type[256]; + char message_type[256]; - switch(abssig_signal_msg->msg_type) - { - case SIGNAL_SIG2DRV_SWITCH_PSTN: - strcpy(message_type,"switch to PSTN"); - break; - case SIGNAL_SIG2DRV_SWITCH_VOIP: - strcpy(message_type,"switch to VOIP"); - break; - case SIGNAL_SIG2DRV_DIAL_TONE: - strcpy(message_type,"play dial tone"); - break; - case SIGNAL_SIG2DRV_DIAL_TONE_STOP: - strcpy(message_type,"stop dial tone"); - break; - case SIGNAL_SIG2DRV_CALLBACK_TONE: - strcpy(message_type,"play callback tone"); - break; - case SIGNAL_SIG2DRV_CALLBACK_TONE_STOP: - strcpy(message_type,"stop callback tone"); - break; - case SIGNAL_SIG2DRV_BUSY_TONE: - strcpy(message_type,"play busy tone"); - break; - case SIGNAL_SIG2DRV_BUSY_TONE_STOP: - strcpy(message_type,"stop busy tone"); - break; - case SIGNAL_SIG2DRV_BLARE_TONE: - strcpy(message_type,"play blare tone"); - break; - case SIGNAL_SIG2DRV_BLARE_TONE_STOP: - strcpy(message_type,"stop blare tone"); - break; - case SIGNAL_SIG2DRV_START_RING: - strcpy(message_type,"start ring"); - break; - case SIGNAL_SIG2DRV_STOP_RING: - strcpy(message_type,"stop ring"); - break; - case SIGNAL_SIG2DRV_PSTN_OFFHOOK: - strcpy(message_type,"notify PSTN OFFHOOK"); - break; - case SIGNAL_SIG2DRV_PSTN_DTMF: - strcpy(message_type,"notify PSTN DTMF"); - break; - default: - strcpy(message_type,"wrong message type"); - break; - } - DBGABSSIG_INFO(("\nReceived message is %s in ABSSIG_send_msg_to_driver!",message_type)); - DBGABSSIG_INFO(("\nLine number is %d in ABSSIG_send_msg_to_driver! \n",abssig_signal_msg->line_num)); - return ABSSIG_SUCCESS; + switch(abssig_signal_msg->msg_type) + { + case SIGNAL_SIG2DRV_SWITCH_PSTN: + strcpy(message_type,"switch to PSTN"); + break; + case SIGNAL_SIG2DRV_SWITCH_VOIP: + strcpy(message_type,"switch to VOIP"); + break; + case SIGNAL_SIG2DRV_DIAL_TONE: + strcpy(message_type,"play dial tone"); + break; + case SIGNAL_SIG2DRV_DIAL_TONE_STOP: + strcpy(message_type,"stop dial tone"); + break; + case SIGNAL_SIG2DRV_CALLBACK_TONE: + strcpy(message_type,"play callback tone"); + break; + case SIGNAL_SIG2DRV_CALLBACK_TONE_STOP: + strcpy(message_type,"stop callback tone"); + break; + case SIGNAL_SIG2DRV_BUSY_TONE: + strcpy(message_type,"play busy tone"); + break; + case SIGNAL_SIG2DRV_BUSY_TONE_STOP: + strcpy(message_type,"stop busy tone"); + break; + case SIGNAL_SIG2DRV_BLARE_TONE: + strcpy(message_type,"play blare tone"); + break; + case SIGNAL_SIG2DRV_BLARE_TONE_STOP: + strcpy(message_type,"stop blare tone"); + break; + case SIGNAL_SIG2DRV_START_RING: + strcpy(message_type,"start ring"); + break; + case SIGNAL_SIG2DRV_STOP_RING: + strcpy(message_type,"stop ring"); + break; + case SIGNAL_SIG2DRV_PSTN_OFFHOOK: + strcpy(message_type,"notify PSTN OFFHOOK"); + break; + case SIGNAL_SIG2DRV_PSTN_DTMF: + strcpy(message_type,"notify PSTN DTMF"); + break; + default: + strcpy(message_type,"wrong message type"); + break; + } + DBGABSSIG_INFO(("\nReceived message is %s in ABSSIG_send_msg_to_driver!",message_type)); + DBGABSSIG_INFO(("\nLine number is %d in ABSSIG_send_msg_to_driver! \n",abssig_signal_msg->line_num)); + return ABSSIG_SUCCESS; #endif } int ABSSIG_translate_msg_from_driver_to_app(void *pmsg, ABS_SIG_INFO *asi) { - if (NULL == asi) - { - return ABSSIG_FAIL; - } - if(NULL == pmsg) - { - DBGABSSIG_ERR(("tel message is NULL in ABSSIG_translate_msg_from_driver_to_app!\n")); - return ABSSIG_FAIL; - } - - switch(asi->dev_type) - { - case UD_DSP_1: - { - telesignal_msg *tel_msg = (telesignal_msg *)pmsg; - switch(tel_msg->type) - { - case TELE_SIGNAL_DRV2TSK_OFFHOOK: - asi->dev_msg = TEL_RMSG_OFFHOOK; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_ONHOOK: - asi->dev_msg = TEL_RMSG_ONHOOK; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_DTMF: - asi->dev_msg = tel_msg->message.dtmf_data.phonenum[0]; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_PSTN_DIAL_TONE: - asi->dev_msg = TEL_RMSG_INVALID; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_PSTN_RING_START: - asi->dev_msg = TEL_RMSG_INVALID; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_PSTN_RING_STOP: - asi->dev_msg = TEL_RMSG_INVALID; - asi->dev_id = tel_msg->message.control_data.linenum; - break; + if (NULL == asi) + { + return ABSSIG_FAIL; + } + if(NULL == pmsg) + { + DBGABSSIG_ERR(("tel message is NULL in ABSSIG_translate_msg_from_driver_to_app!\n")); + return ABSSIG_FAIL; + } - case TELE_SIGNAL_DRV2TSK_RINGBACK: - asi->dev_msg = TEL_RMSG_INVALID; - asi->dev_id = tel_msg->message.control_data.linenum; - break; - - case TELE_SIGNAL_DRV2TSK_VOICE_DATA: - asi->dev_msg = TEL_RMSG_INVALID; - asi->dev_id = tel_msg->message.control_data.linenum; - return ABSSIG_FAIL; - - default: - return ABSSIG_FAIL; - } - } - break; - default: - return ABSSIG_FAIL; - } - return ABSSIG_SUCCESS; + switch(asi->dev_type) + { + case UD_DSP_1: + { + telesignal_msg *tel_msg = (telesignal_msg *)pmsg; + switch(tel_msg->type) + { + case TELE_SIGNAL_DRV2TSK_OFFHOOK: + asi->dev_msg = TEL_RMSG_OFFHOOK; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_ONHOOK: + asi->dev_msg = TEL_RMSG_ONHOOK; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_DTMF: + asi->dev_msg = tel_msg->message.dtmf_data.phonenum[0]; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_PSTN_DIAL_TONE: + asi->dev_msg = TEL_RMSG_INVALID; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_PSTN_RING_START: + asi->dev_msg = TEL_RMSG_INVALID; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_PSTN_RING_STOP: + asi->dev_msg = TEL_RMSG_INVALID; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_RINGBACK: + asi->dev_msg = TEL_RMSG_INVALID; + asi->dev_id = tel_msg->message.control_data.linenum; + break; + + case TELE_SIGNAL_DRV2TSK_VOICE_DATA: + asi->dev_msg = TEL_RMSG_INVALID; + asi->dev_id = tel_msg->message.control_data.linenum; + return ABSSIG_FAIL; + + default: + return ABSSIG_FAIL; + } + } + break; + default: + return ABSSIG_FAIL; + } + return ABSSIG_SUCCESS; } int ABSSIG_translate_msg_from_app_to_driver(void *pmsg, ABS_SIG_INFO *asi) { - if (NULL == asi) - { - return ABSSIG_FAIL; - } - if (NULL == pmsg) - { - DBGABSSIG_ERR(("tel message is NULL in ABSSIG_translate_msg_from_app_to_driver!\n")); - return ABSSIG_FAIL; - } + if (NULL == asi) + { + return ABSSIG_FAIL; + } + if (NULL == pmsg) + { + DBGABSSIG_ERR(("tel message is NULL in ABSSIG_translate_msg_from_app_to_driver!\n")); + return ABSSIG_FAIL; + } - switch (asi->dev_type) - { - case UD_DSP_1: - { - telesignal_msg *tel_msg = (telesignal_msg *)pmsg; - - switch(asi->dev_msg) - { - case TEL_SMSG_SWITCH_PSTN: - tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_PSTN; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + switch (asi->dev_type) + { + case UD_DSP_1: + { + telesignal_msg *tel_msg = (telesignal_msg *)pmsg; - case TEL_SMSG_SWITCH_VOIP: - tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_VOIP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + switch(asi->dev_msg) + { + case TEL_SMSG_SWITCH_PSTN: + tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_PSTN; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_DIAL_TONE: - tel_msg->type = TELE_SIGNAL_TSK2DRV_DIAL_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_DIAL_TONE_STOP: - tel_msg->type = TELE_SIGNAL_TSK2DRV_DIAL_TONE_STOP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_SWITCH_VOIP: + tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_VOIP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_CALLBACK_TONE: - tel_msg->type = TELE_SIGNAL_TSK2DRV_OTHERRING_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_DIAL_TONE: + tel_msg->type = TELE_SIGNAL_TSK2DRV_DIAL_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_DIAL_TONE_STOP: + tel_msg->type = TELE_SIGNAL_TSK2DRV_DIAL_TONE_STOP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_CALLBACK_TONE_STOP: - tel_msg->type = TELE_SIGNAL_TSK2DRV_OTHERRING_TONE_STOP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_CALLBACK_TONE: + tel_msg->type = TELE_SIGNAL_TSK2DRV_OTHERRING_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_BUSY_TONE: - tel_msg->type = TELE_SIGNAL_TSK2DRV_BUSY_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_CALLBACK_TONE_STOP: + tel_msg->type = TELE_SIGNAL_TSK2DRV_OTHERRING_TONE_STOP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_BUSY_TONE_STOP: - tel_msg->type = TELE_SIGNAL_TSK2DRV_BUSY_TONE_STOP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_BUSY_TONE: + tel_msg->type = TELE_SIGNAL_TSK2DRV_BUSY_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_BLARE_TONE: - tel_msg->type = TELE_SIGNAL_TSK2DRV_BLARE_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_BLARE_TONE_STOP: - tel_msg->type = TELE_SIGNAL_TSK2DRV_BLARE_TONE_STOP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_BUSY_TONE_STOP: + tel_msg->type = TELE_SIGNAL_TSK2DRV_BUSY_TONE_STOP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_START_RING: - tel_msg->type = TELE_SIGNAL_TSK2DRV_RING_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_BLARE_TONE: + tel_msg->type = TELE_SIGNAL_TSK2DRV_BLARE_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_BLARE_TONE_STOP: + tel_msg->type = TELE_SIGNAL_TSK2DRV_BLARE_TONE_STOP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_STOP_RING: - tel_msg->type = TELE_SIGNAL_TSK2DRV_RING_TONE_STOP; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_START_RING: + tel_msg->type = TELE_SIGNAL_TSK2DRV_RING_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_PSTN_OFFHOOK: - tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_OFFHOOK; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_STOP_RING: + tel_msg->type = TELE_SIGNAL_TSK2DRV_RING_TONE_STOP; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_PSTN_DTMF: - tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_DTMF; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_PSTN_OFFHOOK: + tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_OFFHOOK; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - case TEL_SMSG_PSTN_ENDCALL: - tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_ENDCALL; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_PSTN_DTMF: + tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_DTMF; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + + case TEL_SMSG_PSTN_ENDCALL: + tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_ENDCALL; + tel_msg->message.control_data.linenum = asi->dev_id; + break; #if 0 - case TEL_SMSG_PSTN_TALK: - tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_TALK; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_PSTN_TALK: + tel_msg->type = TELE_SIGNAL_TSK2DRV_PSTN_TALK; + tel_msg->message.control_data.linenum = asi->dev_id; + break; #endif - case TEL_SMSG_SWITCH_HANDSET: - tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_HANDSET; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_SWITCH_SPEAKER: - tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_SPEAKER; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_KEY_TONE: - tel_msg->type = TELE_SIGNAL_TSK2DRV_KEY_TONE; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_KEY_VOLINC: - tel_msg->type = TELE_SIGNAL_TSK2DRV_VOL_INC; - tel_msg->message.control_data.linenum = asi->dev_id; - break; - case TEL_SMSG_KEY_VOLDEC: - tel_msg->type = TELE_SIGNAL_TSK2DRV_VOL_DEC; - tel_msg->message.control_data.linenum = asi->dev_id; - break; + case TEL_SMSG_SWITCH_HANDSET: + tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_HANDSET; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_SWITCH_SPEAKER: + tel_msg->type = TELE_SIGNAL_TSK2DRV_SWITCH_SPEAKER; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_KEY_TONE: + tel_msg->type = TELE_SIGNAL_TSK2DRV_KEY_TONE; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_KEY_VOLINC: + tel_msg->type = TELE_SIGNAL_TSK2DRV_VOL_INC; + tel_msg->message.control_data.linenum = asi->dev_id; + break; + case TEL_SMSG_KEY_VOLDEC: + tel_msg->type = TELE_SIGNAL_TSK2DRV_VOL_DEC; + tel_msg->message.control_data.linenum = asi->dev_id; + break; - default: - DBGABSSIG_ERR(("The type of message from signal module is wrong in ABSSIG_translate_msg_from_app_to_driver!message type is %d \n",asi->dev_msg)); - return ABSSIG_FAIL; + default: + DBGABSSIG_ERR(("The type of message from signal module is wrong in ABSSIG_translate_msg_from_app_to_driver!message type is %d \n",asi->dev_msg)); + return ABSSIG_FAIL; - } - } - break; - - default : - return ABSSIG_FAIL; - } - return ABSSIG_SUCCESS; + } + } + break; + + default : + return ABSSIG_FAIL; + } + return ABSSIG_SUCCESS; } diff --git a/src/ial/abssig.c b/src/ial/abssig.c index 486b475e..85e1f30d 100644 --- a/src/ial/abssig.c +++ b/src/ial/abssig.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** abssig.c: Low Level Input Engine for frv-uclinux ABSSIG. -** +** ** Created by Peng Ke, 2004/12/20 */ @@ -257,15 +257,9 @@ keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event(int which, int maxfd, fd_set * in, fd_set * out, fd_set * except, struct timeval *timeout) -#else -static int -wait_event(int which, fd_set * in, fd_set * out, fd_set * except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -280,18 +274,11 @@ wait_event(int which, fd_set * in, fd_set * out, fd_set * except, if ((which & IAL_KEYEVENT) && asi.dev_fd >= 0) { FD_SET(asi.dev_fd, in); -#ifdef _LITE_VERSION if (asi.dev_fd > maxfd) maxfd = asi.dev_fd; -#endif } -#ifdef _LITE_VERSION e = select(maxfd + 1, in, out, except, timeout); -#else - e = select(FD_SETSIZE, in, out, except, timeout); -#endif - if (cur_ir_scancode != -1) { retvalue |= IAL_KEYEVENT; @@ -316,11 +303,12 @@ wait_event(int which, fd_set * in, fd_set * out, fd_set * except, return retvalue; } -void +static void get_mouse_xy(int *x, int *y) { } -int + +static int get_mouse_button(void) { return 0; diff --git a/src/ial/ads.c b/src/ial/ads.c index a6197b0f..f36d4873 100644 --- a/src/ial/ads.c +++ b/src/ial/ads.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ads.c: Low Level Input Engine for ADS Graphics Client. -** +** ** Created by Wei Yongming, 2000/08/24 ** ** After some hard work, this engine now runs well. @@ -81,89 +81,89 @@ static POS pos; */ static int mouse_update(void) { - return 1; + return 1; } static void mouse_getxy(int* x, int* y) { - *x = mousex; - *y = mousey; + *x = mousex; + *y = mousey; } static int mouse_getbutton(void) { - return pos.b; + return pos.b; } static int keyboard_update(void) { - return 0; + return 0; } static const char * keyboard_getstate(void) { - return NULL; + return NULL; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { - fd_set rfds; - int e; + fd_set rfds; + int e; if (!in) { in = &rfds; FD_ZERO (in); } - if (which & IAL_MOUSEEVENT) { - FD_SET (ts, in); + if (which & IAL_MOUSEEVENT) { + FD_SET (ts, in); if (ts > maxfd) maxfd = ts; - } + } - e = select (maxfd + 1, in, out, except, timeout) ; + e = select (maxfd + 1, in, out, except, timeout) ; - if (e > 0) { - if (ts >= 0 && FD_ISSET (ts, in)) - { + if (e > 0) { + if (ts >= 0 && FD_ISSET (ts, in)) + { FD_CLR (ts, in); - read (ts, &pos, sizeof (POS)); - if ( pos.x !=-1 && pos.y !=-1) { - mousex = pos.x; - mousey = pos.y; - } - pos.b = ( pos.b > 0 ? IAL_MOUSE_LEFTBUTTON:0); - return IAL_MOUSEEVENT; - } + read (ts, &pos, sizeof (POS)); + if ( pos.x !=-1 && pos.y !=-1) { + mousex = pos.x; + mousey = pos.y; + } + pos.b = ( pos.b > 0 ? IAL_MOUSE_LEFTBUTTON:0); + return IAL_MOUSEEVENT; + } - } else if (e < 0) { - return -1; - } - return 0; + } else if (e < 0) { + return -1; + } + return 0; } -#else + +#if 0 static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { - struct pollfd ufd; - if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT) - { - ufd.fd = ts; - ufd.events = POLLIN; - if ( poll (&ufd, 1, timeout->tv_usec) > 0) - { - read (ts, &pos, sizeof(POS)); - return IAL_MOUSEEVENT; - } - } - return 0; + struct pollfd ufd; + if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT) + { + ufd.fd = ts; + ufd.events = POLLIN; + if ( poll (&ufd, 1, timeout->tv_usec) > 0) + { + read (ts, &pos, sizeof(POS)); + return IAL_MOUSEEVENT; + } + } + return 0; } #endif BOOL InitADSInput (INPUT* input, const char* mdev, const char* mtype) { - ts = open ("/dev/ts", O_RDONLY); + ts = open ("/dev/ts", O_RDONLY); if ( ts < 0 ) { fprintf (stderr, "IAL: Can not open touch screen!\n"); return FALSE; @@ -180,15 +180,15 @@ BOOL InitADSInput (INPUT* input, const char* mdev, const char* mtype) input->set_leds = NULL; input->wait_event = wait_event; - mousex = 0; - mousey = 0; + mousex = 0; + mousey = 0; return TRUE; } void TermADSInput (void) { - if ( ts >= 0 ) - close(ts); + if ( ts >= 0 ) + close(ts); } #endif /* _ADS_IAL */ diff --git a/src/ial/ads7846.c b/src/ial/ads7846.c index 41073e40..d725091b 100644 --- a/src/ial/ads7846.c +++ b/src/ial/ads7846.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ads7846.c: Low Level Input Engine for Arca Tpanel Ads7846. -** +** ** Created by Peng Ke, 2004/05/217 */ @@ -91,13 +91,8 @@ static int mouse_getbutton(void) return mouse_button; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -109,17 +104,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && tpfd >= 0) { FD_SET (tpfd, in); -#ifdef _LITE_VERSION if (tpfd > maxfd) maxfd = tpfd; -#endif } -#ifdef _LITE_VERSION - if ( select (maxfd + 1, in, out, except, timeout) < 0 ) -#else - if ( select (FD_SETSIZE, in, out, except, timeout) < 0 ) -#endif - return -1; + if (select (maxfd + 1, in, out, except, timeout) < 0) + return -1; if (tpfd >= 0 && FD_ISSET (tpfd, in)) { @@ -147,8 +136,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -163,8 +152,8 @@ BOOL InitAds7846Input (INPUT* input, const char* mdev, const char* mtype) return FALSE; } ioctl(tpfd, 14, 0, 0); - - input->update_mouse = mouse_update; + + input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; input->get_mouse_button = mouse_getbutton; @@ -176,7 +165,7 @@ BOOL InitAds7846Input (INPUT* input, const char* mdev, const char* mtype) input->wait_event = wait_event; mousex = mousey = mouse_button = 0; - + return TRUE; } diff --git a/src/ial/arm3000.c b/src/ial/arm3000.c index c7d1b9d2..5fa087b5 100644 --- a/src/ial/arm3000.c +++ b/src/ial/arm3000.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** arm3000.c: Low Level Input Engine for UP-NETARM3000 -** +** ** Created by Yao Yunyuan, 2004/08/20 */ @@ -185,13 +185,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -204,24 +199,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { short data [4]; @@ -289,7 +275,7 @@ BOOL InitARM3000Input (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x = pos.y = pos.b = 0; - + return TRUE; } diff --git a/src/ial/auto.c b/src/ial/auto.c index 13eb224a..fa222f19 100644 --- a/src/ial/auto.c +++ b/src/ial/auto.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** auto.c: Automatic Input Engine -** +** ** Created by Wei Yongming, 2004/01/29 */ @@ -152,16 +152,16 @@ static int get_auto_event(void) int n_read = read (fd_script, &event, sizeof (event)); if (n_read != sizeof (event)) { - + if (errno != EAGAIN) { /* reach EOF */ - + char* loop = getenv ("MG_ENV_IAL_AUTO_REPLAY"); if (loop) { /* try to replay */ time_started = 0; /* reset time_started */ lseek (fd_script, 0, SEEK_SET); - + n_read = read (fd_script, &event, sizeof(event)); if (n_read == sizeof (event) ) { goto got; @@ -230,7 +230,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if (timeout == NULL) { /* modify timeout value */ mytimeout.tv_sec = (time_t)(steptime / 1000); - mytimeout.tv_usec = + mytimeout.tv_usec = #ifdef HAVE_SYS_TIME_H (suseconds_t) #endif @@ -241,7 +241,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if (steptime < (timeout->tv_sec * 1000 + timeout->tv_usec / 1000)) { /* modify timeout value */ timeout->tv_sec = (time_t)(steptime / 1000); - timeout->tv_usec = + timeout->tv_usec = #ifdef HAVE_SYS_TIME_H (suseconds_t) #endif diff --git a/src/ial/c33l05.c b/src/ial/c33l05.c index 9c103a60..aed8e6d5 100644 --- a/src/ial/c33l05.c +++ b/src/ial/c33l05.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -69,12 +69,12 @@ /* for data reading from /dev/ts */ typedef struct { - int x,y; - int dx,dy; - int event; - int pressure; - int ev_no; - unsigned long ev_time; + int x,y; + int dx,dy; + int event; + int pressure; + int ev_no; + unsigned long ev_time; }TS_EVENT; @@ -123,7 +123,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, fd_set rfds; int retvalue = 0; int e; - int bytes_read=0; + int bytes_read=0; if (!in) { in = &rfds; FD_ZERO (in); @@ -134,31 +134,31 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } e = select (FD_SETSIZE, in, out, except, timeout) ; - if (e > 0) - { - if (ts >= 0 && FD_ISSET (ts, in)) - { + if (e > 0) + { + if (ts >= 0 && FD_ISSET (ts, in)) + { FD_CLR (ts, in); - //usleep(1); + //usleep(1); ts_event.x=0; ts_event.y=0; - bytes_read = read (ts, &ts_event, sizeof (TS_EVENT)); + bytes_read = read (ts, &ts_event, sizeof (TS_EVENT)); while(bytes_read= 0) - close(ts); + close(ts); } #endif /* __TARGET_C33L05__ */ diff --git a/src/ial/calib.c b/src/ial/calib.c index 7f452c8f..4ce9a2d3 100644 --- a/src/ial/calib.c +++ b/src/ial/calib.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -55,104 +55,104 @@ #define MAXY 7 #define NOISX 900 #define NOISY 1900 -#define DEVICE "/dev/ts" +#define DEVICE "/dev/ts" struct point { - int x; - int y; + int x; + int y; }; main() { - struct point array[MAXX][MAXY]; - int fd,size,i,j; - struct point temp,temp1; - fd_set rset; - char nouse[10]; + struct point array[MAXX][MAXY]; + int fd,size,i,j; + struct point temp,temp1; + fd_set rset; + char nouse[10]; - i=j=0; - if((fd=open(DEVICE,O_RDONLY)) == -1) - { - perror("open1"); - exit(1); - } + i=j=0; + if((fd=open(DEVICE,O_RDONLY)) == -1) + { + perror("open1"); + exit(1); + } - temp1.x=NOISX; - temp1.y=NOISY; - ioctl(fd, TSTHRESHOLD, &temp1); + temp1.x=NOISX; + temp1.y=NOISY; + ioctl(fd, TSTHRESHOLD, &temp1); - for( i = 0 ; i < MAXX; i++ ) - { - for(j = 0 ; j < MAXY; j ++) - { - while(1) - { - FD_ZERO(&rset); - FD_SET(fd,&rset); - FD_SET(STDIN_FILENO,&rset); - select(fd+1,&rset,NULL,NULL,0); + for( i = 0 ; i < MAXX; i++ ) + { + for(j = 0 ; j < MAXY; j ++) + { + while(1) + { + FD_ZERO(&rset); + FD_SET(fd,&rset); + FD_SET(STDIN_FILENO,&rset); + select(fd+1,&rset,NULL,NULL,0); - if(FD_ISSET(fd,&rset)) - { - if((size = read(fd,&temp,sizeof(struct point))) == -1) - { - perror("read"); - exit(1); - } - if(temp.x != 0 && temp.y!= 0) - temp1=temp; + if(FD_ISSET(fd,&rset)) + { + if((size = read(fd,&temp,sizeof(struct point))) == -1) + { + perror("read"); + exit(1); + } + if(temp.x != 0 && temp.y!= 0) + temp1=temp; #ifdef DEBUG fprintf(stderr,"%d,%d",temp.x,temp.y); #endif - } - if(FD_ISSET(STDIN_FILENO, &rset)) - { - gets(nouse); - break; - } - } + } + if(FD_ISSET(STDIN_FILENO, &rset)) + { + gets(nouse); + break; + } + } - array[i][j] = temp1; + array[i][j] = temp1; #ifdef DEBUG - fprintf(stderr,"%d,%d\n",temp1.x,temp1.y); + fprintf(stderr,"%d,%d\n",temp1.x,temp1.y); #endif - } - } + } + } -/* while(1) - { - if((size = read(fd,&temp,sizeof(struct point))) == -1) - { - perror("read"); - exit(1); - } +/* while(1) + { + if((size = read(fd,&temp,sizeof(struct point))) == -1) + { + perror("read"); + exit(1); + } - array[i][j] = temp; + array[i][j] = temp; - if(j == MAXY-1) - { - j=0; - i++; - if(i == MAXX) - break; - continue; - } - j++; - } -*/ close(fd); + if(j == MAXY-1) + { + j=0; + i++; + if(i == MAXX) + break; + continue; + } + j++; + } +*/ close(fd); - if((fd = open("data.conf",O_CREAT|O_WRONLY,0666)) == -1) - { - perror("open"); - exit(1); - } + if((fd = open("data.conf",O_CREAT|O_WRONLY,0666)) == -1) + { + perror("open"); + exit(1); + } - if((size=write(fd, &array,MAXX*MAXY*sizeof(struct point))) == -1) - { - perror("write error"); - exit(1); - } - close(fd); + if((size=write(fd, &array,MAXX*MAXY*sizeof(struct point))) == -1) + { + perror("write error"); + exit(1); + } + close(fd); } #endif diff --git a/src/ial/cisco_touchpad.c b/src/ial/cisco_touchpad.c index cf08035f..41ffc022 100644 --- a/src/ial/cisco_touchpad.c +++ b/src/ial/cisco_touchpad.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ #define dbg() printf("%s %d\n", __FUNCTION__, __LINE__) /* -** cisco_touchpad.c: Input Engine for Cisco touchpad +** cisco_touchpad.c: Input Engine for Cisco touchpad */ #include "common.h" @@ -54,16 +54,16 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include "mgsock.h" #include "minigui.h" -#include "ial.h" +#include "ial.h" #include "native/native.h" #include "cisco_touchpad.h" #include "window.h" @@ -92,8 +92,8 @@ static KBDDEVICE * kbddev = &kbddev_event; static MOUSEDEVICE * mousedev = &mousedev_IMPS2; static int scale; /* acceleration scale factor */ static int thresh; /* acceleration threshhold */ -static int buttons = 0; -static int s_current_mode = -1; +static int buttons = 0; +static int s_current_mode = -1; static int s_expect_mode = MICE_MODE; static int kbd_fd = -1; static int mouse_fd = -1; @@ -102,7 +102,7 @@ static char state[NR_KEYS]; static int s_enable_appmode; void mg_ial_ioctl(unsigned int cmd, unsigned int value) -{ +{ if (s_enable_appmode) { if (cmd == CMD_SET_MODE) { switch (value) { @@ -122,7 +122,7 @@ void mg_ial_ioctl(unsigned int cmd, unsigned int value) static int touchpad_set_mode(int mode) { int ret = 0; - unsigned char packet[] = { 0x00, 0x04,0x81,0x00 }; + unsigned char packet[] = { 0x00, 0x04,0x81,0x00 }; if(mode == MICE_MODE) { packet[sizeof(packet)-1] = 0x00; ret = write(app_fd, packet, sizeof(packet)); @@ -130,7 +130,7 @@ static int touchpad_set_mode(int mode) { memset(state, 0, NR_KEYS); packet[sizeof(packet)-1] = 0x03; ret = write(app_fd, packet, sizeof(packet)); - } + } if (ret < 0) { perror("write()"); } @@ -138,8 +138,8 @@ static int touchpad_set_mode(int mode) { return 0; } -/************************ Low Level Input Operations **********************/ -/* * Mouse operations -- Event */ +/************************ Low Level Input Operations **********************/ +/* * Mouse operations -- Event */ static int mouse_update (void) { if(MICE_MODE == s_current_mode) { @@ -246,13 +246,13 @@ static int mouse_resume(void) static int keyboard_update (void) { int retvalue = 0; - if(MICE_MODE == s_current_mode) { + if(MICE_MODE == s_current_mode) { unsigned char buf; int modifier; int ch; int is_pressed; - retvalue = kbddev->Read (&buf, &modifier); + retvalue = kbddev->Read (&buf, &modifier); if ((retvalue == -1) || (retvalue == 0)) { return 0; } else { /* retvalue > 0 */ @@ -265,7 +265,7 @@ static int keyboard_update (void) state[ch] = 0; } // printf("is_pressed=%d, ch=%d, state[%d]=%d\n", is_pressed, ch, ch, state[ch]); - } + } return NR_KEYS; } else if(APP_MODE == s_current_mode) { unsigned char buf[16]; @@ -305,7 +305,7 @@ static int keyboard_update (void) } } return 0; -} +} static const char* keyboard_getstate (void) { @@ -349,7 +349,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex } } - if( MICE_MODE == s_current_mode) { + if( MICE_MODE == s_current_mode) { if (which & IAL_MOUSEEVENT && mouse_fd >= 0) { fd = mouse_fd; mg_fd_set (fd, in); @@ -376,12 +376,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if (fd >= 0 && FD_ISSET (fd, in)) { FD_CLR (fd, in); retvalue |= IAL_KEYEVENT; - } - } else if (e < 0) { + } + } else if (e < 0) { return -1; } return retvalue; - } else { + } else { static int s_app_key; static int s_app_key_status = -1; /* -1: empty, 0:up, but not send to app yet, 1:down */ unsigned char buf[16]; @@ -423,7 +423,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex } } } - }else if (e < 0) { + }else if (e < 0) { return -1; }else{ /* timedout */ if (s_app_key_status == 0) { @@ -432,12 +432,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex } } return 0; - } + } } static void keyboard_suspend(void) { - kbddev->Suspend(); + kbddev->Suspend(); kbd_fd = -1; } @@ -492,14 +492,14 @@ BOOL InitCiscoTouchpadInput (INPUT* input, const char* mdev, const char* mtype) system("mknod "KBD" c 13 64 > /dev/null 2>&1"); kbd_fd = keyboard_open(keyboard_device); if (kbd_fd < 0) { - fprintf (stderr, "[WARNING] IAL Native Engine: Can not init keyboard right now, %s(%s).\nPlease plug in the KEYBOARD!\n", + fprintf (stderr, "[WARNING] IAL Native Engine: Can not init keyboard right now, %s(%s).\nPlease plug in the KEYBOARD!\n", strerror(errno), keyboard_device); } } mouse_fd = mouse_open(mdev); if (mouse_fd <0) { - fprintf (stderr, "[WARNING] IAL Native Engine: Can not init mouse right now, %s(%s).\nPlease plug in the MOUSE!\n", + fprintf (stderr, "[WARNING] IAL Native Engine: Can not init mouse right now, %s(%s).\nPlease plug in the MOUSE!\n", strerror(errno), mdev); } @@ -547,12 +547,12 @@ BOOL InitCiscoTouchpadInput (INPUT* input, const char* mdev, const char* mtype) input->resume_keyboard = keyboard_resume; input->set_leds = NULL; - input->wait_event = wait_event; + input->wait_event = wait_event; return TRUE; } void TermCiscoTouchpadInput (void) -{ +{ if (mousedev) mousedev->Close(); @@ -565,3 +565,4 @@ void TermCiscoTouchpadInput (void) } } #endif // _MGIAL_CISCO_TOUCHPAD + diff --git a/src/ial/comminput.c b/src/ial/comminput.c index f6119f8d..f89ae664 100644 --- a/src/ial/comminput.c +++ b/src/ial/comminput.c @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// // // IMPORTANT NOTICE // diff --git a/src/ial/davinci6446.c b/src/ial/davinci6446.c index 33965d9d..57c62a15 100644 --- a/src/ial/davinci6446.c +++ b/src/ial/davinci6446.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -98,9 +98,9 @@ typedef struct { typedef struct { - int x; - int y; - int pressure; + int x; + int y; + int pressure; }MOUSE_EVENT; #define IAL_MOUSE_LEFTBUTTON 1 @@ -134,15 +134,15 @@ static int mouse_update(void) static void mouse_getxy(int *x, int* y) { #if 0 - if (mousex < 0) - mousex = 0; - if (mousex > 720) - mousex = 720; + if (mousex < 0) + mousex = 0; + if (mousex > 720) + mousex = 720; - if (mousey < 0) - mousey = 0; - if (mousey > 576) - mousey = 576; + if (mousey < 0) + mousey = 0; + if (mousey > 576) + mousey = 576; #endif *x = mousex; *y = mousey; @@ -180,8 +180,8 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex e = select (FD_SETSIZE, in, out, except, timeout) ; #endif - if (e > 0) - { + if (e > 0) + { if (FD_ISSET (mouse_fd, in)) { n = read (mouse_fd, buf, 4); @@ -212,40 +212,40 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex } } } - else - { - return -1; - } + else + { + return -1; + } } BOOL InitDavinci6446Input(INPUT* input, const char* mdev, const char* mtype) { mouse_fd = open (mdev, O_RDWR | O_NONBLOCK); - if (mouse_fd < 0) - { - printf ("Can not open mouse !\n"); + if (mouse_fd < 0) + { + printf ("Can not open mouse !\n"); return -1; - } + } input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; input->get_mouse_button = mouse_getbutton; input->set_mouse_range = NULL; - - input->update_keyboard = NULL; + + input->update_keyboard = NULL; input->get_keyboard_state = NULL; input->wait_event = wait_event; - + return TRUE; } void TermDavinci6446Input(void) { if (mouse_fd >= 0) - close(mouse_fd); + close(mouse_fd); } #endif /* _MGIAL_DAVINCI6446 */ diff --git a/src/ial/dfb.c b/src/ial/dfb.c index 4eb462be..e5c81ee7 100644 --- a/src/ial/dfb.c +++ b/src/ial/dfb.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** dfb.c: Low Level Input Engine for DirectFB. -** +** ** Created by Xiaogang Du, 2005/12/15 */ @@ -70,12 +70,12 @@ extern IDirectFB *__mg_dfb; extern IDirectFBSurface *pFrameBuffer; -typedef struct _DeviceInfo DeviceInfo; - -struct _DeviceInfo { - DFBInputDeviceID device_id; - DFBInputDeviceDescription desc; - DeviceInfo *next; +typedef struct _DeviceInfo DeviceInfo; + +struct _DeviceInfo { + DFBInputDeviceID device_id; + DFBInputDeviceDescription desc; + DeviceInfo *next; }; static int screen_height = 0; @@ -91,21 +91,21 @@ static int dev_fd; static int mouse_x = 0; static int mouse_y = 0; static int mouse_button = 0; - + static void mouse_update(void) { - return 0; + return 0; } static void mouse_getxy (int* x, int* y) { - *x = mouse_x; + *x = mouse_x; *y = mouse_y; } static int mouse_getbutton(void) { - return mouse_button; + return mouse_button; } @@ -227,9 +227,9 @@ static unsigned int keycode_to_scancode (unsigned int keycode) return SCANCODE_CURSORBLOCKLEFT; case 61441: return SCANCODE_CURSORBLOCKRIGHT; - case 61442: + case 61442: return SCANCODE_CURSORBLOCKUP; - case 61443: + case 61443: return SCANCODE_CURSORBLOCKDOWN; case 61445: return SCANCODE_HOME; @@ -263,38 +263,33 @@ static const char *keyboard_get_state(void) } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { int retvalue = 0; //DFBEvent evt; - DFBInputEvent evt; + DFBInputEvent evt; - if (evtbuf->WaitForEventWithTimeout( evtbuf, 10, 0 ) == DFB_TIMEOUT) - { - return 0; - //sleep( 1 ); + if (evtbuf->WaitForEventWithTimeout( evtbuf, 10, 0 ) == DFB_TIMEOUT) + { + return 0; + //sleep( 1 ); } - else{ + else{ /* TODO: support mouse right button */ DFBInputDeviceButtonMask mouse_mask = 0; - int res = evtbuf->GetEvent(evtbuf, DFB_EVENT(&evt)); - if(res == DFB_OK) - { - //fprintf(stderr, "**********evt.axis=%d********\n", evt.axis); - } - - if (mouse_device != NULL) + int res = evtbuf->GetEvent(evtbuf, DFB_EVENT(&evt)); + if(res == DFB_OK) + { + //fprintf(stderr, "**********evt.axis=%d********\n", evt.axis); + } + + if (mouse_device != NULL) mouse_device->GetButtons(mouse_device, &mouse_mask); - //FD_CLR (dev_fd, in); - switch (evt.type) { - case DIET_KEYPRESS: + //FD_CLR (dev_fd, in); + switch (evt.type) { + case DIET_KEYPRESS: { curkey = evt.key_symbol; int pckey = keycode_to_scancode(curkey); @@ -303,8 +298,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } retvalue |= IAL_KEYEVENT; } - break; - case DIET_KEYRELEASE: + break; + case DIET_KEYRELEASE: { curkey = evt.key_symbol; int pckey = keycode_to_scancode(curkey); @@ -314,84 +309,84 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, retvalue |= IAL_KEYEVENT; } - break; - case DIET_AXISMOTION: - case DIET_BUTTONPRESS: - case DIET_BUTTONRELEASE: - if (evt.flags & DIEF_AXISABS) { - switch (evt.axis) { - case DIAI_X: - mouse_x = evt.axisabs; - break; - case DIAI_Y: - mouse_y = evt.axisabs; - break; - case DIAI_Z: - fprintf (stderr, "Z axis (abs): %d", evt.axisabs); - break; - default: - fprintf (stderr, "Axis %d (abs): %d", evt.axis, evt.axisabs); - break; - } - } else if (evt.flags & DIEF_AXISREL) { - switch (evt.axis) { - case DIAI_X: - mouse_x += evt.axisrel; - if(mouse_x > screen_width) - mouse_x = screen_width; - if(mouse_x < 0) - mouse_x = 0; - break; - case DIAI_Y: - mouse_y += evt.axisrel; - if(mouse_y > screen_height) - mouse_y = screen_height; - if(mouse_y < 0) - mouse_y = 0; - break; - case DIAI_Z: - fprintf (stderr, "Z axis (rel): %d", evt.axisrel); - break; - default: - fprintf (stderr, "Axis %d (rel): %d", evt.axis, evt.axisrel); - break; - } - } - - if((DIET_BUTTONPRESS == evt.type) || (DIET_BUTTONRELEASE == evt.type)) - { + break; + case DIET_AXISMOTION: + case DIET_BUTTONPRESS: + case DIET_BUTTONRELEASE: + if (evt.flags & DIEF_AXISABS) { + switch (evt.axis) { + case DIAI_X: + mouse_x = evt.axisabs; + break; + case DIAI_Y: + mouse_y = evt.axisabs; + break; + case DIAI_Z: + fprintf (stderr, "Z axis (abs): %d", evt.axisabs); + break; + default: + fprintf (stderr, "Axis %d (abs): %d", evt.axis, evt.axisabs); + break; + } + } else if (evt.flags & DIEF_AXISREL) { + switch (evt.axis) { + case DIAI_X: + mouse_x += evt.axisrel; + if(mouse_x > screen_width) + mouse_x = screen_width; + if(mouse_x < 0) + mouse_x = 0; + break; + case DIAI_Y: + mouse_y += evt.axisrel; + if(mouse_y > screen_height) + mouse_y = screen_height; + if(mouse_y < 0) + mouse_y = 0; + break; + case DIAI_Z: + fprintf (stderr, "Z axis (rel): %d", evt.axisrel); + break; + default: + fprintf (stderr, "Axis %d (rel): %d", evt.axis, evt.axisrel); + break; + } + } + + if((DIET_BUTTONPRESS == evt.type) || (DIET_BUTTONRELEASE == evt.type)) + { #if 0 - if((IAL_MOUSE_LEFTBUTTON | IAL_MOUSE_RIGHTBUTTON) == mouse_button) { - mouse_button = 0; + if((IAL_MOUSE_LEFTBUTTON | IAL_MOUSE_RIGHTBUTTON) == mouse_button) { + mouse_button = 0; } else { if (mouse_mask == DIBM_RIGHT) - mouse_button = IAL_MOUSE_RIGHTBUTTON; + mouse_button = IAL_MOUSE_RIGHTBUTTON; else - mouse_button = IAL_MOUSE_LEFTBUTTON; + mouse_button = IAL_MOUSE_LEFTBUTTON; } #endif if(IAL_MOUSE_LEFTBUTTON == mouse_button) mouse_button = 0; else mouse_button = IAL_MOUSE_LEFTBUTTON; - } - retvalue |= IAL_MOUSEEVENT; - break; - } + } + retvalue |= IAL_MOUSEEVENT; + break; + } } return retvalue; } static DFBEnumerationResult enum_input_device( DFBInputDeviceID device_id, DFBInputDeviceDescription desc, void *data ) { - DeviceInfo **devices = data; - DeviceInfo *device; - device = malloc( sizeof(DeviceInfo) ); - device->device_id = device_id; - device->desc = desc; - device->next = *devices; - *devices = device; - return DFENUM_OK; + DeviceInfo **devices = data; + DeviceInfo *device; + device = malloc( sizeof(DeviceInfo) ); + device->device_id = device_id; + device->desc = desc; + device->next = *devices; + *devices = device; + return DFENUM_OK; } @@ -401,27 +396,27 @@ BOOL InitDFBInput (INPUT* input, const char* mdev, const char* mtype) DFBResult ret; DeviceInfo *device = NULL; - //DeviceInfo *devices = NULL; - //__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices ); - __mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices_info ); - ret = __mg_dfb->CreateInputEventBuffer(__mg_dfb, DICAPS_ALL, DFB_FALSE, &evtbuf); + //DeviceInfo *devices = NULL; + //__mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices ); + __mg_dfb->EnumInputDevices( __mg_dfb, enum_input_device, &devices_info ); + ret = __mg_dfb->CreateInputEventBuffer(__mg_dfb, DICAPS_ALL, DFB_FALSE, &evtbuf); if (ret) { fprintf(stderr, "CreateInputEventBuffer error\n"); return FALSE; } /* get dfb mouse device */ - device = devices_info; + device = devices_info; while (device != NULL) { if (device->desc.type == DIDTF_MOUSE) { __mg_dfb->GetInputDevice(__mg_dfb, device->device_id, mouse_device); break; } - device = device->next; + device = device->next; } - pFrameBuffer->GetSize(pFrameBuffer, &screen_width, &screen_height); + pFrameBuffer->GetSize(pFrameBuffer, &screen_width, &screen_height); memset (state, 0, sizeof (state)); @@ -442,10 +437,10 @@ BOOL InitDFBInput (INPUT* input, const char* mdev, const char* mtype) void TermDFBInput (void) { - DeviceInfo *device = devices_info; + DeviceInfo *device = devices_info; while (devices_info != NULL) { device = devices_info; - devices_info = devices_info->next; + devices_info = devices_info->next; free(device); } } diff --git a/src/ial/dm270.c b/src/ial/dm270.c index 9aebbf25..9d0487ca 100644 --- a/src/ial/dm270.c +++ b/src/ial/dm270.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** dm270.c: Low Level Input Engine for DigiPro DM270. -** +** ** Created by Yao Yunyuan, 2004/08/20 */ @@ -138,13 +138,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -158,17 +153,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { + e = select (maxfd + 1, in, out, except, timeout) ; + if (e > 0) { if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) { FD_CLR(btn_fd, in); read(btn_fd, &readkey, sizeof(readkey)); diff --git a/src/ial/dmg-stb.c b/src/ial/dmg-stb.c index d192454f..deabdd6f 100644 --- a/src/ial/dmg-stb.c +++ b/src/ial/dmg-stb.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** dmg-stb.c: IAL Engine for Intel DMG GEN10 STB. -** +** ** Author: Wei Yongming (2003/12/14) */ @@ -89,7 +89,7 @@ static int mouse_getbutton(void) static unsigned int cur_key; static unsigned char state [NR_KEYS]; -static unsigned char ir2kbd_map_b1 [] = +static unsigned char ir2kbd_map_b1 [] = { 0, // 0 0, // 1 @@ -98,7 +98,7 @@ static unsigned char ir2kbd_map_b1 [] = DMG_KB_BACK, // 4 }; -static unsigned char ir2kbd_map_b2 [] = +static unsigned char ir2kbd_map_b2 [] = { 0, // 0 DMG_KB_UP, // 1 @@ -111,14 +111,14 @@ static unsigned char ir2kbd_map_b2 [] = DMG_KB_RIGHT, // 8 }; -static unsigned char ir2kbd_map_b3 [] = +static unsigned char ir2kbd_map_b3 [] = { 0, // 0 DMG_KB_PLAY, // 1 DMG_KB_STOP, // 2 }; -static unsigned char ir2kbd_map_b4 [] = +static unsigned char ir2kbd_map_b4 [] = { 0, // 0 0, // 1 @@ -155,13 +155,8 @@ static const char * keyboard_get_state(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int e; @@ -173,18 +168,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_KEYEVENT) && ir_fd >= 0) { FD_SET (ir_fd, in); -#ifdef _LITE_VERSION if (ir_fd > maxfd) maxfd = ir_fd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e < 0) + if (e < 0) return -1; if (ir_fd >= 0 && FD_ISSET (ir_fd, in)) { diff --git a/src/ial/em85.c b/src/ial/em85.c index e7ff49ae..db8a578d 100644 --- a/src/ial/em85.c +++ b/src/ial/em85.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -112,118 +112,118 @@ static struct _ir2key { } ir_pckey_map [] = { #if 0 - {NETSETUP_SCANCODE, SCANCODE_F6}, - {POWER_SCANCODE, SCANCODE_F9}, - {ONE_SCANCODE, SCANCODE_1}, - {TWO_SCANCODE, SCANCODE_2}, - {THREE_SCANCODE, SCANCODE_3}, - {FOUR_SCANCODE, SCANCODE_4}, - {FIVE_SCANCODE, SCANCODE_5}, - {SIX_SCANCODE, SCANCODE_6}, - {SEVEN_SCANCODE, SCANCODE_7}, - {EIGHT_SCANCODE, SCANCODE_8}, - {NINE_SCANCODE, SCANCODE_9}, - {DOT_SCANCODE, SCANCODE_PERIOD}, - {THERO_SCANCODE, SCANCODE_0}, - {BS_SCANCODE, SCANCODE_BACKSPACE}, //SCANCODE_REMOVE}, - {PAGEUP_SCANCODE, SCANCODE_F3}, - {PAGEDN_SCANCODE, SCANCODE_F4}, - {LEFT_SCANCODE, SCANCODE_CURSORBLOCKLEFT}, - {UP_SCANCODE, SCANCODE_CURSORBLOCKUP}, - {RIGHT_SCANCODE, SCANCODE_CURSORBLOCKRIGHT}, - {DOWN_SCANCODE, SCANCODE_CURSORBLOCKDOWN}, - {ENTER_SCANCODE, SCANCODE_ENTER}, - {VOLDN_SCANCODE, SCANCODE_MINUS}, - {VOLUP_SCANCODE, SCANCODE_EQUAL}, - {FRW_SCANCODE, SCANCODE_B}, - {PLAY_SCANCODE, SCANCODE_SPACE}, - {FFW_SCANCODE, SCANCODE_F}, - {PAUSE_SCANCODE, SCANCODE_P}, - {STOP_SCANCODE, SCANCODE_S}, - {MUTE_SCANCODE, SCANCODE_M}, - {REFRESH_SCANCODE, SCANCODE_F5}, - {HOME_SCANCODE, SCANCODE_F1}, - {TRACK_SCANCODE, SCANCODE_C}, - {WEB_SCANCODE, SCANCODE_F2}, - {VK_SCANCODE, SCANCODE_LEFTWIN}, //SCANCODE_F7}, - {OPTION_SCANCODE, SCANCODE_F7}, + {NETSETUP_SCANCODE, SCANCODE_F6}, + {POWER_SCANCODE, SCANCODE_F9}, + {ONE_SCANCODE, SCANCODE_1}, + {TWO_SCANCODE, SCANCODE_2}, + {THREE_SCANCODE, SCANCODE_3}, + {FOUR_SCANCODE, SCANCODE_4}, + {FIVE_SCANCODE, SCANCODE_5}, + {SIX_SCANCODE, SCANCODE_6}, + {SEVEN_SCANCODE, SCANCODE_7}, + {EIGHT_SCANCODE, SCANCODE_8}, + {NINE_SCANCODE, SCANCODE_9}, + {DOT_SCANCODE, SCANCODE_PERIOD}, + {THERO_SCANCODE, SCANCODE_0}, + {BS_SCANCODE, SCANCODE_BACKSPACE}, //SCANCODE_REMOVE}, + {PAGEUP_SCANCODE, SCANCODE_F3}, + {PAGEDN_SCANCODE, SCANCODE_F4}, + {LEFT_SCANCODE, SCANCODE_CURSORBLOCKLEFT}, + {UP_SCANCODE, SCANCODE_CURSORBLOCKUP}, + {RIGHT_SCANCODE, SCANCODE_CURSORBLOCKRIGHT}, + {DOWN_SCANCODE, SCANCODE_CURSORBLOCKDOWN}, + {ENTER_SCANCODE, SCANCODE_ENTER}, + {VOLDN_SCANCODE, SCANCODE_MINUS}, + {VOLUP_SCANCODE, SCANCODE_EQUAL}, + {FRW_SCANCODE, SCANCODE_B}, + {PLAY_SCANCODE, SCANCODE_SPACE}, + {FFW_SCANCODE, SCANCODE_F}, + {PAUSE_SCANCODE, SCANCODE_P}, + {STOP_SCANCODE, SCANCODE_S}, + {MUTE_SCANCODE, SCANCODE_M}, + {REFRESH_SCANCODE, SCANCODE_F5}, + {HOME_SCANCODE, SCANCODE_F1}, + {TRACK_SCANCODE, SCANCODE_C}, + {WEB_SCANCODE, SCANCODE_F2}, + {VK_SCANCODE, SCANCODE_LEFTWIN}, //SCANCODE_F7}, + {OPTION_SCANCODE, SCANCODE_F7}, #endif //VCOM IR KEYBOARD - {VCOM_IRKB_Esc, SCANCODE_ESCAPE}, - {VCOM_IRKB_1, SCANCODE_1}, - {VCOM_IRKB_2, SCANCODE_2}, - {VCOM_IRKB_3, SCANCODE_3}, - {VCOM_IRKB_4, SCANCODE_4}, - {VCOM_IRKB_5, SCANCODE_5}, - {VCOM_IRKB_6, SCANCODE_6}, - {VCOM_IRKB_7, SCANCODE_7}, - {VCOM_IRKB_8, SCANCODE_8}, - {VCOM_IRKB_9, SCANCODE_9}, - {VCOM_IRKB_0, SCANCODE_0}, - {VCOM_IRKB_MINUS, SCANCODE_MINUS}, - {VCOM_IRKB_EQUAL, SCANCODE_EQUAL}, - {VCOM_IRKB_Backspace, SCANCODE_BACKSPACE}, + {VCOM_IRKB_Esc, SCANCODE_ESCAPE}, + {VCOM_IRKB_1, SCANCODE_1}, + {VCOM_IRKB_2, SCANCODE_2}, + {VCOM_IRKB_3, SCANCODE_3}, + {VCOM_IRKB_4, SCANCODE_4}, + {VCOM_IRKB_5, SCANCODE_5}, + {VCOM_IRKB_6, SCANCODE_6}, + {VCOM_IRKB_7, SCANCODE_7}, + {VCOM_IRKB_8, SCANCODE_8}, + {VCOM_IRKB_9, SCANCODE_9}, + {VCOM_IRKB_0, SCANCODE_0}, + {VCOM_IRKB_MINUS, SCANCODE_MINUS}, + {VCOM_IRKB_EQUAL, SCANCODE_EQUAL}, + {VCOM_IRKB_Backspace, SCANCODE_BACKSPACE}, - {VCOM_IRKB_Tab, SCANCODE_TAB}, - {VCOM_IRKB_Q, SCANCODE_Q}, - {VCOM_IRKB_W, SCANCODE_W}, - {VCOM_IRKB_E, SCANCODE_E}, - {VCOM_IRKB_R, SCANCODE_R}, - {VCOM_IRKB_T, SCANCODE_T}, - {VCOM_IRKB_Y, SCANCODE_Y}, - {VCOM_IRKB_U, SCANCODE_U}, - {VCOM_IRKB_I, SCANCODE_I}, - {VCOM_IRKB_O, SCANCODE_O}, - {VCOM_IRKB_P, SCANCODE_P}, + {VCOM_IRKB_Tab, SCANCODE_TAB}, + {VCOM_IRKB_Q, SCANCODE_Q}, + {VCOM_IRKB_W, SCANCODE_W}, + {VCOM_IRKB_E, SCANCODE_E}, + {VCOM_IRKB_R, SCANCODE_R}, + {VCOM_IRKB_T, SCANCODE_T}, + {VCOM_IRKB_Y, SCANCODE_Y}, + {VCOM_IRKB_U, SCANCODE_U}, + {VCOM_IRKB_I, SCANCODE_I}, + {VCOM_IRKB_O, SCANCODE_O}, + {VCOM_IRKB_P, SCANCODE_P}, - {VCOM_IRKB_Caps, SCANCODE_CAPSLOCK}, - {VCOM_IRKB_A, SCANCODE_A}, - {VCOM_IRKB_S, SCANCODE_S}, - {VCOM_IRKB_D, SCANCODE_D}, - {VCOM_IRKB_F, SCANCODE_F}, - {VCOM_IRKB_G, SCANCODE_G}, - {VCOM_IRKB_H, SCANCODE_H}, - {VCOM_IRKB_J, SCANCODE_J}, - {VCOM_IRKB_K, SCANCODE_K}, - {VCOM_IRKB_L, SCANCODE_L}, - {VCOM_IRKB_SEMICOLON, SCANCODE_SEMICOLON}, - {VCOM_IRKB_Enter, SCANCODE_ENTER}, + {VCOM_IRKB_Caps, SCANCODE_CAPSLOCK}, + {VCOM_IRKB_A, SCANCODE_A}, + {VCOM_IRKB_S, SCANCODE_S}, + {VCOM_IRKB_D, SCANCODE_D}, + {VCOM_IRKB_F, SCANCODE_F}, + {VCOM_IRKB_G, SCANCODE_G}, + {VCOM_IRKB_H, SCANCODE_H}, + {VCOM_IRKB_J, SCANCODE_J}, + {VCOM_IRKB_K, SCANCODE_K}, + {VCOM_IRKB_L, SCANCODE_L}, + {VCOM_IRKB_SEMICOLON, SCANCODE_SEMICOLON}, + {VCOM_IRKB_Enter, SCANCODE_ENTER}, - {VCOM_IRKB_Z, SCANCODE_Z}, - {VCOM_IRKB_X, SCANCODE_X}, - {VCOM_IRKB_C, SCANCODE_C}, - {VCOM_IRKB_V, SCANCODE_V}, - {VCOM_IRKB_B, SCANCODE_B}, - {VCOM_IRKB_N, SCANCODE_N}, - {VCOM_IRKB_M, SCANCODE_M}, - {VCOM_IRKB_COMMA, SCANCODE_COMMA}, - {VCOM_IRKB_PERIOD, SCANCODE_PERIOD}, - {VCOM_IRKB_SLASH, SCANCODE_SLASH}, + {VCOM_IRKB_Z, SCANCODE_Z}, + {VCOM_IRKB_X, SCANCODE_X}, + {VCOM_IRKB_C, SCANCODE_C}, + {VCOM_IRKB_V, SCANCODE_V}, + {VCOM_IRKB_B, SCANCODE_B}, + {VCOM_IRKB_N, SCANCODE_N}, + {VCOM_IRKB_M, SCANCODE_M}, + {VCOM_IRKB_COMMA, SCANCODE_COMMA}, + {VCOM_IRKB_PERIOD, SCANCODE_PERIOD}, + {VCOM_IRKB_SLASH, SCANCODE_SLASH}, - {VCOM_IRKB_shift, SCANCODE_LEFTWIN}, // vkb //SCANCODE_LEFTSHIFT}, - {VCOM_IRKB_ctrl, SCANCODE_RIGHTWIN}, // ime //SCANCODE_LEFTCONTROL}, - {VCOM_IRKB_alt, SCANCODE_MENU}, // status bar //SCANCODE_LEFTALT}, + {VCOM_IRKB_shift, SCANCODE_LEFTWIN}, // vkb //SCANCODE_LEFTSHIFT}, + {VCOM_IRKB_ctrl, SCANCODE_RIGHTWIN}, // ime //SCANCODE_LEFTCONTROL}, + {VCOM_IRKB_alt, SCANCODE_MENU}, // status bar //SCANCODE_LEFTALT}, - {VCOM_IRKB_Space, SCANCODE_SPACE}, - {VCOM_IRKB_Del, SCANCODE_REMOVE}, - {VCOM_IRKB_Up, SCANCODE_CURSORBLOCKUP}, - {VCOM_IRKB_Down, SCANCODE_CURSORBLOCKDOWN}, - {VCOM_IRKB_Pgup, SCANCODE_PAGEUP}, - {VCOM_IRKB_Pgdn, SCANCODE_PAGEDOWN}, - {VCOM_IRKB_Right, SCANCODE_CURSORBLOCKRIGHT}, - {VCOM_IRKB_Left, SCANCODE_CURSORBLOCKLEFT}, + {VCOM_IRKB_Space, SCANCODE_SPACE}, + {VCOM_IRKB_Del, SCANCODE_REMOVE}, + {VCOM_IRKB_Up, SCANCODE_CURSORBLOCKUP}, + {VCOM_IRKB_Down, SCANCODE_CURSORBLOCKDOWN}, + {VCOM_IRKB_Pgup, SCANCODE_PAGEUP}, + {VCOM_IRKB_Pgdn, SCANCODE_PAGEDOWN}, + {VCOM_IRKB_Right, SCANCODE_CURSORBLOCKRIGHT}, + {VCOM_IRKB_Left, SCANCODE_CURSORBLOCKLEFT}, - {VCOM_IRKB_F1, SCANCODE_F1}, - {VCOM_IRKB_F2, SCANCODE_F2}, - {VCOM_IRKB_F3, SCANCODE_F3}, - {VCOM_IRKB_F4, SCANCODE_F4}, - {VCOM_IRKB_F5, SCANCODE_F5}, - {VCOM_IRKB_F6, SCANCODE_F6}, - {VCOM_IRKB_F7, SCANCODE_F7}, - {VCOM_IRKB_F8, SCANCODE_F8}, - {VCOM_IRKB_F9, SCANCODE_F9}, - {VCOM_IRKB_F10, SCANCODE_F10}, - {VCOM_IRKB_F11, SCANCODE_F11}, + {VCOM_IRKB_F1, SCANCODE_F1}, + {VCOM_IRKB_F2, SCANCODE_F2}, + {VCOM_IRKB_F3, SCANCODE_F3}, + {VCOM_IRKB_F4, SCANCODE_F4}, + {VCOM_IRKB_F5, SCANCODE_F5}, + {VCOM_IRKB_F6, SCANCODE_F6}, + {VCOM_IRKB_F7, SCANCODE_F7}, + {VCOM_IRKB_F8, SCANCODE_F8}, + {VCOM_IRKB_F9, SCANCODE_F9}, + {VCOM_IRKB_F10, SCANCODE_F10}, + {VCOM_IRKB_F11, SCANCODE_F11}, }; static int @@ -279,13 +279,8 @@ static int gettime_ms (void) static unsigned long g_last_key_time = 0; #endif -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { unsigned int key = 0; int e = 0; @@ -296,11 +291,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, usleep(20000); if (cur_key || button) { -#ifdef _LITE_VERSION select(maxfd + 1, in, out, except, timeout); -#else - select(FD_SETSIZE, in, out, except, timeout); -#endif if (cur_key) { cur_key = 0; e = IAL_KEYEVENT; @@ -320,35 +311,28 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } FD_SET(fip_fd, in); -#if 1 -#ifdef _LITE_VERSION if (fip_fd > maxfd) maxfd = fip_fd; e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif -#else - e = select(fip_fd + 1, in, NULL, NULL, timeout); -#endif if (e > 0 && fip_fd >= 0 && FD_ISSET (fip_fd, in)) { FD_CLR (fip_fd, in); ioctl(fip_fd, IR_IOCTL_READ_KEY, &key); //read(fip_fd, &key, 4); - //printf("got a key under minigui:%d\n", key); + //printf("got a key under minigui:%d\n", key); } + if (key == NEC_REPEAT_CODE || key == 0) - return -1; + return -1; /* else - return 0; + return 0; - if (!key) - return -1; + if (!key) + return -1; - printf("..........key: %x\n", key); + printf("..........key: %x\n", key); if (key == OPENCLOSE_SCANCODE) { chmousestatus(); @@ -388,15 +372,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } } if (key && key != 0xffffffff) { - //ÏÞÖÆ°´¼üƵÂÊÔÚ300ºÁÃëÒÔÉÏ + //ÏÞÖÆ°´¼üƵÂÊÔÚ300ºÁÃëÒÔÉÏ #if LIMI_KEYSTROKE - if (g_last_key_time && ((unsigned long)gettime_ms() - g_last_key_time) <= 300){ - printf("minigui lib:key press too quick, ignore\n"); - return -1; - } - g_last_key_time = gettime_ms(); + if (g_last_key_time && ((unsigned long)gettime_ms() - g_last_key_time) <= 300){ + printf("minigui lib:key press too quick, ignore\n"); + return -1; + } + g_last_key_time = gettime_ms(); #endif - cur_key = key; + cur_key = key; return IAL_KEYEVENT; } diff --git a/src/ial/em86.c b/src/ial/em86.c index fa113e04..62fc42ac 100644 --- a/src/ial/em86.c +++ b/src/ial/em86.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -102,14 +102,14 @@ static inline void chmousestatus (void) { mousestatus ^= 1; - if(mousestatus) + if(mousestatus) { - printf("+++++++++++++ MiniGUI:Swtich to MOUSE Mode ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI:Swtich to MOUSE Mode ++++++++++++++\n"); ShowCursor(TRUE); } - else + else { - printf("+++++++++++++ MiniGUI:Back to KEYBOARD Mode ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI:Back to KEYBOARD Mode ++++++++++++++\n"); ShowCursor(FALSE); } } @@ -130,79 +130,79 @@ static struct _ir2key { {KEY_0, SCANCODE_0}, {KEY_1, SCANCODE_1}, {KEY_2, SCANCODE_2}, - {KEY_3, SCANCODE_3}, + {KEY_3, SCANCODE_3}, {KEY_4, SCANCODE_4}, {KEY_5, SCANCODE_5}, {KEY_6, SCANCODE_6}, - {KEY_7, SCANCODE_7}, - {KEY_8, SCANCODE_8}, + {KEY_7, SCANCODE_7}, + {KEY_8, SCANCODE_8}, {KEY_9, SCANCODE_9}, {KEY_UP, SCANCODE_CURSORBLOCKUP}, - {KEY_DOWN, SCANCODE_CURSORBLOCKDOWN}, - {KEY_LEFT, SCANCODE_CURSORBLOCKLEFT}, + {KEY_DOWN, SCANCODE_CURSORBLOCKDOWN}, + {KEY_LEFT, SCANCODE_CURSORBLOCKLEFT}, {KEY_RIGHT, SCANCODE_CURSORBLOCKRIGHT}, - {KEY_PGUP, SCANCODE_PAGEUP}, - {KEY_PGDN, SCANCODE_PAGEDOWN}, + {KEY_PGUP, SCANCODE_PAGEUP}, + {KEY_PGDN, SCANCODE_PAGEDOWN}, {KEY_VOLINC, SCANCODE_EQUAL}, {KEY_VOLDEC, SCANCODE_MINUS}, - {KEY_CAPS, SCANCODE_CAPSLOCK}, + {KEY_CAPS, SCANCODE_CAPSLOCK}, {KEY_TAB, SCANCODE_TAB}, - {KEY_REFRESH, SCANCODE_F5}, - {KEY_BACK, SCANCODE_BACKSPACE}, + {KEY_REFRESH, SCANCODE_F5}, + {KEY_BACK, SCANCODE_BACKSPACE}, {KEY_OK, SCANCODE_ENTER}, - {KEY_CANCEL, SCANCODE_ESCAPE}, + {KEY_CANCEL, SCANCODE_ESCAPE}, - {KEY_MOUSE, SCANCODE_F8}, + {KEY_MOUSE, SCANCODE_F8}, - {KEY_RED, SCANCODE_F9}, - {KEY_GREEN, SCANCODE_F10}, - {KEY_YELLOW, SCANCODE_F11}, - {KEY_BLUE, SCANCODE_F12} + {KEY_RED, SCANCODE_F9}, + {KEY_GREEN, SCANCODE_F10}, + {KEY_YELLOW, SCANCODE_F11}, + {KEY_BLUE, SCANCODE_F12} }; static KeyReg_t RegKeys[] = { - {KEY_0, RC}, - {KEY_1, RC}, - {KEY_2, RC}, - {KEY_3, RC}, - {KEY_4, RC}, - {KEY_5, RC}, - {KEY_6, RC}, - {KEY_7, RC}, - {KEY_8, RC}, - {KEY_9, RC}, - + {KEY_0, RC}, + {KEY_1, RC}, + {KEY_2, RC}, + {KEY_3, RC}, + {KEY_4, RC}, + {KEY_5, RC}, + {KEY_6, RC}, + {KEY_7, RC}, + {KEY_8, RC}, + {KEY_9, RC}, + {KEY_UP, RC}, - {KEY_DOWN, RC}, - {KEY_LEFT, RC}, + {KEY_DOWN, RC}, + {KEY_LEFT, RC}, {KEY_RIGHT, RC}, - - {KEY_PGUP, RC}, - {KEY_PGDN, RC}, - - {KEY_VOLINC, RC}, + + {KEY_PGUP, RC}, + {KEY_PGDN, RC}, + + {KEY_VOLINC, RC}, {KEY_VOLDEC, RC}, - {KEY_CAPS, RC}, + {KEY_CAPS, RC}, {KEY_TAB, RC}, - {KEY_REFRESH, RC}, - {KEY_BACK, RC}, - - {KEY_OK, RC}, - {KEY_CANCEL, RC}, - - {KEY_RED, RC}, - {KEY_GREEN, RC}, - {KEY_YELLOW, RC}, - {KEY_BLUE, RC}, + {KEY_REFRESH, RC}, + {KEY_BACK, RC}, - {KEY_MOUSE, RC}, + {KEY_OK, RC}, + {KEY_CANCEL, RC}, + + {KEY_RED, RC}, + {KEY_GREEN, RC}, + {KEY_YELLOW, RC}, + {KEY_BLUE, RC}, + + {KEY_MOUSE, RC}, {KEY_UP, PN}, {KEY_DOWN, PN}, @@ -215,7 +215,7 @@ static KeyReg_t RegKeys[] = }; -static int +static int find_ir_key(unsigned long key) { int i; @@ -248,7 +248,7 @@ static int keyboard_update (void) return NR_KEYS; } -static const char * +static const char * keyboard_get_state(void) { return (char *)state; @@ -269,42 +269,37 @@ static int looprcvMsg(Msg_t *pMsg, struct timeval *timeout) while (interval < (timeout->tv_sec*1000000 + timeout->tv_usec)) { ret = rcvMcMsgNoWait(pMsg); if (ret > 0) { - printf("+++++++++++++++ MiniGUI:recieved Message ++++++++++++++++\n"); + printf("+++++++++++++++ MiniGUI:recieved Message ++++++++++++++++\n"); + return ret; + } + else if (ret < 0) /* error */ return ret; - } - else if (ret < 0) /* error */ - return ret; usleep(10000); gettimeofday(&curt, NULL); interval = - (curt.tv_sec - startt.tv_sec)*1000000 + (curt.tv_usec - startt.tv_usec); - } + (curt.tv_sec - startt.tv_sec)*1000000 + (curt.tv_usec - startt.tv_usec); + } - return 0; /* time out */ + return 0; /* time out */ } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { - unsigned int ret; + unsigned int ret; unsigned int key; - int e; - unsigned long usec; - int msgtype; - Msg_t msg; - unsigned char *url; + int e; + unsigned long usec; + int msgtype; + Msg_t msg; + unsigned char *url; int number = 0; - - usec = timeout->tv_sec*1000000+timeout->tv_usec; + + usec = timeout->tv_sec*1000000+timeout->tv_usec; if (cur_key || button) { - usleep(usec); + usleep(usec); if (cur_key) { cur_key = 0; @@ -319,50 +314,50 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, return e; } - if (!MCIsInit) - { - if (initMsgQueue(ST_BrowserControl) < 0) { - fprintf(stderr, "Cannot Init MC MsgQueue\n"); - return -1; - } + if (!MCIsInit) + { + if (initMsgQueue(ST_BrowserControl) < 0) { + fprintf(stderr, "Cannot Init MC MsgQueue\n"); + return -1; + } if (requestKeys(__mg_with_panel ? TABLESIZE(RegKeys):(TABLESIZE(RegKeys) - 8), RegKeys) < 0) { fprintf(stderr, "Request Keys Error\n"); return -1; } - - MCIsInit = 1; - } - ret = looprcvMsg(&msg, timeout); - if (ret > 0) { /* have msg */ - msgtype = getMsgId(&msg); + MCIsInit = 1; + } - printf("@@@@@@@@@@@@@@@ MiniGUI:KEY Message msgtype (%d) \n", msgtype); - switch(msgtype) { - case MSG_KEY: - printf("+++++++++++++++ MiniGUI:KEY Message +++++++++++++++++\n"); - key = *(unsigned int*)getMsgContent(&msg); - break; - case MSG_CMD_ACTIVATE: - printf("MiniGUI:Receive the MSG_CMD_ACTIVATE Message =================\n"); - ActiveApp(); - acknowledgeCmd(MSG_APP_STATUS_ACTIVE); - printf("MiniGUI:have sent the MSG_APP_STATUS_ACTIVE Message =================\n"); - return 0; - case MSG_CMD_DEACTIVATE: - printf("MiniGUI:Receive the MSG_CMD_DEACTIVATE Message =================\n"); - DeActiveApp(); - acknowledgeCmd(MSG_APP_STATUS_STANDBY); - printf("MiniGUI:have sent the MSG_APP_STATUS_STANDBY Message =================\n"); - return 0; + ret = looprcvMsg(&msg, timeout); + if (ret > 0) { /* have msg */ + msgtype = getMsgId(&msg); - case MSG_CMD_UNLOAD: - printf("MiniGUI:Receive the MSG_CMD_UNLOAD Message =================\n"); - acknowledgeCmd(MSG_APP_STATUS_UNLOAD); - UnLoadApp(); - printf("MiniGUI:have sent the MSG_APP_STATUS_UNLOAD Message =================\n"); - return 0; + printf("@@@@@@@@@@@@@@@ MiniGUI:KEY Message msgtype (%d) \n", msgtype); + switch(msgtype) { + case MSG_KEY: + printf("+++++++++++++++ MiniGUI:KEY Message +++++++++++++++++\n"); + key = *(unsigned int*)getMsgContent(&msg); + break; + case MSG_CMD_ACTIVATE: + printf("MiniGUI:Receive the MSG_CMD_ACTIVATE Message =================\n"); + ActiveApp(); + acknowledgeCmd(MSG_APP_STATUS_ACTIVE); + printf("MiniGUI:have sent the MSG_APP_STATUS_ACTIVE Message =================\n"); + return 0; + case MSG_CMD_DEACTIVATE: + printf("MiniGUI:Receive the MSG_CMD_DEACTIVATE Message =================\n"); + DeActiveApp(); + acknowledgeCmd(MSG_APP_STATUS_STANDBY); + printf("MiniGUI:have sent the MSG_APP_STATUS_STANDBY Message =================\n"); + return 0; + + case MSG_CMD_UNLOAD: + printf("MiniGUI:Receive the MSG_CMD_UNLOAD Message =================\n"); + acknowledgeCmd(MSG_APP_STATUS_UNLOAD); + UnLoadApp(); + printf("MiniGUI:have sent the MSG_APP_STATUS_UNLOAD Message =================\n"); + return 0; case MSG_CMD_URL: url = (unsigned char*)getMsgContent(&msg); @@ -370,20 +365,20 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, OpenUrl(url); return 0; - default: - printf("MiniGUI:the Message type not found!&&&&&&&&&&&&&&&\n"); - return 0; - } - } - else if (ret = 0) /* timeout */ - { - return 0; - } - else /* error */ - { - return -1; - } - + default: + printf("MiniGUI:the Message type not found!&&&&&&&&&&&&&&&\n"); + return 0; + } + } + else if (ret = 0) /* timeout */ + { + return 0; + } + else /* error */ + { + return -1; + } + if (key == KEY_MOUSE) { printf("helloworld change the mouse and keyboard mode -====================================\n"); chmousestatus(); @@ -394,7 +389,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, switch (key) { #if 1 case KEY_LEFT: - printf("+++++++++++++ MiniGUI: LEFT Message ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI: LEFT Message ++++++++++++++\n"); mousex -= MOUSE_MOVE_PIXEL; if (mousex < 0) mousex = 0; @@ -402,28 +397,28 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, #endif case KEY_RIGHT: - printf("+++++++++++++ MiniGUI: RIGHT Message ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI: RIGHT Message ++++++++++++++\n"); mousex += MOUSE_MOVE_PIXEL_F; if (mousex > MOUSE_MAX_X) mousex = MOUSE_MAX_X; return IAL_MOUSEEVENT; case KEY_UP: - printf("+++++++++++++ MiniGUI: UP Message ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI: UP Message ++++++++++++++\n"); mousey -= MOUSE_MOVE_PIXEL; if (mousey < 0) mousey = 0; return IAL_MOUSEEVENT; case KEY_DOWN: - printf("+++++++++++++ MiniGUI: DOWN Message ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI: DOWN Message ++++++++++++++\n"); mousey += MOUSE_MOVE_PIXEL_F; if (mousey > MOUSE_MAX_Y) mousey = MOUSE_MAX_Y; return IAL_MOUSEEVENT; case KEY_OK: - printf("+++++++++++++ MiniGUI: OK Message ++++++++++++++\n"); + printf("+++++++++++++ MiniGUI: OK Message ++++++++++++++\n"); button = IAL_MOUSE_LEFTBUTTON; return IAL_MOUSEEVENT; } diff --git a/src/ial/em8620.c b/src/ial/em8620.c index 09e74c53..a930c190 100644 --- a/src/ial/em8620.c +++ b/src/ial/em8620.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* -** em8620.c: IAL Engine for EM8620L -** +** em8620.c: IAL Engine for EM8620L +** ** Author: Zhang Xinhua (2005/10/xx) */ @@ -155,7 +155,7 @@ static void init_keymap(void) ir_pckey_map[RM_HW_ENT] = -1; ir_pckey_map[RM_HW_SETUP] = -1; ir_pckey_map[RM_HW_CLEAR] = -1; - ir_pckey_map[RM_HW_TVMODE] = -1; + ir_pckey_map[RM_HW_TVMODE] = -1; ir_pckey_map[RM_HW_PBC] = -1; ir_pckey_map[RM_HW_RETURN] = -1; ir_pckey_map[RM_HW_SHUFFLE] = -1; @@ -167,192 +167,192 @@ static int irvalue_key(unsigned int ir) { switch (ir) { case 0xea15e608: - return RM_ENTER; + return RM_ENTER; - case 0xbc43e608: - case 0xED12FF00: - return RM_HW_ON_OFF; + case 0xbc43e608: + case 0xED12FF00: + return RM_HW_ON_OFF; - case 0xa15ee608: - case 0xB649FF00: - return RM_HW_PROGRAM; + case 0xa15ee608: + case 0xB649FF00: + return RM_HW_PROGRAM; - case 0xeb14e608: - case 0xFE01FF00: - return RM_HW_UP; + case 0xeb14e608: + case 0xFE01FF00: + return RM_HW_UP; - case 0xe916e608: - case 0xF609FF00: - return RM_HW_DOWN; + case 0xe916e608: + case 0xF609FF00: + return RM_HW_DOWN; - case 0xe21de608: - case 0xE619FF00: - return RM_HW_LEFT; + case 0xe21de608: + case 0xE619FF00: + return RM_HW_LEFT; - case 0xee11e608: - case 0xEE11FF00: - return RM_HW_RIGHT; + case 0xee11e608: + case 0xEE11FF00: + return RM_HW_RIGHT; - //case 0xea15e608: - case 0xBF40FF00: - return RM_HW_SELECT; + //case 0xea15e608: + case 0xBF40FF00: + return RM_HW_SELECT; - case 0xed12e608: - case 0xE01FFF00: - return RM_HW_MENU; + case 0xed12e608: + case 0xE01FFF00: + return RM_HW_MENU; - case 0xa55ae608: - case 0xE11EFF00: - return RM_HW_TITLE; + case 0xa55ae608: + case 0xE11EFF00: + return RM_HW_TITLE; - case 0xa25de608: - case 0xE718FF00: - return RM_HW_OSD; + case 0xa25de608: + case 0xE718FF00: + return RM_HW_OSD; - case 0xad52e608: - case 0xFC03FF00: - return RM_HW_LANGUAGE; + case 0xad52e608: + case 0xFC03FF00: + return RM_HW_LANGUAGE; - case 0xa45be608: - case 0xEB14FF00: - return RM_HW_ANGLE; + case 0xa45be608: + case 0xEB14FF00: + return RM_HW_ANGLE; - case 0xa956e608: - case 0xE21DFF00: - return RM_HW_SUB_TITLE; + case 0xa956e608: + case 0xE21DFF00: + return RM_HW_SUB_TITLE; - case 0xe817e608: - case 0xE817FF00: - return RM_HW_PAUSE; + case 0xe817e608: + case 0xE817FF00: + return RM_HW_PAUSE; - case 0xab54e608: - case 0xFB04FF00: - return RM_HW_STOP; + case 0xab54e608: + case 0xFB04FF00: + return RM_HW_STOP; - case 0xaa55e608: - case 0xF807FF00: - return RM_HW_PAUSE_PLAY; + case 0xaa55e608: + case 0xF807FF00: + return RM_HW_PAUSE_PLAY; - case 0xb847e608: - case 0xE916FF00: - return RM_HW_EJECT; + case 0xb847e608: + case 0xE916FF00: + return RM_HW_EJECT; - case 0xa758e608: - case 0xF00FFF00: - return RM_HW_FAST_REWIND; + case 0xa758e608: + case 0xF00FFF00: + return RM_HW_FAST_REWIND; - case 0xaf50e608: - case 0xF10EFF00: - return RM_HW_FAST_FORWARD; + case 0xaf50e608: + case 0xF10EFF00: + return RM_HW_FAST_FORWARD; - case 0xa659e608: - return RM_HW_SLOW_REVERSE; + case 0xa659e608: + return RM_HW_SLOW_REVERSE; - case 0xae51e608: - return RM_HW_SLOW_FORWARD; + case 0xae51e608: + return RM_HW_SLOW_FORWARD; - case 0xa35ce608: - return RM_HW_REPEAT; + case 0xa35ce608: + return RM_HW_REPEAT; - case 0xe01fe608: - return RM_HW_AB_REPEAT; + case 0xe01fe608: + return RM_HW_AB_REPEAT; - case 0xe41be608: - case 0xFD02FF00: - return RM_HW_PREV_TRACK; + case 0xe41be608: + case 0xFD02FF00: + return RM_HW_PREV_TRACK; - case 0xec13e608: - case 0xF50AFF00: - return RM_HW_NEXT_TRACK; + case 0xec13e608: + case 0xF50AFF00: + return RM_HW_NEXT_TRACK; - case 0xe718e608: - case 0xF20DFF00: - return RM_HW_VOL_PLUS; + case 0xe718e608: + case 0xF20DFF00: + return RM_HW_VOL_PLUS; - case 0xef10e608: - case 0xEC13FF00: - return RM_HW_VOL_MINUS; + case 0xef10e608: + case 0xEC13FF00: + return RM_HW_VOL_MINUS; - case 0xe619e608: - case 0xE31CFF00: - return RM_HW_MUTE; + case 0xe619e608: + case 0xE31CFF00: + return RM_HW_MUTE; - case 0xbd42e608: - case 0xBE41FF00: - return RM_HW_KEY_1; + case 0xbd42e608: + case 0xBE41FF00: + return RM_HW_KEY_1; - case 0xbe41e608: - case 0xB24DFF00: - return RM_HW_KEY_2; + case 0xbe41e608: + case 0xB24DFF00: + return RM_HW_KEY_2; - case 0xbf40e608: - case 0xBA45FF00: - return RM_HW_KEY_3; + case 0xbf40e608: + case 0xBA45FF00: + return RM_HW_KEY_3; - case 0xb946e608: - case 0xBD42FF00: - return RM_HW_KEY_4; + case 0xb946e608: + case 0xBD42FF00: + return RM_HW_KEY_4; - case 0xba45e608: - case 0xB14EFF00: - return RM_HW_KEY_5; + case 0xba45e608: + case 0xB14EFF00: + return RM_HW_KEY_5; - case 0xbb44e608: - case 0xB946FF00: - return RM_HW_KEY_6; + case 0xbb44e608: + case 0xB946FF00: + return RM_HW_KEY_6; - case 0xb54ae608: - case 0xBC43FF00: - return RM_HW_KEY_7; + case 0xb54ae608: + case 0xBC43FF00: + return RM_HW_KEY_7; - case 0xb649e608: - case 0xB04FFF00: - return RM_HW_KEY_8; + case 0xb649e608: + case 0xB04FFF00: + return RM_HW_KEY_8; - case 0xb748e608: - case 0xB847FF00: - return RM_HW_KEY_9; + case 0xb748e608: + case 0xB847FF00: + return RM_HW_KEY_9; - case 0xb24de608: - case 0xFF00FF00: - return RM_HW_KEY_0; + case 0xb24de608: + case 0xFF00FF00: + return RM_HW_KEY_0; - case 0xb34ce608: - case 0xF30CFF00: - return RM_HW_ENT; + case 0xb34ce608: + case 0xF30CFF00: + return RM_HW_ENT; - case 0xe51ae608: - return RM_HW_SETUP; + case 0xe51ae608: + return RM_HW_SETUP; - case 0xb14ee608: - return RM_HW_CLEAR; + case 0xb14ee608: + return RM_HW_CLEAR; - case 0xb44be608: - return RM_HW_TVMODE; + case 0xb44be608: + return RM_HW_TVMODE; - case 0xe31ce608: - return RM_HW_PBC; + case 0xe31ce608: + return RM_HW_PBC; - case 0xe11ee608: - return RM_HW_RETURN; + case 0xe11ee608: + return RM_HW_RETURN; - case 0xa05fe608: - return RM_HW_SHUFFLE; + case 0xa05fe608: + return RM_HW_SHUFFLE; - case 0xa857e608: - return RM_HW_SEARCH; + case 0xa857e608: + return RM_HW_SEARCH; - case 0xac53e608: - return RM_HW_ZOOM; + case 0xac53e608: + return RM_HW_ZOOM; case 0x0: case 0x10: case NEC_REPEAT_CODE: return -1; - default: - return RM_HW_TIMEOUT; - } + default: + return RM_HW_TIMEOUT; + } } static int keyboard_update(void) @@ -370,24 +370,15 @@ static const char * keyboard_get_state(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { unsigned int fkey; int key, e = 0; fd_set rfds; if (cur_key >= 0 || button) { -#ifdef _LITE_VERSION select(maxfd + 1, in, out, except, timeout); -#else - select(FD_SETSIZE, in, out, except, timeout); -#endif if (cur_key >= 0) { cur_key = -1; e = IAL_KEYEVENT; @@ -407,15 +398,10 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } FD_SET(fip_fd, in); -#ifdef _LITE_VERSION if (fip_fd > maxfd) maxfd = fip_fd; e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif - if (e > 0 && fip_fd >= 0 && FD_ISSET(fip_fd, in)) { FD_CLR (fip_fd, in); read(fip_fd, &fkey, 4); @@ -502,7 +488,7 @@ BOOL InitEm8620Input(INPUT * input, const char * mdev, const char * mtype) (g_rcScr.top + g_rcScr.bottom) / 2); init_keymap(); - + return TRUE; } diff --git a/src/ial/embest2410.c b/src/ial/embest2410.c index 3f295d19..def97d63 100644 --- a/src/ial/embest2410.c +++ b/src/ial/embest2410.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** embest2410.c: Low Level Input Engine for EMBEST ARM2410 -** +** ** Created by Cheng Jiangang, 2004/09/22 */ @@ -111,13 +111,8 @@ static int mouse_getbutton(void) } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -130,18 +125,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { short data [4]; @@ -190,7 +178,7 @@ BOOL InitEMBEST2410Input (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x = pos.y = pos.b = 0; - + return TRUE; } diff --git a/src/ial/embest44b0.c b/src/ial/embest44b0.c index a7a63aa8..8c5c9958 100644 --- a/src/ial/embest44b0.c +++ b/src/ial/embest44b0.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** hh44b0.c: Low Level Input Engine for Embest ARM44B0 -** +** ** Created by Zhang Xinhua, 2005/06/xx. */ @@ -68,8 +68,8 @@ #include "ial.h" #include "hh44b0.h" -#define I2C_SET_DATA_ADDR 0x0601 -#define I2C_SET_BUS_CLOCK 0x0602 +#define I2C_SET_DATA_ADDR 0x0601 +#define I2C_SET_BUS_CLOCK 0x0602 /* for data reading from /dev/keyboard/0raw */ static int btn_fd = -1; @@ -143,13 +143,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -164,16 +159,10 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_KEYEVENT) && btn_fd >= 0) { FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif + e = select (maxfd + 1, in, out, except, timeout) ; if (e > 0) { if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) { FD_CLR(btn_fd, in); diff --git a/src/ial/ep7211.c b/src/ial/ep7211.c index 6eece0c5..b6202c2a 100644 --- a/src/ial/ep7211.c +++ b/src/ial/ep7211.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ep7211.c: Low Level Input Engine for EP7211. -** +** ** Created by Wei Yongming, 2000/08/24 */ @@ -69,7 +69,7 @@ #include "ial.h" #include "ep7211.h" -#define TSTHRESHOLD 0x545e +#define TSTHRESHOLD 0x545e static int ts; static int mousex = 0; @@ -84,62 +84,61 @@ static TSP tsp; void convert(POS * tempos) { int x0, y0; - tempos->x -= tsp.xbase; + tempos->x -= tsp.xbase; tempos->y -= tsp.ybase; - x0 = tempos->x; + x0 = tempos->x; y0 = tempos->y; tempos->x -= y0 * (tsp.xdlt + x0 * tsp.xdlt2 / tsp.xsize) / tsp.ysize; tempos->y -= x0 * (tsp.ydlt + y0 * tsp.ydlt2 / tsp.ysize) / tsp.xsize; - tempos->x = tempos->x*320/tsp.xsize; + tempos->x = tempos->x*320/tsp.xsize; tempos->y = tempos->y*240/tsp.ysize; } static int mouse_update(void) { - if ( (pos.x + pos.y) != 0 ) - convert(&pos); - if ( pos.x < 0 || pos.y < 0 ) - return 0; + if ( (pos.x + pos.y) != 0 ) + convert(&pos); + if ( pos.x < 0 || pos.y < 0 ) + return 0; truepos.x = pos.x; truepos.y = pos.y; - return 1; + return 1; } static void mouse_getxy(int* x, int* y) { - *x = truepos.x; - *y = truepos.x; + *x = truepos.x; + *y = truepos.x; } static int mouse_getbutton(void) { - if ( (truepos.x + truepos.y) != 0 && (mousex + mousey) == 0 ) - { - mousex = truepos.x; - mousey = truepos.y; - return IAL_MOUSE_LEFTBUTTON; - } - else if ( (truepos.x + truepos.y) == 0 && (mousex + mousey) != 0 ) - { - mousex = 0; - mousey = 0; - return 0; - } - return 0; + if ( (truepos.x + truepos.y) != 0 && (mousex + mousey) == 0 ) + { + mousex = truepos.x; + mousey = truepos.y; + return IAL_MOUSE_LEFTBUTTON; + } + else if ( (truepos.x + truepos.y) == 0 && (mousex + mousey) != 0 ) + { + mousex = 0; + mousey = 0; + return 0; + } + return 0; } static int keyboard_update(void) { - return 0; + return 0; } static const char* keyboard_getstate(void) { - return NULL; + return NULL; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { @@ -153,9 +152,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if (which & IAL_MOUSEEVENT) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } e = select (maxfd+1, in, out, except, timeout); @@ -164,7 +161,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex /* If data is present on the touchsreen fd, service it: */ if (FD_ISSET (ts, in)) { - read (ts, &pos, sizeof(POS)); + read (ts, &pos, sizeof(POS)); FD_CLR (ts, in); return IAL_MOUSEEVENT; } @@ -176,55 +173,55 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex return 0; } -#else +#if 0 static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { int timeout_ms; - struct pollfd ufd; + struct pollfd ufd; if (timeout) timeout_ms = timeout->tv_sec * 1000 + timeout->tv_usec / 1000; else timeout_ms = -1; - if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT) - { - ufd.fd = ts; - ufd.events = POLLIN; - if ( poll (&ufd, 1, timeout_ms) > 0) - { - read (ts, &pos, sizeof(POS)); - return IAL_MOUSEEVENT; - } - } - return 0; + if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT) + { + ufd.fd = ts; + ufd.events = POLLIN; + if ( poll (&ufd, 1, timeout_ms) > 0) + { + read (ts, &pos, sizeof(POS)); + return IAL_MOUSEEVENT; + } + } + return 0; } #endif BOOL InitEP7211Input (INPUT* input, const char* mdev, const char* mtype) { - int fs_data; - THRESHOLD threshold; + int fs_data; + THRESHOLD threshold; if(!access("/etc/ts.conf",R_OK)) - { - read(fs_data=open("/etc/ts.conf",0),&tsp,sizeof(tsp)); - close(fs_data); - threshold.x = tsp.xthrsd; - threshold.y = tsp.ythrsd; - } - else - { - fprintf(stderr,"IAL: Can not set touch screet threshold!\n"); - return FALSE; - } - ts = open ("/dev/ts",O_RDONLY); + { + read(fs_data=open("/etc/ts.conf",0),&tsp,sizeof(tsp)); + close(fs_data); + threshold.x = tsp.xthrsd; + threshold.y = tsp.ythrsd; + } + else + { + fprintf(stderr,"IAL: Can not set touch screet threshold!\n"); + return FALSE; + } + ts = open ("/dev/ts",O_RDONLY); if ( ts < 0 ) { fprintf (stderr, "IAL: Can not open touch screen!\n"); return FALSE; } - ioctl(ts,TSTHRESHOLD,&threshold); + ioctl(ts,TSTHRESHOLD,&threshold); input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; @@ -237,14 +234,14 @@ BOOL InitEP7211Input (INPUT* input, const char* mdev, const char* mtype) input->set_leds = NULL; input->wait_event = wait_event; - mousex = 0; - mousey = 0; + mousex = 0; + mousey = 0; return TRUE; } void TermEP7211Input (void) { - close(ts); + close(ts); } #endif /* _EP7211_IAL */ diff --git a/src/ial/evmv10.c b/src/ial/evmv10.c index 9e3369e4..0f77bd39 100644 --- a/src/ial/evmv10.c +++ b/src/ial/evmv10.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** evmv10e.c: Low Level Input Engine for DigiPro xScale EVMV 1.0. -** +** ** Created by Yao Yunyuan, 2004/08/20 */ @@ -68,7 +68,7 @@ #include #include "ial.h" -#include "evmv10.h" +#include "evmv10.h" #define _DEBUG_EVMV10 0 @@ -111,7 +111,7 @@ static void mouse_getxy(int *x, int* y) { *x = pos.x; *y = pos.y; - + } static int mouse_getbutton(void) @@ -148,13 +148,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -166,26 +161,17 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && kb_fd >= 0){ FD_SET (kb_fd, in); -#ifdef _LITE_VERSION if(kb_fd > maxfd) maxfd = kb_fd; -#endif } -#ifdef _LITE_VERSION if ( select (maxfd + 1, in, out, except, timeout) < 0 ) -#else - if ( select (FD_SETSIZE, in, out, except, timeout) < 0 ) -#endif - return -1; - - if (ts >= 0 && FD_ISSET (ts, in)) - { + return -1; + + if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); if ( read (ts, &pos, sizeof (POS)) == sizeof(POS) ) { pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 ); @@ -196,7 +182,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, return -1; } } - + if (kb_fd >= 0 && FD_ISSET(kb_fd, in)) { diff --git a/src/ial/fft7202.c b/src/ial/fft7202.c index 2afa3bca..9c9b332b 100644 --- a/src/ial/fft7202.c +++ b/src/ial/fft7202.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** fft7202.c: Low Level Input Engine for FFT 7202 -** +** ** The device driver of fft 7202 touch screen is compliant to ** the Specification for Generic Touch Screen Driver. ** Please see the file: spec_general_ts_drv.html in this directory. @@ -117,13 +117,8 @@ static int mouse_getbutton(void) return pos.b; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -136,18 +131,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { short data [4]; @@ -191,7 +179,7 @@ BOOL InitFFTInput (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x = pos.y = pos.b = 0; - + return TRUE; } diff --git a/src/ial/figueroa.c b/src/ial/figueroa.c index 5b1e224b..5f018106 100644 --- a/src/ial/figueroa.c +++ b/src/ial/figueroa.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** figueroa.c: Low Level Input Engine for D2 FiguaOA ** This driver can run on Linux. - ** + ** ** Created by Libo Jiao, 2001/08/20 */ @@ -80,57 +80,57 @@ static int key, old_key = -1; #ifdef QEMU static int key_mapper[][2] = { - {2,SCANCODE_1}, - {3,SCANCODE_2}, - {4,SCANCODE_3}, - {5,SCANCODE_4}, - {6,SCANCODE_5}, - {7,SCANCODE_6}, - {8,SCANCODE_7}, - {9,SCANCODE_8}, - {10,SCANCODE_9}, - {11,SCANCODE_0}, - {59,SCANCODE_F1}, - {60,SCANCODE_F2}, - {61,SCANCODE_F3}, - {62,SCANCODE_F4}, - {63,SCANCODE_F5}, - {64,SCANCODE_F6}, - {65,SCANCODE_F7}, - {66,SCANCODE_F8}, - {67,SCANCODE_F9}, - {68,SCANCODE_F10}, - {103,SCANCODE_CURSORBLOCKUP}, - {105,SCANCODE_CURSORBLOCKLEFT}, - {106,SCANCODE_CURSORBLOCKRIGHT}, - {108,SCANCODE_CURSORBLOCKDOWN} + {2,SCANCODE_1}, + {3,SCANCODE_2}, + {4,SCANCODE_3}, + {5,SCANCODE_4}, + {6,SCANCODE_5}, + {7,SCANCODE_6}, + {8,SCANCODE_7}, + {9,SCANCODE_8}, + {10,SCANCODE_9}, + {11,SCANCODE_0}, + {59,SCANCODE_F1}, + {60,SCANCODE_F2}, + {61,SCANCODE_F3}, + {62,SCANCODE_F4}, + {63,SCANCODE_F5}, + {64,SCANCODE_F6}, + {65,SCANCODE_F7}, + {66,SCANCODE_F8}, + {67,SCANCODE_F9}, + {68,SCANCODE_F10}, + {103,SCANCODE_CURSORBLOCKUP}, + {105,SCANCODE_CURSORBLOCKLEFT}, + {106,SCANCODE_CURSORBLOCKRIGHT}, + {108,SCANCODE_CURSORBLOCKDOWN} }; #else static int key_mapper[][2] = { - {1,SCANCODE_1}, - {2,SCANCODE_2}, - {3,SCANCODE_3}, - {4,SCANCODE_4}, - {5,SCANCODE_5}, - {6,SCANCODE_6}, - {7,SCANCODE_7}, - {8,SCANCODE_8}, - {9,SCANCODE_9}, - {10,SCANCODE_0}, - {11,SCANCODE_F1}, - {12,SCANCODE_F2}, - {17,SCANCODE_CURSORBLOCKUP}, - {18,SCANCODE_CURSORBLOCKDOWN}, - {19,SCANCODE_CURSORBLOCKLEFT}, - {20,SCANCODE_CURSORBLOCKRIGHT}, - {33,SCANCODE_F3}, - {34,SCANCODE_F4}, - {35,SCANCODE_F5}, - {36,SCANCODE_F6}, - {37,SCANCODE_F7}, - {39,SCANCODE_F8}, - {40,SCANCODE_F9}, - {41,SCANCODE_F10} + {1,SCANCODE_1}, + {2,SCANCODE_2}, + {3,SCANCODE_3}, + {4,SCANCODE_4}, + {5,SCANCODE_5}, + {6,SCANCODE_6}, + {7,SCANCODE_7}, + {8,SCANCODE_8}, + {9,SCANCODE_9}, + {10,SCANCODE_0}, + {11,SCANCODE_F1}, + {12,SCANCODE_F2}, + {17,SCANCODE_CURSORBLOCKUP}, + {18,SCANCODE_CURSORBLOCKDOWN}, + {19,SCANCODE_CURSORBLOCKLEFT}, + {20,SCANCODE_CURSORBLOCKRIGHT}, + {33,SCANCODE_F3}, + {34,SCANCODE_F4}, + {35,SCANCODE_F5}, + {36,SCANCODE_F6}, + {37,SCANCODE_F7}, + {39,SCANCODE_F8}, + {40,SCANCODE_F9}, + {41,SCANCODE_F10} }; #endif @@ -151,31 +151,31 @@ static int keyboard_update(void) status = (key == old_key)? 0 : 1; if (status == 0) old_key = -1; - else + else old_key = key; - m = 0; - n = sizeof(key_mapper)/sizeof(int*)-1; + m = 0; + n = sizeof(key_mapper)/sizeof(int*)-1; - while(mkey_mapper[half][0]){ - if(m==half) m++ ; else m = half;} - else - n = half; - } - if(m==n && key==key_mapper[m][0]){ -// printf("%d:getKey=%d\n",__LINE__,key); - state[key_mapper[m][1]] = status; - } - else - printf("undefined state\n"); - return NR_KEYS; + while(mkey_mapper[half][0]){ + if(m==half) m++ ; else m = half;} + else + n = half; + } + if(m==n && key==key_mapper[m][0]){ +// printf("%d:getKey=%d\n",__LINE__,key); + state[key_mapper[m][1]] = status; + } + else + printf("undefined state\n"); + return NR_KEYS; } static const char* keyboard_getstate(void) @@ -183,13 +183,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -203,21 +198,12 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; - -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) - { + if (e > 0) { if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) { FD_CLR(btn_fd, in); diff --git a/src/ial/fip.c b/src/ial/fip.c index f8138f4a..2f9bf915 100644 --- a/src/ial/fip.c +++ b/src/ial/fip.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** fip.c: IAL Engine for EM85xx Front Panel and Remote Controller ** This IAL engine is made for PLAYER_NEXTBASE. -** +** ** Author: Wei Yongming (2003/12/28) */ @@ -231,24 +231,15 @@ static const char * keyboard_get_state(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { unsigned int key; if (cur_key || button) { int e = 0; -#ifdef _LITE_VERSION select (maxfd + 1, in, out, except, timeout); -#else - select (FD_SETSIZE, in, out, except, timeout); -#endif if (cur_key) { cur_key = 0; e = IAL_KEYEVENT; diff --git a/src/ial/fxrm9200.c b/src/ial/fxrm9200.c index 19f879e0..f55800af 100644 --- a/src/ial/fxrm9200.c +++ b/src/ial/fxrm9200.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** fxrm9200.c: Low Level Input Engine for fuxu rm9200. ** This engine runs on uClinux. -** +** ** Created by pan weiguo, 2004/07/20 */ @@ -110,7 +110,7 @@ static unsigned char cur_scancode; static unsigned char simulate_up; static unsigned char keystate [NR_KEYS]; -#define MIN_KPD_SCANCODE 0 +#define MIN_KPD_SCANCODE 0 #define MAX_KPD_SCANCODE 15 static unsigned char keypd2pc_map [MAX_KPD_SCANCODE - MIN_KPD_SCANCODE + 1] = @@ -143,13 +143,8 @@ static const char* keyboard_getspdtate(void) return (char *)keystate; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -158,12 +153,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, /* simulate the release of the key */ if (cur_scancode) { -#ifdef _LITE_VERSION select (maxfd + 1, in, out, except, timeout); -#else - select (FD_SETSIZE, in, out, except, timeout); -#endif - if (cur_scancode) { keystate [cur_scancode] = 0; cur_scancode = 0; @@ -185,24 +175,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && tspd >= 0) { FD_SET (tspd, in); -#ifdef _LITE_VERSION if (tspd > maxfd) maxfd = tspd; -#endif } if ((which & IAL_KEYEVENT) && keypd >= 0){ FD_SET (keypd, in); -#ifdef _LITE_VERSION if (keypd > maxfd) maxfd = keypd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (tspd >= 0 && FD_ISSET (tspd, in)) { TOUCHINFO touch_info; diff --git a/src/ial/fz_custom.c b/src/ial/fz_custom.c index a2eb9b66..b10f1090 100644 --- a/src/ial/fz_custom.c +++ b/src/ial/fz_custom.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -112,13 +112,8 @@ static int mouse_getbutton(void) return ts_event.pressure; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -131,30 +126,24 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { + e = select (maxfd + 1, in, out, except, timeout) ; + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { - int rs; + int rs; FD_CLR (ts, in); ts_event.x=0; ts_event.y=0; printf ("begin to read\n"); - rs = read (ts, &ts_event, sizeof (TS_EVENT)); - //rs = read (ts, &ts_event, sizeof (TS_EVENT)); - printf ("rs = %d\n", rs); - if (rs != sizeof(TS_EVENT)) - return -1; - + rs = read (ts, &ts_event, sizeof (TS_EVENT)); + //rs = read (ts, &ts_event, sizeof (TS_EVENT)); + printf ("rs = %d\n", rs); + if (rs != sizeof(TS_EVENT)) + return -1; + if (ts_event.pressure > 0) { mousex = ts_event.x; mousey = ts_event.y; @@ -169,7 +158,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, retvalue |= IAL_MOUSEEVENT; } - } + } else if (e < 0) { return -1; } @@ -198,14 +187,14 @@ BOOL InitCustomInput (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; ts_event.x = ts_event.y = ts_event.pressure = 0; - + return TRUE; } -void TermCustomInput(void) +void TermCustomInput(void) { if (ts >= 0) - close(ts); + close(ts); } #endif /* _SMDK2410_IAL */ diff --git a/src/ial/helio.c b/src/ial/helio.c index c588dbd6..cdaef6c8 100644 --- a/src/ial/helio.c +++ b/src/ial/helio.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** helio.c: Low Level Input Engine for Helio Touch Panel -** +** ** Created by Wei YongMing, 2001/01/17 */ @@ -100,7 +100,7 @@ typedef struct */ int a, b, c, d, e, f, s; -} TRANSF_COEF; +} TRANSF_COEF; static TRANSF_COEF tc; @@ -120,7 +120,7 @@ static int GetPointerCalibrationData(void) if ( f == NULL ) { /* now if we can't open /etc/pointercal, we should launch an application * to calibrate touch panel. so we should disable enable_coor_transf - * so that the application could get raw data from touch panel + * so that the application could get raw data from touch panel */ enable_coor_transf = 0; return 0; @@ -129,7 +129,7 @@ static int GetPointerCalibrationData(void) items = fscanf(f, "%d %d %d %d %d %d %d", &tc.a, &tc.b, &tc.c, &tc.d, &tc.e, &tc.f, &tc.s); if ( items != 7 ) { - fprintf(stderr, "Improperly formatted pointer calibration file %s.\n", cal_filename); + fprintf(stderr, "Improperly formatted pointer calibration file %s.\n", cal_filename); return -1; } @@ -186,7 +186,7 @@ static int PD_Open(void) tp_fd = open(TPH_DEV_FILE, O_RDONLY); if (tp_fd < 0) { - fprintf(stderr, "Error %d opening touch panel\n", errno); + fprintf(stderr, "Error %d opening touch panel\n", errno); return -1; } #ifdef _TP_TSBREF @@ -207,10 +207,10 @@ static int PD_Open(void) s.settletime = settle_upper_limit * 50 / 100; result = ioctl(tp_fd, TPSETSCANPARM, &s); if ( result < 0 ) - fprintf(stderr, "Error %d, result %d setting scan parameters.\n", result, errno); + fprintf(stderr, "Error %d, result %d setting scan parameters.\n", result, errno); #endif - if (enable_coor_transf) { + if (enable_coor_transf) { if (GetPointerCalibrationData() < 0) { close (tp_fd); return -1; @@ -510,13 +510,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int e; @@ -530,32 +525,23 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (which & IAL_MOUSEEVENT) { FD_SET (tp_fd, in); -#ifdef _LITE_VERSION if (tp_fd > maxfd) maxfd = tp_fd; -#endif } #ifdef _HELIO_BUTTONS if (which & IAL_KEYEVENT){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } #endif -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (tp_fd >= 0 && FD_ISSET (tp_fd, in)) { FD_CLR (tp_fd, in); result = PD_Read(&tp_px, &tp_py, &tp_pz, &tp_pb); if (result > 0) { - retvalue |= IAL_MOUSEEVENT; + retvalue |= IAL_MOUSEEVENT; } } #ifdef _HELIO_BUTTONS diff --git a/src/ial/hh2410r3.c b/src/ial/hh2410r3.c index b0cb1858..2fc633d2 100644 --- a/src/ial/hh2410r3.c +++ b/src/ial/hh2410r3.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -111,13 +111,8 @@ static int mouse_getbutton(void) return ts_event.pressure; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -130,27 +125,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) - { - if (ts >= 0 && FD_ISSET (ts, in)) - { + e = select (maxfd + 1, in, out, except, timeout) ; + if (e > 0) { + if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); - //usleep(1); + //usleep(1); ts_event.x=0; ts_event.y=0; - read (ts, &ts_event, sizeof (TS_EVENT)); - + read (ts, &ts_event, sizeof (TS_EVENT)); + if (ts_event.pressure > 0) { mousex = ts_event.x; mousey = ts_event.y; @@ -164,8 +151,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, ts_event.pressure = ( ts_event.pressure > 0 ? IAL_MOUSE_LEFTBUTTON:0); retvalue |= IAL_MOUSEEVENT; } - - } + } else if (e < 0) { return -1; } @@ -191,14 +177,14 @@ BOOL InitHH2410R3Input(INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; ts_event.x = ts_event.y = ts_event.pressure = 0; - + return TRUE; } void TermHH2410R3Input(void) { if (ts >= 0) - close(ts); + close(ts); } #endif /* _HH2410R3_IAL */ diff --git a/src/ial/hh2440.c b/src/ial/hh2440.c index 63082ecd..00df2922 100644 --- a/src/ial/hh2440.c +++ b/src/ial/hh2440.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -115,14 +115,14 @@ static void mouse_getxy (int *x, int* y) for (i = 1; i < nr_events; i++) { if (ts_events [i].x > max_x) { - max_x = ts_events [i].x; + max_x = ts_events [i].x; max_event = i; - } + } if (ts_events [i].x < min_x) { - min_x = ts_events [i].x; + min_x = ts_events [i].x; min_event = i; - } + } } for (i = 0; i < nr_events; i++) { @@ -132,14 +132,14 @@ static void mouse_getxy (int *x, int* y) } } - if (max_event == min_event ) { - *x = sum_x / (nr_events - 1); - *y = sum_y / (nr_events - 1); - } - else { - *x = sum_x / (nr_events - 2); - *y = sum_y / (nr_events - 2); - } + if (max_event == min_event ) { + *x = sum_x / (nr_events - 1); + *y = sum_y / (nr_events - 1); + } + else { + *x = sum_x / (nr_events - 2); + *y = sum_y / (nr_events - 2); + } if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) { mousex = *x; @@ -164,13 +164,8 @@ static int mouse_getbutton (void) return button; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -183,18 +178,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { TS_EVENT ts_event; @@ -242,11 +230,11 @@ BOOL InitHH2440Input(INPUT* input, const char* mdev, const char* mtype) return TRUE; } -void TermHH2440Input (void) +void TermHH2440Input (void) { if (ts >= 0) - close (ts); + close (ts); } #endif /* _HH2440_IAL */ diff --git a/src/ial/hh5249kbdir.c b/src/ial/hh5249kbdir.c index 368075f9..f72dd86e 100644 --- a/src/ial/hh5249kbdir.c +++ b/src/ial/hh5249kbdir.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** hh5249kbdir.c: IAL Engine for HH5249 PS/2 keyboard and IrDA. -** +** ** Author: Wei Yongming (2004/05/19) */ @@ -121,39 +121,39 @@ static struct _irkey_scancode_map { {IRKEY_LH_INC, SCANCODE_USER+21}, {IRKEY_LH_DEC, SCANCODE_USER+22}, #else - {IRKEY_1, SCANCODE_ESCAPE}, - {IRKEY_2, SCANCODE_1}, - {IRKEY_3, SCANCODE_2}, - {IRKEY_4, SCANCODE_3}, - {IRKEY_5, SCANCODE_4}, - {IRKEY_6, SCANCODE_5}, - {IRKEY_7, SCANCODE_6}, - {IRKEY_8, SCANCODE_7}, - {IRKEY_9, SCANCODE_8}, - {IRKEY_10, SCANCODE_9}, - {IRKEY_11, SCANCODE_0}, - {IRKEY_12, SCANCODE_USER+2}, - {IRKEY_13, SCANCODE_USER+3}, - {IRKEY_14, SCANCODE_USER+4}, - {IRKEY_15, SCANCODE_USER+5}, - {IRKEY_16, SCANCODE_USER+6}, - {IRKEY_17, SCANCODE_TAB}, - {IRKEY_18, SCANCODE_USER+8}, - {IRKEY_19, SCANCODE_ENTER}, - {IRKEY_20, SCANCODE_USER+10}, - {IRKEY_21, SCANCODE_USER+11}, - {IRKEY_22, SCANCODE_BACKSPACE}, - {IRKEY_23, SCANCODE_USER+9}, - {IRKEY_24, SCANCODE_USER+14}, - {IRKEY_25, SCANCODE_USER+15}, - {IRKEY_26, SCANCODE_USER+16}, - {IRKEY_27, SCANCODE_USER+17}, - {IRKEY_28, SCANCODE_USER+18}, - {IRKEY_29, SCANCODE_USER+19}, - {IRKEY_30, SCANCODE_USER+20}, - {IRKEY_31, SCANCODE_USER+21}, - {IRKEY_32, SCANCODE_USER+22}, - {IRKEY_33, SCANCODE_USER+23}, + {IRKEY_1, SCANCODE_ESCAPE}, + {IRKEY_2, SCANCODE_1}, + {IRKEY_3, SCANCODE_2}, + {IRKEY_4, SCANCODE_3}, + {IRKEY_5, SCANCODE_4}, + {IRKEY_6, SCANCODE_5}, + {IRKEY_7, SCANCODE_6}, + {IRKEY_8, SCANCODE_7}, + {IRKEY_9, SCANCODE_8}, + {IRKEY_10, SCANCODE_9}, + {IRKEY_11, SCANCODE_0}, + {IRKEY_12, SCANCODE_USER+2}, + {IRKEY_13, SCANCODE_USER+3}, + {IRKEY_14, SCANCODE_USER+4}, + {IRKEY_15, SCANCODE_USER+5}, + {IRKEY_16, SCANCODE_USER+6}, + {IRKEY_17, SCANCODE_TAB}, + {IRKEY_18, SCANCODE_USER+8}, + {IRKEY_19, SCANCODE_ENTER}, + {IRKEY_20, SCANCODE_USER+10}, + {IRKEY_21, SCANCODE_USER+11}, + {IRKEY_22, SCANCODE_BACKSPACE}, + {IRKEY_23, SCANCODE_USER+9}, + {IRKEY_24, SCANCODE_USER+14}, + {IRKEY_25, SCANCODE_USER+15}, + {IRKEY_26, SCANCODE_USER+16}, + {IRKEY_27, SCANCODE_USER+17}, + {IRKEY_28, SCANCODE_USER+18}, + {IRKEY_29, SCANCODE_USER+19}, + {IRKEY_30, SCANCODE_USER+20}, + {IRKEY_31, SCANCODE_USER+21}, + {IRKEY_32, SCANCODE_USER+22}, + {IRKEY_33, SCANCODE_USER+23}, #endif }; @@ -182,13 +182,8 @@ static const char * keyboard_get_state(void) return (char *)key_state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -197,11 +192,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (cur_ir_scancode) { -#ifdef _LITE_VERSION select (maxfd + 1, in, out, except, timeout); -#else - select (FD_SETSIZE, in, out, except, timeout); -#endif if (cur_ir_scancode) { key_state [cur_ir_scancode] = 0; cur_ir_scancode = 0; @@ -221,18 +212,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, FD_SET (ps2kbd_fd, in); if (irkbd_fd >= 0) FD_SET (irkbd_fd, in); -#ifdef _LITE_VERSION if (MAX (ps2kbd_fd, irkbd_fd) > maxfd) maxfd = MAX (ps2kbd_fd, irkbd_fd); -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ps2kbd_fd >= 0 && FD_ISSET (ps2kbd_fd, in)) { unsigned char scancode; diff --git a/src/ial/hi3510.c b/src/ial/hi3510.c index 86cecc22..c0098f6d 100644 --- a/src/ial/hi3510.c +++ b/src/ial/hi3510.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -114,7 +114,7 @@ static int mouse_buttons; static struct SimKeyData kbd_data = { 0 }; static unsigned char kbd_state [MGUI_NR_KEYS + 1] = { 0 }; -/*custom keys difined below are used for STB, +/*custom keys difined below are used for STB, those macros will put in common.h*/ /*power*/ #define SCANCODE_V_POWER (SCANCODE_USER) @@ -245,9 +245,9 @@ those macros will put in common.h*/ #define SCANCODE_V_INFO (SCANCODE_USER + 27) /* key map table*/ -static MAPITEM gs_stKeyMapTable [] = -{ - {0x0001, SCANCODE_SPACE , 0}, // Key_Space +static MAPITEM gs_stKeyMapTable [] = +{ + {0x0001, SCANCODE_SPACE , 0}, // Key_Space {0x0002, SCANCODE_APOSTROPHE , 0}, // Key_Apostrophe {0x0003, SCANCODE_COMMA , 0}, // Key_Comma {0x0005, SCANCODE_MINUS , 0}, // Key_Minus @@ -256,9 +256,9 @@ static MAPITEM gs_stKeyMapTable [] = {0x0008, SCANCODE_SEMICOLON , 0}, // Key_Semicolon {0x0009, SCANCODE_EQUAL , 0}, // Key_Equal {0x000A, SCANCODE_BACKSLASH , 0}, // Key_BracketLeft - {0x000B, SCANCODE_GRAVE , 0}, // Key_Backslash - {0x000C, SCANCODE_BRACKET_LEFT , 0}, // Key_BracketRight - {0x000D, SCANCODE_BRACKET_RIGHT , 0}, // Key_QuoteLeft = 0x60 + {0x000B, SCANCODE_GRAVE , 0}, // Key_Backslash + {0x000C, SCANCODE_BRACKET_LEFT , 0}, // Key_BracketRight + {0x000D, SCANCODE_BRACKET_RIGHT , 0}, // Key_QuoteLeft = 0x60 {0x000E, SCANCODE_0 , 0}, // Key_0 {0x000F, SCANCODE_1 , 0}, // Key_1 {0x0010, SCANCODE_2 , 0}, // Key_2 @@ -297,12 +297,12 @@ static MAPITEM gs_stKeyMapTable [] = {0x0031, SCANCODE_Z , 0}, // Key_Z {0x1001, SCANCODE_ESCAPE , 0}, // Key_Escape {0x1002, SCANCODE_TAB , 0}, // Key_Tab - {0x1003, SCANCODE_BACKSPACE , 0}, // Key_Backspace - {0x1004, SCANCODE_ENTER , 0}, // Key_Return + {0x1003, SCANCODE_BACKSPACE , 0}, // Key_Backspace + {0x1004, SCANCODE_ENTER , 0}, // Key_Return {0x1005, SCANCODE_INSERT , 0}, // Key_Insert {0x1006, SCANCODE_REMOVE , 0}, // Key_Delete {0x1007, SCANCODE_PAUSE , 0}, // Key_Pause - {0x1008, SCANCODE_PRINTSCREEN , 0}, // Key_Print + {0x1008, SCANCODE_PRINTSCREEN , 0}, // Key_Print {0x1009, SCANCODE_HOME , 0}, // Key_Home {0x100A, SCANCODE_END , 0}, // Key_End {0x100B, SCANCODE_CURSORBLOCKLEFT , 0}, // Key_Left @@ -312,7 +312,7 @@ static MAPITEM gs_stKeyMapTable [] = {0x100F, SCANCODE_PAGEUP , 0}, // Key_PageUp {0x1010, SCANCODE_PAGEDOWN , 0}, // Key_PageDown {0x1011, SCANCODE_LEFTSHIFT , 0}, // Key_Shift - {0x1012, SCANCODE_LEFTCONTROL , 0}, // Key_Control + {0x1012, SCANCODE_LEFTCONTROL , 0}, // Key_Control {0x1013, SCANCODE_LEFTALT , 0}, // Key_Alt {0x1014, SCANCODE_CAPSLOCK , 0}, // Key_CapsLock {0x1015, SCANCODE_NUMLOCK , 0}, // Key_NumLock @@ -328,58 +328,58 @@ static MAPITEM gs_stKeyMapTable [] = {0x101F, SCANCODE_F9 , 0}, // Key_F9 {0x1020, SCANCODE_F10 , 0}, // Key_F10 {0x1021, SCANCODE_F11 , 0}, // Key_F11 - {0x1022, SCANCODE_F12 , 0}, // Key_F12 - {0x1023, SCANCODE_MENU , 0}, // Key_Menu - {0x1101, SCANCODE_V_POWER , 0}, // - {0x1102, SCANCODE_V_MUTE , 0}, // - {0x1103, SCANCODE_V_NUM_1 , 0}, // - {0x1104, SCANCODE_V_NUM_2 , 0}, // + {0x1022, SCANCODE_F12 , 0}, // Key_F12 + {0x1023, SCANCODE_MENU , 0}, // Key_Menu + {0x1101, SCANCODE_V_POWER , 0}, // + {0x1102, SCANCODE_V_MUTE , 0}, // + {0x1103, SCANCODE_V_NUM_1 , 0}, // + {0x1104, SCANCODE_V_NUM_2 , 0}, // {0x1105, SCANCODE_V_NUM_3 , 0}, // - {0x1106, SCANCODE_V_NUM_4 , 0}, // - {0x1107, SCANCODE_V_NUM_5 , 0}, // - {0x1108, SCANCODE_V_NUM_6 , 0}, // - {0x1109, SCANCODE_V_NUM_7 , 0}, // - {0x1110, SCANCODE_V_NUM_8 , 0}, // + {0x1106, SCANCODE_V_NUM_4 , 0}, // + {0x1107, SCANCODE_V_NUM_5 , 0}, // + {0x1108, SCANCODE_V_NUM_6 , 0}, // + {0x1109, SCANCODE_V_NUM_7 , 0}, // + {0x1110, SCANCODE_V_NUM_8 , 0}, // {0x1111, SCANCODE_V_NUM_9 , 0}, // {0x1112, SCANCODE_V_NUM_0 , 0}, // - {0x1113, SCANCODE_V_SWITCH , 0}, // - {0x1114, SCANCODE_V_BACKSPACE , 0}, // - {0x1115, SCANCODE_V_CHANNEL , 0}, // - {0x1116, SCANCODE_V_MENU , 0}, // + {0x1113, SCANCODE_V_SWITCH , 0}, // + {0x1114, SCANCODE_V_BACKSPACE , 0}, // + {0x1115, SCANCODE_V_CHANNEL , 0}, // + {0x1116, SCANCODE_V_MENU , 0}, // {0x1117, SCANCODE_V_LEFT , 0}, // {0x1118, SCANCODE_V_RIGHT , 0}, // - {0x1119, SCANCODE_V_UP , 0}, // - {0x1120, SCANCODE_V_DOWN , 0}, // - {0x1121, SCANCODE_V_CONFIRM , 0}, // - {0x1122, SCANCODE_V_F1 , 0}, // + {0x1119, SCANCODE_V_UP , 0}, // + {0x1120, SCANCODE_V_DOWN , 0}, // + {0x1121, SCANCODE_V_CONFIRM , 0}, // + {0x1122, SCANCODE_V_F1 , 0}, // {0x1123, SCANCODE_V_F2 , 0}, // {0x1124, SCANCODE_V_F3 , 0}, // - {0x1125, SCANCODE_V_F4 , 0}, // - {0x1126, SCANCODE_V_GO_BACK , 0}, // - {0x1127, SCANCODE_V_FAVORITE , 0}, // - {0x1128, SCANCODE_V_IME , 0}, // + {0x1125, SCANCODE_V_F4 , 0}, // + {0x1126, SCANCODE_V_GO_BACK , 0}, // + {0x1127, SCANCODE_V_FAVORITE , 0}, // + {0x1128, SCANCODE_V_IME , 0}, // {0x1129, SCANCODE_V_ESCAPE , 0}, // {0x1130, SCANCODE_V_PLAY , 0}, // - {0x1131, SCANCODE_V_PAUSE , 0}, // - {0x1132, SCANCODE_V_STOP , 0}, // - {0x1133, SCANCODE_V_BACKWARD , 0}, // - {0x1134, SCANCODE_V_FORWARD , 0}, // + {0x1131, SCANCODE_V_PAUSE , 0}, // + {0x1132, SCANCODE_V_STOP , 0}, // + {0x1133, SCANCODE_V_BACKWARD , 0}, // + {0x1134, SCANCODE_V_FORWARD , 0}, // {0x1135, SCANCODE_V_LOCATE , 0}, // {0x1136, SCANCODE_V_VOLUME_UP , 0}, // - {0x1137, SCANCODE_V_VOLUME_DOWN , 0}, // - {0x1138, SCANCODE_V_SYSTEM , 0}, // - {0x1139, SCANCODE_V_CONFIG , 0}, // - {0x1140, SCANCODE_V_TRACK , 0}, // - {0x1141, SCANCODE_V_INFO , 0} // + {0x1137, SCANCODE_V_VOLUME_DOWN , 0}, // + {0x1138, SCANCODE_V_SYSTEM , 0}, // + {0x1139, SCANCODE_V_CONFIG , 0}, // + {0x1140, SCANCODE_V_TRACK , 0}, // + {0x1141, SCANCODE_V_INFO , 0} // }; static int gs_iCurPanelKeys = sizeof (gs_stKeyMapTable) / sizeof (MAPITEM); /*maxium scan code value of current mapping keys.*/ static int gs_iMaxScanCode = 0; - + /*number of mapping keys's events to be fetched by up UI.*/ -static int gs_iVKeysToBeHandled = 0; +static int gs_iVKeysToBeHandled = 0; /*store last key map item.*/ static MAPITEM gs_stMapItem = {0xffff, 0, 0}; @@ -390,7 +390,7 @@ static LPMAPITEM GetMapItem (int wIndex) int hig = gs_iCurPanelKeys - 1; int mid; - /* half-way finding.*/ + /* half-way finding.*/ while (low <= hig) { mid = (low + hig) / 2; @@ -412,10 +412,10 @@ static LPMAPITEM GetMapItem (int wIndex) } static void init_code_map (void) -{ +{ int i,j; MAPITEM stItem; - + gs_iMaxScanCode = 0; for (i = 0; i < gs_iCurPanelKeys; ++i) @@ -424,7 +424,7 @@ static void init_code_map (void) { gs_iMaxScanCode = gs_stKeyMapTable[i].btVirtualKey1; } - + if (gs_iMaxScanCode < gs_stKeyMapTable[i].btVirtualKey2) { gs_iMaxScanCode = gs_stKeyMapTable[i].btVirtualKey2; @@ -446,9 +446,9 @@ static void init_code_map (void) } } } - + /*maxium of scan code must greater than all keys' scan code*/ - gs_iMaxScanCode += 1; + gs_iMaxScanCode += 1; } /************************ Low Level Input Operations **********************/ @@ -475,9 +475,9 @@ static int mouse_update (void) { if( SIM_INPUT_TYPE_MOUSE == struSimInputData.ulInputType ) { - mouse_pt.x = (struSimInputData.ucContent[0] << 8) + mouse_pt.x = (struSimInputData.ucContent[0] << 8) | struSimInputData.ucContent[1]; - mouse_pt.y = (struSimInputData.ucContent[2] << 8) + mouse_pt.y = (struSimInputData.ucContent[2] << 8) | struSimInputData.ucContent[3]; mouse_buttons = struSimInputData.ucContent[4]; #ifdef _DEBUG @@ -531,7 +531,7 @@ static int keyboard_update (void) static BYTE s_btShiftState = 0; // up SIM_INPUT_MSG_S struSimInputData; int ret; - LPMAPITEM pItem; + LPMAPITEM pItem; int wKeyCode; struct sockaddr_in from; socklen_t fromsize; @@ -578,14 +578,14 @@ static int keyboard_update (void) } if (kbd_data.repeat) - { + { return 1; } - + #ifdef _DEBUG vlog( "IAL::keyboard_update:receiv key code %x\n", kbd_data.keycode); #endif /* _DEBUG */ - + wKeyCode = kbd_data.keycode; if((pItem = GetMapItem(wKeyCode)) == NULL) @@ -595,16 +595,16 @@ static int keyboard_update (void) #endif return 0; } - + gs_stMapItem = *pItem; if (gs_stMapItem.btVirtualKey1) - { - ++gs_iVKeysToBeHandled; + { + ++gs_iVKeysToBeHandled; } if (gs_stMapItem.btVirtualKey2) - { - ++gs_iVKeysToBeHandled; + { + ++gs_iVKeysToBeHandled; } } @@ -616,18 +616,18 @@ static int keyboard_update (void) { #ifdef _DEBUG vlog("map virtual key(%u) down message.\n",gs_stMapItem.btVirtualKey2); -#endif /* _DEBUG */ +#endif /* _DEBUG */ if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT) { s_btShiftState = kbd_data.press; } kbd_state [gs_stMapItem.btVirtualKey2] = 1; } - else + else { #ifdef _DEBUG vlog("map virtual key(%u) down message.\n",gs_stMapItem.btVirtualKey1); -#endif /* _DEBUG */ +#endif /* _DEBUG */ if (gs_stMapItem.btVirtualKey1 == SCANCODE_LEFTSHIFT) { s_btShiftState = kbd_data.press; @@ -639,7 +639,7 @@ static int keyboard_update (void) { if (gs_iVKeysToBeHandled == 2) { - if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT) + if (gs_stMapItem.btVirtualKey2 == SCANCODE_LEFTSHIFT) { if (s_btShiftState) { @@ -651,14 +651,14 @@ static int keyboard_update (void) return 0; } } - + #ifdef _DEBUG vlog("map virtual key(%u) up message.\n",gs_stMapItem.btVirtualKey2); -#endif /* _DEBUG */ - +#endif /* _DEBUG */ + kbd_state [gs_stMapItem.btVirtualKey2] = 0; } - else + else { if (gs_stMapItem.btVirtualKey1 == SCANCODE_LEFTSHIFT) { @@ -674,12 +674,12 @@ static int keyboard_update (void) } #ifdef _DEBUG vlog( "map virtual key(%u) up message.\n",gs_stMapItem.btVirtualKey1); -#endif /* _DEBUG */ - +#endif /* _DEBUG */ + kbd_state [gs_stMapItem.btVirtualKey1] = 0; } } - + --gs_iVKeysToBeHandled; return gs_iMaxScanCode; } @@ -689,7 +689,7 @@ static int keyboard_update (void) vlog( "keyboard_update:no message to be update\n"); #endif /* _DEBUG */ return 0; - } + } } static const char* keyboard_getstate (void) @@ -701,13 +701,8 @@ static const char* keyboard_getstate (void) } /* NOTE by weiym: Do not ignore the fd_set in, out, and except */ -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif /* _LITE_VERSION */ { fd_set rfds; int retvalue = 0; @@ -721,22 +716,22 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (which & IAL_KEYEVENT && (kbd_fd >= 0) ) { if (gs_iVKeysToBeHandled > 0) - { + { #ifdef _DEBUG vlog( "There are still some mapping virtual key " "to be handled, return immediately\n"); -#endif /* _DEBUG */ +#endif /* _DEBUG */ if (in) { FD_ZERO (in); } - + if (out) { FD_ZERO (out); } - + retvalue |= IAL_KEYEVENT; return retvalue; } @@ -745,27 +740,17 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, { fd = kbd_fd; FD_SET (kbd_fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif - } + } } - + if (which & IAL_MOUSEEVENT && mouse_fd >= 0) { fd = mouse_fd; FD_SET (fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif - } + } - /* FIXME: pass the real set size */ -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { fd = mouse_fd; /* If data is present on the mouse fd, service it: */ @@ -782,8 +767,8 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, FD_CLR (fd, in); retvalue |= IAL_KEYEVENT; key_flag |= KEYBOARD_NETWORK; - } - } else if (e < 0) { + } + } else if (e < 0) { return -1; } @@ -797,15 +782,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype) { - struct sockaddr_in addr; + struct sockaddr_in addr; int iRes; kbd_fd = socket(PF_INET, SOCK_DGRAM, 0); - + if (kbd_fd < 0) { return FALSE; - } + } bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; @@ -819,15 +804,15 @@ BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype) close(kbd_fd); fprintf (stderr, "Simulate Key Input Engine: Can not bind socket.\n"); return FALSE; - } + } mouse_fd = socket(PF_INET, SOCK_DGRAM, 0); - + if (mouse_fd < 0) { close(kbd_fd); return FALSE; - } + } bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; @@ -842,7 +827,7 @@ BOOL InitHI3510Input (INPUT* input, const char* mdev, const char* mtype) close(mouse_fd); fprintf (stderr, "Simulate Key Input Engine: Can not bind socket.\n"); return FALSE; - } + } input->update_mouse = mouse_update; diff --git a/src/ial/ial.c b/src/ial/ial.c index dc636996..f76362e2 100644 --- a/src/ial/ial.c +++ b/src/ial/ial.c @@ -194,7 +194,7 @@ static INPUT inputs [] = {"tslib", InitTSLibInput, TermTSLibInput}, #endif #ifdef _MGIAL_NEXUS - {"nexus", InitNexusInput, TermNexusInput}, + {"nexus", InitNexusInput, TermNexusInput}, #endif #ifdef _MGIAL_DAVINCI6446 {"davinci6446", InitDavinci6446Input, TermDavinci6446Input}, diff --git a/src/ial/init_ts.c b/src/ial/init_ts.c index baf949ad..a4015d1e 100644 --- a/src/ial/init_ts.c +++ b/src/ial/init_ts.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -56,14 +56,14 @@ #include #define MAXX 9 -#define MAXY 7 +#define MAXY 7 #define NOISX 900 #define NOISY 1900 #define CON 40 struct point { - int x; - int y; + int x; + int y; }; struct point array[MAXX][MAXY]; @@ -79,21 +79,21 @@ int change_to_logic(struct point *temp); */ int init_ts() { - int fd,size; + int fd,size; - if((fd=open("data.conf",O_RDONLY)) == -1) - { - perror("open"); - exit(1); - } + if((fd=open("data.conf",O_RDONLY)) == -1) + { + perror("open"); + exit(1); + } - if((size=read(fd, array,MAXX*MAXY*sizeof(struct point))) == -1) - { - perror("read error"); - return -1; - } - close(fd); - return 0; + if((size=read(fd, array,MAXX*MAXY*sizeof(struct point))) == -1) + { + perror("read error"); + return -1; + } + close(fd); + return 0; } /* @@ -102,76 +102,76 @@ int init_ts() */ int MapCoords(struct point *temp) { - int i,j; - float x,y; + int i,j; + float x,y; - i=j=0; + i=j=0; /* - temp1.x=NOISX; - temp1.y=NOISY; - ioctl(fd, TSTHRESHOLD, &temp1); + temp1.x=NOISX; + temp1.y=NOISY; + ioctl(fd, TSTHRESHOLD, &temp1); - if((size=read(fd, &temp,sizeof(struct point))) == -1) - { - perror("read error"); - exit(1); - } - close(fd); + if((size=read(fd, &temp,sizeof(struct point))) == -1) + { + perror("read error"); + exit(1); + } + close(fd); */ - get_up_point(&i,&j,*temp); - x = caculate_x(i,j,*temp); - y = caculate_y(i,j,*temp); - temp->x = CON*x; - temp->y = CON*y; - return 1; + get_up_point(&i,&j,*temp); + x = caculate_x(i,j,*temp); + y = caculate_y(i,j,*temp); + temp->x = CON*x; + temp->y = CON*y; + return 1; #ifdef DEBUG - printf("%f,%f\n",CON*x,CON*y); + printf("%f,%f\n",CON*x,CON*y); #endif } /* - * this function is used to determine the left up point - * argument real_point is the point which was read from + * this function is used to determine the left up point + * argument real_point is the point which was read from * device. */ int get_up_point(int *p, int *q, struct point real_point) { - int average_x[MAXX]; - int average_y[MAXY]; - int i ,j,total; + int average_x[MAXX]; + int average_y[MAXY]; + int i ,j,total; - for(i=0;i average_x[i]) - *p = i - 1; - break; - } + for(i=0;i average_y[i]) - *q = i - 1; - break; - } - return 1; + for(i=0;i average_x[i]) + *p = i - 1; + break; + } + + for(i = 0; i < MAXY; i ++) + { + if(real_point.y > average_y[i]) + *q = i - 1; + break; + } + return 1; } /* @@ -179,8 +179,8 @@ int get_up_point(int *p, int *q, struct point real_point) */ float caculate_x(int i,int j,struct point real_point) { - float t = (float)(real_point.x - array[i][j].x)/(array[i+1][j].x - array[i][j].x); - return i + t; + float t = (float)(real_point.x - array[i][j].x)/(array[i+1][j].x - array[i][j].x); + return i + t; } /* @@ -188,6 +188,6 @@ float caculate_x(int i,int j,struct point real_point) */ float caculate_y(int i,int j,struct point real_point) { - float t = (float)(real_point.y - array[i][j].y)/(array[i][j+1].y - array[i][j].y); - return j + t; + float t = (float)(real_point.y - array[i][j].y)/(array[i][j+1].y - array[i][j].y); + return j + t; } diff --git a/src/ial/ipaq-h3600.c b/src/ial/ipaq-h3600.c index 731551ba..756ca23f 100644 --- a/src/ial/ipaq-h3600.c +++ b/src/ial/ipaq-h3600.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ipaq-h3600.c: Low Level Input Engine for iPAQ H3600/H3800 ** This driver can run on eCos and Linux. -** +** ** The device driver of iPAQ H3600 touch screen is compliant to ** the Specification for Generic Touch Screen Driver. ** Please see the file: spec_general_ts_drv.html in this directory. @@ -149,16 +149,16 @@ static int keyboard_update(void) switch (key) { - case 1: + case 1: state[SCANCODE_LEFTSHIFT] = status; break; - case 2: + case 2: state[H3600_SCANCODE_CALENDAR] = status; break; - case 3: + case 3: state[H3600_SCANCODE_CONTACTS] = status; break; - case 4: + case 4: state[H3600_SCANCODE_Q] = status; break; case 5: @@ -206,24 +206,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifndef _MGRM_THREADS if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifndef _MGRM_THREADS if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifndef _MGRM_THREADS e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { short data [4]; @@ -287,7 +278,7 @@ BOOL InitIPAQH3600Input (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x = pos.y = pos.b = 0; - + return TRUE; } diff --git a/src/ial/ipaq-h5400.c b/src/ial/ipaq-h5400.c index 456e6767..b6cac642 100644 --- a/src/ial/ipaq-h5400.c +++ b/src/ial/ipaq-h5400.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ipaq-h5400.c: Low Level Input Engine for iPAQ H5400. -** +** ** Created by Wei Yongming, 2001/08/20 */ @@ -122,7 +122,7 @@ static int TTY_Open (void) * scancode sequences (e.g. E0 XX) onto single keycodes. */ ioctl (kbd_fd, KDGKBMODE, &startup_kbdmode); - if (ioctl(kbd_fd, KDSKBMODE, K_MEDIUMRAW) < 0) + if (ioctl(kbd_fd, KDSKBMODE, K_MEDIUMRAW) < 0) goto err; return kbd_fd; @@ -174,7 +174,7 @@ static int keyboard_update(void) int is_pressed; int retvalue; - retvalue = TTY_Read (&buf, &modifier); + retvalue = TTY_Read (&buf, &modifier); if ((retvalue == -1) || (retvalue == 0)) return 0; @@ -183,7 +183,7 @@ static int keyboard_update(void) is_pressed = !(buf & 0x80); ch = buf & 0x7f; switch (ch) { - //navigation mid + //navigation mid case 96: state[SCANCODE_ENTER] = is_pressed; break; @@ -193,33 +193,33 @@ static int keyboard_update(void) state[SCANCODE_CURSORBLOCKUP] = is_pressed; break; - //navigation left + //navigation left case 105: state[SCANCODE_CURSORBLOCKLEFT] = is_pressed; break; - //navigation right + //navigation right case 106: state[SCANCODE_CURSORBLOCKRIGHT] = is_pressed; break; - //navigation down + //navigation down case 108: state[SCANCODE_CURSORBLOCKDOWN] = is_pressed; break; //left 2 - case 122: + case 122: state[SCANCODE_F3] = is_pressed; break; //left 1 - case 123: + case 123: state[SCANCODE_F1] = is_pressed; break; //right 1 - case 124: + case 124: state[SCANCODE_F2] = is_pressed; break; @@ -335,24 +335,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex if ((which & IAL_MOUSEEVENT) && ts_fd >= 0) { FD_SET (ts_fd, in); -#ifndef _MGRM_THREADS if (ts_fd > maxfd) maxfd = ts_fd; -#endif } if ((which & IAL_KEYEVENT) && kbd_fd >= 0){ FD_SET (kbd_fd, in); -#ifndef _MGRM_THREADS if(kbd_fd > maxfd) maxfd = kbd_fd; -#endif } -#ifndef _MGRM_THREADS e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif - - if (e > 0) { + if (e > 0) { /* If data is present on the mouse fd, service it: */ if (ts_fd >= 0 && FD_ISSET (ts_fd, in)) { short data [4]; diff --git a/src/ial/jz4740.c b/src/ial/jz4740.c index 4da07733..975548a3 100644 --- a/src/ial/jz4740.c +++ b/src/ial/jz4740.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -87,9 +87,9 @@ #define TS_DEVICE "/dev/ts" /* for data reading from /dev/ts */ typedef struct { - struct timeval time; - unsigned short type; - unsigned short code; + struct timeval time; + unsigned short type; + unsigned short code; unsigned int value; } KBD_EVENT; @@ -123,11 +123,11 @@ static int mouse_update(void) } struct jz_ts_event { - unsigned short status; - unsigned short x; - unsigned short y; - unsigned short pressure; - unsigned short pad; + unsigned short status; + unsigned short x; + unsigned short y; + unsigned short pressure; + unsigned short pad; }; struct jz_ts_event ts_events[DIS_NUM]; @@ -156,31 +156,31 @@ static void mouse_getxy(int *x, int* y) #ifdef _DEBUG fprintf(stderr, "nr_events%d\n", nr_events); #endif - for (i = 0; i < nr_events; i++) { + for (i = 0; i < nr_events; i++) { tempx = (ts_events [i].x - MINX)*SCREEN_WIDTH/(MAXX-MINX); tempy = (ts_events [i].y - MINY)*SCREEN_HEIGHT/(MAXY-MINY); - - if (tempx < 0) tempx = 0; - if (tempy < 0) tempy = 0; - ts_events [i].x = tempx; - ts_events [i].y = tempy; + if (tempx < 0) tempx = 0; + if (tempy < 0) tempy = 0; - if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1; + ts_events [i].x = tempx; + ts_events [i].y = tempy; - //if (ts_events [i].y < 0) ts_events [i].y = 0; - if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT; + if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1; - if (ts_events [i].x > max_x) { - max_x = ts_events [i].x; - max_event = i; - } + //if (ts_events [i].y < 0) ts_events [i].y = 0; + if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT; - if (ts_events [i].x < min_x) { - min_x = ts_events [i].x; - min_event = i; - } - } + if (ts_events [i].x > max_x) { + max_x = ts_events [i].x; + max_event = i; + } + + if (ts_events [i].x < min_x) { + min_x = ts_events [i].x; + min_event = i; + } + } for (i = 0; i < nr_events; i++) { if (i != max_event && i != min_event) { @@ -191,15 +191,15 @@ static void mouse_getxy(int *x, int* y) #ifdef _DEBUG fprintf(stderr, "max_event %d, min_event %d, minx=%d, miny=%d\n", max_event, min_event, ts_events[min_event].x, ts_events[min_event].y); #endif - if (max_event == min_event ) { - *x = sum_x / (nr_events - 1); - *y = sum_y / (nr_events - 1); - } - else { - *x = sum_x / (nr_events - 2); - *y = sum_y / (nr_events - 2); - } - if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) + if (max_event == min_event ) { + *x = sum_x / (nr_events - 1); + *y = sum_y / (nr_events - 1); + } + else { + *x = sum_x / (nr_events - 2); + *y = sum_y / (nr_events - 2); + } + if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) { mousex = *x; mousey = *y; @@ -218,20 +218,15 @@ static int mouse_getbutton(void) } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int fd; int retvalue = 0; int ret = 0; int e; - struct jz_ts_event jz_evt; + struct jz_ts_event jz_evt; if (!in) { in = &rfds; @@ -242,46 +237,37 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && touch_fd >= 0) { fd = touch_fd; FD_SET (fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif } if (which & IAL_KEYEVENT && btn_fd >= 0){ - fd = btn_fd; /* FIXME: keyboard fd may be changed in vt switch! */ + fd = btn_fd; FD_SET (fd, in); - -#ifdef _LITE_VERSION - if (fd > maxfd) maxfd = fd; -#endif - } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0 ) - { - fd = touch_fd; - if (fd >= 0 && FD_ISSET (fd, in)) + if (fd > maxfd) maxfd = fd; + } + + e = select (maxfd + 1, in, out, except, timeout) ; + if (e > 0 ) { + fd = touch_fd; + if (fd >= 0 && FD_ISSET (fd, in)) { FD_CLR (fd, in); - - retvalue = read(fd, &jz_evt, sizeof(jz_evt)); - + + retvalue = read(fd, &jz_evt, sizeof(jz_evt)); + if (retvalue > 0) { if (jz_evt.pressure > 0) { ts_events [nr_events] = jz_evt; nr_events ++; - if (nr_events >= DIS_NUM) + if (nr_events >= DIS_NUM) { button = 5; } } else { - nr_events = 0; + nr_events = 0; button = 0; } #ifdef _DEBUG @@ -290,7 +276,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } #endif ret |= IAL_MOUSEEVENT; - + } } } @@ -316,7 +302,7 @@ static void keycodetoscancode(void) keycode_scancode[KEY_5] = SCANCODE_HOME + 4; keycode_scancode[KEY_6] = SCANCODE_HOME + 5; keycode_scancode[KEY_7] = SCANCODE_HOME + 6; -#endif +#endif } @@ -346,15 +332,14 @@ void rkbd(int sig) BOOL InitJZ4740Input(INPUT* input, const char* mdev, const char* mtype) { btn_fd = -1; - + touch_fd = open (TS_DEVICE, O_NONBLOCK); if (!touch_fd) { _WRN_PRINTF ("IAL>TSLib: can not open ts device\n"); return FALSE; } - - + input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; @@ -373,7 +358,7 @@ void TermJZ4740Input(void) if (touch_fd >= 0) close(touch_fd); if (btn_fd >= 0) - close(btn_fd); + close(btn_fd); } -#endif /* _JZ4740_IAL */ +#endif /* _JZ4740_IAL */ diff --git a/src/ial/l7200.c b/src/ial/l7200.c index d7630e3a..db605462 100644 --- a/src/ial/l7200.c +++ b/src/ial/l7200.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** l7200.c: Low Level Input Engine for LinkUp System L7200 SDB ** This driver can run on Linux. -** +** ** Created by Yao Yunyuan, 2004/06/20 */ @@ -149,13 +149,8 @@ static int mouse_getbutton(void) return stylus ? IAL_MOUSE_LEFTBUTTON : 0; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { int retvalue = 0; int e; @@ -164,12 +159,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, stimeout.tv_usec = 10; stimeout.tv_sec = 0; -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, &stimeout); -#else - e = select (FD_SETSIZE, in, out, except, &stimeout); -#endif - if (e < 0) { return -1; } diff --git a/src/ial/lide.c b/src/ial/lide.c index 63698784..95a34d04 100644 --- a/src/ial/lide.c +++ b/src/ial/lide.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -85,9 +85,9 @@ static POINT dst_pts[5]={{100,60},{699,60},{699,419},{100,419},{400,240}}; #define TS_DEVICE "/dev/ts" /* for data reading from /dev/ts */ typedef struct { - struct timeval time; - unsigned short type; - unsigned short code; + struct timeval time; + unsigned short type; + unsigned short code; unsigned int value; } KBD_EVENT; @@ -121,12 +121,12 @@ static int mouse_update(void) } typedef struct { - unsigned short status; - unsigned short x; - unsigned short y; - unsigned short pressure; - unsigned short pad; -} jz_ts_event; + unsigned short status; + unsigned short x; + unsigned short y; + unsigned short pressure; + unsigned short pad; +} jz_ts_event; static jz_ts_event ts_events[DIS_NUM]; static jz_ts_event ts_event; @@ -159,31 +159,31 @@ static void mouse_getxy(int *y, int* x) #ifdef _DEBUG fprintf(stderr, "nr_events%d\n", nr_events); #endif - for (i = 0; i < nr_events; i++) + for (i = 0; i < nr_events; i++) { tempx = (ts_events [i].x - MINX)*SCREEN_WIDTH/(MAXX-MINX); tempy = (ts_events [i].y - MINY)*SCREEN_HEIGHT/(MAXY-MINY); - - if (tempx < 0) tempx = 0; - if (tempy < 0) tempy = 0; - ts_events [i].x = tempx; - ts_events [i].y = tempy; + if (tempx < 0) tempx = 0; + if (tempy < 0) tempy = 0; + + ts_events [i].x = tempx; + ts_events [i].y = tempy; + + if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1; - if (ts_events [i].x > SCREEN_WIDTH-1) ts_events [i].x = SCREEN_WIDTH-1; - if (ts_events [i].y > SCREEN_HEIGHT-1) ts_events [i].y = SCREEN_HEIGHT; - if (ts_events [i].x > max_x) { - max_x = ts_events [i].x; - max_event = i; - } + if (ts_events [i].x > max_x) { + max_x = ts_events [i].x; + max_event = i; + } - if (ts_events [i].x < min_x) { - min_x = ts_events [i].x; - min_event = i; - } - } + if (ts_events [i].x < min_x) { + min_x = ts_events [i].x; + min_event = i; + } + } for (i = 0; i < nr_events; i++) { if (i != max_event && i != min_event) { @@ -194,15 +194,15 @@ static void mouse_getxy(int *y, int* x) #ifdef _DEBUG fprintf(stderr, "max_event %d, min_event %d, minx=%d, miny=%d\n", max_event, min_event, ts_events[min_event].x, ts_events[min_event].y); #endif - if (max_event == min_event ) { - *x = sum_x / (nr_events - 1); - *y = sum_y / (nr_events - 1); - } - else { - *x = sum_x / (nr_events - 2); - *y = sum_y / (nr_events - 2); - } - if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) + if (max_event == min_event ) { + *x = sum_x / (nr_events - 1); + *y = sum_y / (nr_events - 1); + } + else { + *x = sum_x / (nr_events - 2); + *y = sum_y / (nr_events - 2); + } + if (ABS (mousex - *x) > 10 || ABS (mousey - *y) > 10) { mousex = *x; mousey = *y; @@ -221,20 +221,15 @@ static int mouse_getbutton(void) } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int fd; int retvalue = 0; int ret = 0; int e; - static jz_ts_event jz_evt; + static jz_ts_event jz_evt; if (!in) { in = &rfds; @@ -245,46 +240,38 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && touch_fd >= 0) { fd = touch_fd; FD_SET (fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif } if (which & IAL_KEYEVENT && btn_fd >= 0){ - fd = btn_fd; /* FIXME: keyboard fd may be changed in vt switch! */ + fd = btn_fd; FD_SET (fd, in); - -#ifdef _LITE_VERSION - if (fd > maxfd) maxfd = fd; -#endif - } -#ifdef _LITE_VERSION - e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0 ) - { - fd = touch_fd; - if (fd >= 0 && FD_ISSET (fd, in)) + if (fd > maxfd) maxfd = fd; + } + + e = select (maxfd + 1, in, out, except, timeout) ; + if (e > 0 ) + { + fd = touch_fd; + if (fd >= 0 && FD_ISSET (fd, in)) { FD_CLR (fd, in); - - retvalue = read(fd, &jz_evt, sizeof(jz_evt)); - + + retvalue = read(fd, &jz_evt, sizeof(jz_evt)); + if (retvalue > 0) { if (jz_evt.pressure > 0) { ts_events [nr_events] = jz_evt; nr_events ++; - if (nr_events >= DIS_NUM) + if (nr_events >= DIS_NUM) { button = 5; } } else { - nr_events = 0; + nr_events = 0; button = 0; } #ifdef _DEBUG @@ -293,7 +280,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } #endif ret |= IAL_MOUSEEVENT; - + } } } @@ -319,7 +306,7 @@ static void keycodetoscancode(void) keycode_scancode[KEY_5] = SCANCODE_HOME + 4; keycode_scancode[KEY_6] = SCANCODE_HOME + 5; keycode_scancode[KEY_7] = SCANCODE_HOME + 6; -#endif +#endif } @@ -349,15 +336,15 @@ void rkbd(int sig) BOOL InitlideInput(INPUT* input, const char* mdev, const char* mtype) { btn_fd = -1; - + touch_fd = open (TS_DEVICE, O_NONBLOCK); if (!touch_fd) { _WRN_PRINTF ("IAL>TSLib: can not open ts device\n"); return FALSE; } - - + + input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; @@ -367,7 +354,7 @@ BOOL InitlideInput(INPUT* input, const char* mdev, const char* mtype) input->wait_event = wait_event; mousex = 0; mousey = 0; - + ts_event.x = ts_event.y = ts_event.pressure =0; SetMouseCalibrationParameters (src_pts, dst_pts); @@ -379,7 +366,7 @@ void TermlideInput(void) if (touch_fd >= 0) close(touch_fd); if (btn_fd >= 0) - close(btn_fd); + close(btn_fd); } -#endif /* _JZ4740_IAL */ +#endif /* _JZ4740_IAL */ diff --git a/src/ial/mc68x328.c b/src/ial/mc68x328.c index 82bf3326..d5f0e65a 100644 --- a/src/ial/mc68x328.c +++ b/src/ial/mc68x328.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** mc68x328.c: Low Level Input Engine for uClinux touch screen palm/mc68ez328 -** +** ** Created by Wei Yongming, 2003/08/06 */ @@ -155,13 +155,8 @@ static int mouse_getbutton (void) return pen_down; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -174,26 +169,17 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } #if 0 if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } #endif -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); @@ -255,7 +241,7 @@ BOOL InitMC68X328Input (INPUT* input, const char* mdev, const char* mtype) drv_params.xy_swap = 0; /* - * according to mc68328digi.h 'How to calculate the parameters', + * according to mc68328digi.h 'How to calculate the parameters', * we have measured: */ mx1 = 508; ux1 = 0; diff --git a/src/ial/mgsock.c b/src/ial/mgsock.c index 7bdce01f..93fa487a 100644 --- a/src/ial/mgsock.c +++ b/src/ial/mgsock.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ diff --git a/src/ial/mpc823.c b/src/ial/mpc823.c index e0c1fe61..769b7ec4 100644 --- a/src/ial/mpc823.c +++ b/src/ial/mpc823.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** mpc823.c: Low Level Input Engine for sinovee sc823 board -** +** ** Created by Zhong Shuyi, 2003/06/04 */ @@ -72,16 +72,16 @@ #include "mpc823.h" -#define _DEBUG_MPC823 0 +#define _DEBUG_MPC823 0 /* ------------------------------------------------------------------------- */ #ifndef KEY_RELEASED -#define KEY_RELEASED 0x80 +#define KEY_RELEASED 0x80 #endif #ifndef KEY_NUM -#define KEY_NUM 0x7F +#define KEY_NUM 0x7F #endif /* for data reading from /dev/tpanel */ @@ -126,13 +126,13 @@ static int keyboard_update(void) key = btn_state & KEY_NUM; if (key == SCANCODE_CURSORLEFT) - key = SCANCODE_CURSORBLOCKLEFT; + key = SCANCODE_CURSORBLOCKLEFT; else if (key == SCANCODE_CURSORRIGHT) - key = SCANCODE_CURSORBLOCKRIGHT; + key = SCANCODE_CURSORBLOCKRIGHT; else if (key == SCANCODE_CURSORUP) - key = SCANCODE_CURSORBLOCKUP; + key = SCANCODE_CURSORBLOCKUP; else if (key == SCANCODE_CURSORDOWN) - key = SCANCODE_CURSORBLOCKDOWN; + key = SCANCODE_CURSORBLOCKDOWN; state[key] = status; @@ -144,13 +144,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -162,35 +157,26 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && kb_fd >= 0){ FD_SET (kb_fd, in); -#ifdef _LITE_VERSION if(kb_fd > maxfd) maxfd = kb_fd; -#endif } -#ifdef _LITE_VERSION if ( select (maxfd + 1, in, out, except, timeout) < 0 ) -#else - if ( select (FD_SETSIZE, in, out, except, timeout) < 0 ) -#endif - return -1; + return -1; - if (ts >= 0 && FD_ISSET (ts, in)) - { + if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); if ( read (ts, &pos, sizeof (POS)) == sizeof(POS) ) { - pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 ); + pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 ); retvalue |= IAL_MOUSEEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -202,19 +188,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (read(kb_fd, &scankey, sizeof(scankey)) == sizeof(scankey)) { #if _DEBUG_MPC823 - printf ("scankey = %d\n", scankey); + printf ("scankey = %d\n", scankey); #endif - /* 224 where from ? */ - if (scankey == 224) { - return -1; - } + /* 224 where from ? */ + if (scankey == 224) { + return -1; + } btn_state = scankey; retvalue |= IAL_KEYEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -251,7 +237,7 @@ BOOL InitMPC823Input (INPUT* input, const char* mdev, const char* mtype) input->wait_event = wait_event; pos.x = pos.y = pos.header = 0; - + return TRUE; } @@ -260,7 +246,7 @@ void TermMPC823Input (void) if (ts >= 0) close(ts); if (kb_fd >= 0) - close(kb_fd); + close(kb_fd); } #endif /* _MPC823_IAL */ diff --git a/src/ial/mstarial.c b/src/ial/mstarial.c index a482cf73..d9609548 100644 --- a/src/ial/mstarial.c +++ b/src/ial/mstarial.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -48,7 +48,7 @@ #define dbg() printf("%s %d\n", __FUNCTION__, __LINE__) /* -** cisco_touchpad.c: Input Engine for Cisco touchpad +** cisco_touchpad.c: Input Engine for Cisco touchpad */ #include "common.h" @@ -56,48 +56,48 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include "mgsock.h" #include "minigui.h" -#include "ial.h" +#include "ial.h" #include "window.h" #include "cliprect.h" #include "../include/internals.h" #include -#include +#include #include #include #include #include -#include +#include #include #include #define NOBUTTON 0x0000 #define LEFTBUTTON 0x0001 -#define MOUSEBUTTONMASK 0x00FF +#define MOUSEBUTTONMASK 0x00FF #define MOUSE_MOVE_PIXEL 50 -#define MOUSE_MAX_X 1920 -#define MOUSE_MAX_Y 1080 +#define MOUSE_MAX_X 1920 +#define MOUSE_MAX_Y 1080 -static unsigned short xiKeyValue[256] = -{ /* 0 1 2 3 4 5 6 7 8 9 */ +static unsigned short xiKeyValue[256] = +{ /* 0 1 2 3 4 5 6 7 8 9 */ /*0*/ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, -/*10*/ '*', 0x0122, 0x001B, SCANCODE_F1, 0x0081, 0x0009, 0x0043,SCANCODE_SLASH,0x0111, 0x0112, -/*20*/ 0x0113, 0x0114, 0x008b, SCANCODE_F2, SCANCODE_F3, 0x008e,SCANCODE_F4, 0x0123, 0x001B, 0x0091, -/*30*/ 0x0092, SCANCODE_F5,0x0039, 0x0047, 0x0048, 0x0049, 0x004a, 0x0025, 0x0026, 0x0028, -/*40*/ 0x0028, 0x0029, 0x002a, 0x002b, 0x0033, 0x000c, 0x0034, 0x0035, 0x000b, 0x0002, +/*10*/ '*', 0x0122, 0x001B, SCANCODE_F1, 0x0081, 0x0009, 0x0043,SCANCODE_SLASH,0x0111, 0x0112, +/*20*/ 0x0113, 0x0114, 0x008b, SCANCODE_F2, SCANCODE_F3, 0x008e,SCANCODE_F4, 0x0123, 0x001B, 0x0091, +/*30*/ 0x0092, SCANCODE_F5,0x0039, 0x0047, 0x0048, 0x0049, 0x004a, 0x0025, 0x0026, 0x0028, +/*40*/ 0x0028, 0x0029, 0x002a, 0x002b, 0x0033, 0x000c, 0x0034, 0x0035, 0x000b, 0x0002, /*50*/ 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x0027, -/*60*/ 0x003c, 0x000d, 0x003e, 0x003f, 0x0127, 0x0128,SCANCODE_CURSORUP,SCANCODE_CURSORDOWN,SCANCODE_CURSORLEFT,SCANCODE_CURSORRIGHT, +/*60*/ 0x003c, 0x000d, 0x003e, 0x003f, 0x0127, 0x0128,SCANCODE_CURSORUP,SCANCODE_CURSORDOWN,SCANCODE_CURSORLEFT,SCANCODE_CURSORRIGHT, /*70*/ SCANCODE_ENTER, SCANCODE_HOME,SCANCODE_END,0x0049, 0x0125, 0x0126, 0x004c, 0x004d, SCANCODE_F7, 0x004f, /*80*/ SCANCODE_F6,0x0051, SCANCODE_F8, 0x0124, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, /*90*/ 0x005a, 0x001a, 0x002b, 0x001b, 0x005e, 0x005f, 0x0060, 0x001e, 0x0030, 0x002e, @@ -117,19 +117,19 @@ static unsigned short xiKeyValue[256] = /*230*/ 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, /*240*/ 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, /*250*/ 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff -}; +}; static unsigned int cur_key; -static char state[NR_KEYS]; +static char state[NR_KEYS]; static int xpos; /* current x position of mouse */ static int ypos; /* current y position of mouse */ -static int minx; -static int maxx; -static int miny; -static int maxy; -static int buttons = 0; +static int minx; +static int maxx; +static int miny; +static int maxy; +static int buttons = 0; static int ir_fd = -1; -/************************ Low Level Input Operations **********************/ +/************************ Low Level Input Operations **********************/ static int mouse_update (void) { return 1; @@ -164,13 +164,8 @@ static const char * keyboard_get_state(void) } /* NOTE by weiym: Do not ignore the fd_set in, out, and except */ -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif /* _LITE_VERSION */ { int e, fd; fd_set rfds; @@ -184,7 +179,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (buttons) { buttons = 0; e |= IAL_MOUSEEVENT; - } + } return e; } @@ -194,11 +189,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } fd = ir_fd; mg_fd_set (fd, in); -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif if(e > 0) { //printf("e > 0, key pressed\n"); fd = ir_fd; @@ -209,11 +200,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, int rawcode; int read_len = read (ir_fd, &rawcode, sizeof(unsigned int)); if (read_len == sizeof(unsigned int)) { - unsigned char code = (rawcode& 0x0000FF00) >> 8; + unsigned char code = (rawcode& 0x0000FF00) >> 8; int key = xiKeyValue[code%MGUI_NR_KEYS]; printf("read results: rawcode = %d, code = %d, key = 0x%x\n", rawcode ,code, key); switch (key) { - case SCANCODE_CURSORLEFT: + case SCANCODE_CURSORLEFT: printf("SCANCODE_CURSORLEFT\n"); xpos -= MOUSE_MOVE_PIXEL; if (xpos < 0) @@ -248,7 +239,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, cur_key = key; return IAL_KEYEVENT; } - } + } } return 0; } @@ -257,16 +248,16 @@ BOOL InitMStarInput (INPUT* input, const char* mdev, const char* mtype) { #ifndef USE_MSTAR_CHAKRA //ENTER(); - int flag = 1; + int flag = 1; ir_fd = open ("/dev/ir", O_RDWR); - + if ( ir_fd < 0 ) { fprintf (stderr, "IAL: Can not open xilleon ir device!\n"); return -1; - } + } int masterIrPid; ioctl(ir_fd, MDRV_IR_GET_MASTER_PID, &masterIrPid); - if (masterIrPid > 0) { + if (masterIrPid > 0) { printf("kill master Ir Pid\n"); kill(masterIrPid, 0); } @@ -300,7 +291,7 @@ BOOL InitMStarInput (INPUT* input, const char* mdev, const char* mtype) input->get_keyboard_state = keyboard_get_state; input->set_leds = NULL; - input->wait_event = wait_event; + input->wait_event = wait_event; //LEAVE(); return TRUE; @@ -315,5 +306,5 @@ void TermMStarInput (void) #endif ir_fd = -1; LEAVE(); -} +} #endif // _MGIAL_MSTAR diff --git a/src/ial/palm2.c b/src/ial/palm2.c index 9957148e..c533918c 100644 --- a/src/ial/palm2.c +++ b/src/ial/palm2.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** palm2.c: Low Level Input Engine for OKWAP PalmII. ** This engine runs on eCos. -** +** ** Created by Wei Yongming, 2004/01/29 */ @@ -182,16 +182,16 @@ static int keyboard_update(void) switch (key) { - case 1: + case 1: state[SCANCODE_LEFTSHIFT] = status; break; - case 2: + case 2: state[H3600_SCANCODE_CALENDAR] = status; break; - case 3: + case 3: state[H3600_SCANCODE_CONTACTS] = status; break; - case 4: + case 4: state[H3600_SCANCODE_Q] = status; break; case 5: @@ -226,43 +226,29 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; int e; - - if (!in) { + + if (!in) { in = &rfds; FD_ZERO (in); } if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && btn_fd >= 0){ FD_SET (btn_fd, in); -#ifdef _LITE_VERSION if(btn_fd > maxfd) maxfd = btn_fd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { short data [4]; @@ -284,33 +270,33 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) { - int ret = 0; + int ret = 0; FD_CLR (btn_fd, in); ret = read (btn_fd, &cur_key, sizeof (cur_key)); - if (ret != sizeof (cur_key)) { - printf ("%s:IAL_ENGINE,read error!!!!:ret:%i\n", __FUNCTION__, ret); - return -1; - } - printf ("%s:IAL_ENGINE:cur_key:%i\n", __FUNCTION__, cur_key); - if (cur_key < 30 && cur_key >= 0) { - state[key2scancode[cur_key]] = 1; - prev_key = cur_key; - retvalue |= IAL_KEYEVENT; - } - else if (cur_key >= 0x80 && cur_key < (0x80 | 30)) { - state[key2scancode[prev_key]] = 0; - retvalue |= IAL_KEYEVENT; - } - } + if (ret != sizeof (cur_key)) { + printf ("%s:IAL_ENGINE,read error!!!!:ret:%i\n", __FUNCTION__, ret); + return -1; + } + printf ("%s:IAL_ENGINE:cur_key:%i\n", __FUNCTION__, cur_key); + if (cur_key < 30 && cur_key >= 0) { + state[key2scancode[cur_key]] = 1; + prev_key = cur_key; + retvalue |= IAL_KEYEVENT; + } + else if (cur_key >= 0x80 && cur_key < (0x80 | 30)) { + state[key2scancode[prev_key]] = 0; + retvalue |= IAL_KEYEVENT; + } + } } else if (e == 0) { /* simulate the key up when time out */ //if (cur_key >= 0 && cur_key < 30) { // cur_key = 111; - if (state[key2scancode[prev_key]] == 1) { - return IAL_KEYEVENT; - } + if (state[key2scancode[prev_key]] == 1) { + return IAL_KEYEVENT; + } } else { return -1; @@ -347,7 +333,7 @@ BOOL InitPALMIIInput (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x = pos.y = pos.b = 0; - + return TRUE; } diff --git a/src/ial/pcxvfbial.c b/src/ial/pcxvfbial.c index 56994280..b839bc71 100644 --- a/src/ial/pcxvfbial.c +++ b/src/ial/pcxvfbial.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** pcxvfb.c: Input Engine for PCX Virtual FrameBuffer -** +** ** Created by xgwang, 2007/09/28 */ @@ -141,7 +141,7 @@ static int record_fd = -1; static long long int record_time_start = 0; #ifdef IAL_RECORD_MANUAL_START -#define IAL_RECORD_START_KEY SCANCODE_F5 +#define IAL_RECORD_START_KEY SCANCODE_F5 static BOOL record_started = FALSE; #endif @@ -153,58 +153,58 @@ static void (*exit_gui)(void); void VFBSetIMETextCallback(void (*setIMEText)(void *, const char* text), void *user_data) { - set_ime_text = setIMEText; - ime_text_callback_data = user_data; - return; + set_ime_text = setIMEText; + ime_text_callback_data = user_data; + return; } void VFBSetCaption(const char* caption) { - int len = 0; - char szCaption[1024]; - XVFBCaptionEventData *ced = (XVFBCaptionEventData*)szCaption; + int len = 0; + char szCaption[1024]; + XVFBCaptionEventData *ced = (XVFBCaptionEventData*)szCaption; - if(caption == NULL || (len = strlen(caption)) <= 0) - return; + if(caption == NULL || (len = strlen(caption)) <= 0) + return; - ced->event_type = CAPTION_TYPE; - ced->size = len; - strcpy(ced->buff,caption); + ced->event_type = CAPTION_TYPE; + ced->size = len; + strcpy(ced->buff,caption); - if(__mg_pcxvfb_client_sockfd == -1) - return; - /*one XVFBCaptionEventData struct costs 8 bytes, - * change that '8' below if the struct is changed*/ - if (mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len) < (8+len)) { + if(__mg_pcxvfb_client_sockfd == -1) + return; + /*one XVFBCaptionEventData struct costs 8 bytes, + * change that '8' below if the struct is changed*/ + if (mg_writesocket(__mg_pcxvfb_client_sockfd, ced, 8+len) < (8+len)) { _ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBSetCaption.\n"); } } void VFBOpenIME(int bOpen) { - XVFBIMEEventData ime={ - IME_TYPE, - bOpen - }; + XVFBIMEEventData ime={ + IME_TYPE, + bOpen + }; - if(__mg_pcxvfb_client_sockfd == -1) - return; + if(__mg_pcxvfb_client_sockfd == -1) + return; - if (mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)) < sizeof(ime)) { + if (mg_writesocket(__mg_pcxvfb_client_sockfd, &ime, sizeof(ime)) < sizeof(ime)) { _ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBOpenIME.\n"); } } void VFBShowWindow(int show) { - int info[2] = { - SHOW_HIDE_TYPE, - show - }; - if(__mg_pcxvfb_client_sockfd == -1) - return; + int info[2] = { + SHOW_HIDE_TYPE, + show + }; + if(__mg_pcxvfb_client_sockfd == -1) + return; - if (mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)) < sizeof(info)) { + if (mg_writesocket(__mg_pcxvfb_client_sockfd, info, sizeof(info)) < sizeof(info)) { _ERR_PRINTF ("IAL>PCXVFB: error occurred when calling VFBShowWindow.\n"); } } @@ -283,7 +283,7 @@ static long long int getcurtime(void) #ifdef WIN32 /* TODO: */ return 0; -#else +#else struct timeval tv; gettimeofday( &tv, NULL ); return (long long int)tv.tv_sec * 1000 + (long long int)tv.tv_usec / 1000; @@ -354,7 +354,7 @@ static void do_record(AUTO_IAL_INPUT_EVENT *event) } event->type = ArchSwap32(event->type); #endif - + write_rec (event, sizeof(*event)); @@ -381,9 +381,9 @@ static void mouse_setxy (int x, int y) int mouse_event[3] = {MOUSE_TYPE, x, y}; if(__mg_pcxvfb_client_sockfd == -1) - return; + return; - if (mg_writesocket (__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)) < sizeof(XVFBEVENT)) { + if (mg_writesocket (__mg_pcxvfb_client_sockfd, &mouse_event, sizeof(XVFBEVENT)) < sizeof(XVFBEVENT)) { _ERR_PRINTF ("IAL>PCXVFB: error occurred when setting mouse position.\n"); } } @@ -406,7 +406,7 @@ static int mouse_update (void) { cur_retvalue = 0; #ifndef WIN32 - + if (if_record_ial ()) { AUTO_IAL_INPUT_EVENT event; event.timestamp = getcurtime() - record_time_start; @@ -427,14 +427,14 @@ static int keyboard_update (void) { unsigned char scancode; static unsigned char last = 0; - unsigned int unicode; + unsigned int unicode; BYTE press; - cur_retvalue = 0; + cur_retvalue = 0; unicode = s_pcxvfb_event_key.data.key.key_code; press = (s_pcxvfb_event_key.data.key.key_state) ? 1 : 0; - + if (!(GetShiftKeyStatus() & KS_NUMLOCK)) { if (unicode == SCANCODE_CURSORUP) unicode = SCANCODE_CURSORBLOCKUP; @@ -528,7 +528,7 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) } return IAL_MOUSEEVENT; - } + } case KB_TYPE: { if (mg_readsocket (fd, &pcxvfb_event->data, sizeof(pcxvfb_event->data)) @@ -541,8 +541,8 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) } case IME_MESSAGE_TYPE: { - int size; - unsigned char szBuff[1024]; + int size; + unsigned char szBuff[1024]; if(mg_readsocket (fd, &size, sizeof(size)) != sizeof(size)) { return 0; } @@ -551,21 +551,21 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) } if(mg_readsocket (fd, szBuff, size) == size) { /* - int i; - for (i = 0; i < size; ++i) - fprintf (stderr, "%02x ", szBuff[i]); - fprintf (stderr, "%d\n", size); + int i; + for (i = 0; i < size; ++i) + fprintf (stderr, "%02x ", szBuff[i]); + fprintf (stderr, "%d\n", size); */ szBuff[size] = '\0'; set_ime_text(ime_text_callback_data, (const char *)szBuff); - } else { - } + } else { + } return 0; } case -1: - case XVFB_CLOSE_TYPE: + case XVFB_CLOSE_TYPE: { - if (__mg_pcxvfb_client_sockfd >= 0) { + if (__mg_pcxvfb_client_sockfd >= 0) { #ifdef WIN32 win_PCXVFbCloseSocket (__mg_pcxvfb_client_sockfd); #else @@ -591,11 +591,11 @@ static int read_event(int fd, XVFBEVENT *pcxvfb_event) return -1; } -static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, +static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { int retvalue = 0; -#ifndef WIN32 +#ifndef WIN32 fd_set rfds; #else _fd_set rfds; @@ -644,7 +644,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, e = mg_select (FD_SETSIZE, in, out, except, timeout) ; #endif - if (e > 0) { + if (e > 0) { fd = __mg_pcxvfb_client_sockfd; /* If data is present on the mouse fd, service it: */ if (fd >= 0 && mg_fd_isset (fd, in)) { diff --git a/src/ial/ps2-conv.c b/src/ial/ps2-conv.c index a436c28a..3f319c21 100644 --- a/src/ial/ps2-conv.c +++ b/src/ial/ps2-conv.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ps2-conv.c: convert scancode from set2 to set1. -** +** ** Author: Wei Yongming (2004/05/19) */ @@ -59,11 +59,11 @@ #include "ps2-keycode.h" -/* +/* * we use this map to convert scancode from set2 to set1, * because minigui use set1 and ps/2 keyboard gives set2. */ - + static unsigned char normal_keymap [0x83+1] = { /* 00 */ K_NONE, SCANCODE_F9, K_NONE, SCANCODE_F5, SCANCODE_F3, SCANCODE_F1, SCANCODE_F2, SCANCODE_F12, diff --git a/src/ial/px255b.c b/src/ial/px255b.c index eaba24e6..fa1338dd 100644 --- a/src/ial/px255b.c +++ b/src/ial/px255b.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** px255b.c: IAL engine for PX255B dev. board. -** +** ** Author: Wei Yongming (2004/05/19) */ @@ -72,16 +72,16 @@ #include "px255b.h" -#define _DEBUG_PX255B 0 +#define _DEBUG_PX255B 0 /* ------------------------------------------------------------------------- */ #ifndef KEY_RELEASED -#define KEY_RELEASED 0x80 +#define KEY_RELEASED 0x80 #endif #ifndef KEY_NUM -#define KEY_NUM 0x7F +#define KEY_NUM 0x7F #endif /* for data reading from /dev/tpanel */ @@ -127,13 +127,13 @@ static int keyboard_update(void) key = btn_state & KEY_NUM; if (key == SCANCODE_CURSORLEFT) - key = SCANCODE_CURSORBLOCKLEFT; + key = SCANCODE_CURSORBLOCKLEFT; else if (key == SCANCODE_CURSORRIGHT) - key = SCANCODE_CURSORBLOCKRIGHT; + key = SCANCODE_CURSORBLOCKRIGHT; else if (key == SCANCODE_CURSORUP) - key = SCANCODE_CURSORBLOCKUP; + key = SCANCODE_CURSORBLOCKUP; else if (key == SCANCODE_CURSORDOWN) - key = SCANCODE_CURSORBLOCKDOWN; + key = SCANCODE_CURSORBLOCKDOWN; state[key] = status; @@ -145,13 +145,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -163,35 +158,26 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && kb_fd >= 0){ FD_SET (kb_fd, in); -#ifdef _LITE_VERSION if(kb_fd > maxfd) maxfd = kb_fd; -#endif } -#ifdef _LITE_VERSION if ( select (maxfd + 1, in, out, except, timeout) < 0 ) -#else - if ( select (FD_SETSIZE, in, out, except, timeout) < 0 ) -#endif - return -1; + return -1; - if (ts >= 0 && FD_ISSET (ts, in)) - { + if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); if ( read (ts, &pos, sizeof (POS)) == sizeof(POS) ) { - pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 ); + pos.header = ( pos.header > 0 ? IAL_MOUSE_LEFTBUTTON:0 ); retvalue |= IAL_MOUSEEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -203,19 +189,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (read(kb_fd, &scankey, sizeof(scankey)) == sizeof(scankey)) { #if _DEBUG_PX255B - printf ("scankey = %d\n", scankey); + printf ("scankey = %d\n", scankey); #endif - /* 224 where from ? */ - if (scankey == 224) { - return -1; - } + /* 224 where from ? */ + if (scankey == 224) { + return -1; + } btn_state = scankey; retvalue |= IAL_KEYEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -254,7 +240,7 @@ BOOL InitPX255BInput (INPUT* input, const char* mdev, const char* mtype) input->wait_event = wait_event; pos.x = pos.y = pos.header = 0; - + return TRUE; } @@ -263,7 +249,7 @@ void TermPX255BInput (void) if (ts >= 0) close(ts); if (kb_fd >= 0) - close(kb_fd); + close(kb_fd); } #endif /* _PX255B_IAL */ diff --git a/src/ial/qemu.c b/src/ial/qemu.c index 4821512e..cedd5957 100644 --- a/src/ial/qemu.c +++ b/src/ial/qemu.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** qemu.c: Low Level Input Engine for QEMU ** This driver can run on Linux. - ** + ** ** Created by Libo Jiao, 2001/08/20 */ @@ -79,30 +79,30 @@ static int key, old_key = -1; #undef _DEBUG static int key_mapper[][2] = { - {2,SCANCODE_1}, - {3,SCANCODE_2}, - {4,SCANCODE_3}, - {5,SCANCODE_4}, - {6,SCANCODE_5}, - {7,SCANCODE_6}, - {8,SCANCODE_7}, - {9,SCANCODE_8}, - {10,SCANCODE_9}, - {11,SCANCODE_0}, - {59,SCANCODE_F1}, - {60,SCANCODE_F2}, - {61,SCANCODE_F3}, - {62,SCANCODE_F4}, - {63,SCANCODE_F5}, - {64,SCANCODE_F6}, - {65,SCANCODE_F7}, - {66,SCANCODE_F8}, - {67,SCANCODE_F9}, - {68,SCANCODE_F10}, - {103,SCANCODE_CURSORBLOCKUP}, - {105,SCANCODE_CURSORBLOCKLEFT}, - {106,SCANCODE_CURSORBLOCKRIGHT}, - {108,SCANCODE_CURSORBLOCKDOWN} + {2,SCANCODE_1}, + {3,SCANCODE_2}, + {4,SCANCODE_3}, + {5,SCANCODE_4}, + {6,SCANCODE_5}, + {7,SCANCODE_6}, + {8,SCANCODE_7}, + {9,SCANCODE_8}, + {10,SCANCODE_9}, + {11,SCANCODE_0}, + {59,SCANCODE_F1}, + {60,SCANCODE_F2}, + {61,SCANCODE_F3}, + {62,SCANCODE_F4}, + {63,SCANCODE_F5}, + {64,SCANCODE_F6}, + {65,SCANCODE_F7}, + {66,SCANCODE_F8}, + {67,SCANCODE_F9}, + {68,SCANCODE_F10}, + {103,SCANCODE_CURSORBLOCKUP}, + {105,SCANCODE_CURSORBLOCKLEFT}, + {106,SCANCODE_CURSORBLOCKRIGHT}, + {108,SCANCODE_CURSORBLOCKDOWN} }; static int keyboard_update(void) @@ -113,34 +113,34 @@ static int keyboard_update(void) char buf[48]; read (btn_fd, buf, 48); key = buf[26]; - status = (key == old_key)? 0 : 1; + status = (key == old_key)? 0 : 1; if (status == 0) old_key = -1; - else + else old_key = key; - m = 0; - n = sizeof(key_mapper)/sizeof(int*)-1; + m = 0; + n = sizeof(key_mapper)/sizeof(int*)-1; - while(mkey_mapper[half][0]){ - if(m==half) m++ ; else m = half;} - else - n = half; - } - if(m==n && key==key_mapper[m][0]){ -// printf("%d:getKey=%d\n",__LINE__,key); - state[key_mapper[m][1]] = status; - } - else - printf("undefined state\n"); - return NR_KEYS; + while(mkey_mapper[half][0]){ + if(m==half) m++ ; else m = half;} + else + n = half; + } + if(m==n && key==key_mapper[m][0]){ +// printf("%d:getKey=%d\n",__LINE__,key); + state[key_mapper[m][1]] = status; + } + else + printf("undefined state\n"); + return NR_KEYS; } static const char* keyboard_getstate(void) @@ -152,13 +152,13 @@ static char mice_info[3]; /* * the qemu mice info struct * mice_info[0]: the button info - * 0x08: normal - * 0x09: left button down - * 0x0a: right button down - * 0x10: x-aixel decrement - * 0x20: y-aixel decrement + * 0x08: normal + * 0x09: left button down + * 0x0a: right button down + * 0x10: x-aixel decrement + * 0x20: y-aixel decrement * mice_info[1]: x decriment - * mice_info[2]: y incriment + * mice_info[2]: y incriment * */ static int mousex = 0; @@ -166,44 +166,44 @@ static int mousey = 0; static int qemu_mouse_update(void) { - int r; - - r = read(mice_fd, mice_info, sizeof(mice_info)); + int r; - if( r < 0 ) return -1; + r = read(mice_fd, mice_info, sizeof(mice_info)); - if(mice_info[1]<128) - mousex += mice_info[1]; - else - mousex += (mice_info[1]-256); + if( r < 0 ) return -1; - - if(mice_info[2]<128) - mousey -= mice_info[2]; - else - mousey += (256-mice_info[2]); + if(mice_info[1]<128) + mousex += mice_info[1]; + else + mousex += (mice_info[1]-256); - if(mousex < 0 ) - mousex = 0; - else if(mousex >= g_rcScr.right) - mousex = g_rcScr.right; - - if(mousey < 0) - mousey = 0; - else if(mousey >= g_rcScr.bottom) - mousey = g_rcScr.bottom; - return 1; + if(mice_info[2]<128) + mousey -= mice_info[2]; + else + mousey += (256-mice_info[2]); + + if(mousex < 0 ) + mousex = 0; + else if(mousex >= g_rcScr.right) + mousex = g_rcScr.right; + + if(mousey < 0) + mousey = 0; + else if(mousey >= g_rcScr.bottom) + mousey = g_rcScr.bottom; + + return 1; } static void qemu_mouse_getxy(int *x, int *y){ - *x = mousex; - *y = mousey; + *x = mousex; + *y = mousey; } static int qemu_mouse_getbutton(void){ - return ((mice_info[0]&0x01)?IAL_MOUSE_LEFTBUTTON:0) - | ((mice_info[0]&0x02)?IAL_MOUSE_RIGHTBUTTON:0); + return ((mice_info[0]&0x01)?IAL_MOUSE_LEFTBUTTON:0) + | ((mice_info[0]&0x02)?IAL_MOUSE_RIGHTBUTTON:0); } static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, @@ -226,12 +226,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex #endif } - if ((which & IAL_MOUSEEVENT) && mice_fd >= 0){ - FD_SET ( mice_fd, in); -#ifndef _MGRM_THREADS - if(mice_fd > maxfd) maxfd = mice_fd; + if ((which & IAL_MOUSEEVENT) && mice_fd >= 0){ + FD_SET ( mice_fd, in); +#ifndef _MGRM_THREADS + if(mice_fd > maxfd) maxfd = mice_fd; #endif - } + } #ifndef _MGRM_THREADS e = select (maxfd + 1, in, out, except, timeout) ; @@ -248,10 +248,10 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex retvalue |= IAL_KEYEVENT; } - if(mice_fd >= 0 && FD_ISSET(mice_fd, in)){ - FD_CLR(mice_fd, in); - retvalue |= IAL_MOUSEEVENT; - } + if(mice_fd >= 0 && FD_ISSET(mice_fd, in)){ + FD_CLR(mice_fd, in); + retvalue |= IAL_MOUSEEVENT; + } } else if (e < 0) { return -1; @@ -269,13 +269,13 @@ BOOL InitQEMUInput (INPUT* input, const char* mdev, const char* mtype) return FALSE; } - mice_fd = open("/dev/input/mice", O_RDONLY | O_NOCTTY); - if(mice_fd < 0) - { - fprintf (stderr, "QEMU: Cannot open mice!\n"); - return FALSE; - } - + mice_fd = open("/dev/input/mice", O_RDONLY | O_NOCTTY); + if(mice_fd < 0) + { + fprintf (stderr, "QEMU: Cannot open mice!\n"); + return FALSE; + } + input->update_mouse = qemu_mouse_update; input->get_mouse_xy = qemu_mouse_getxy; input->set_mouse_xy = NULL; @@ -295,8 +295,8 @@ void TermQEMUInput (void) { if (btn_fd >= 0) close(btn_fd); - if(mice_fd >= 0) - close(mice_fd); + if(mice_fd >= 0) + close(mice_fd); } #endif diff --git a/src/ial/qvfb.c b/src/ial/qvfb.c index 9bd811f2..7c464e71 100644 --- a/src/ial/qvfb.c +++ b/src/ial/qvfb.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** qvfb.c: Input Engine for Qt Virtual FrameBuffer -** +** ** Created by Wei Yongming, 2001/11/26 */ @@ -465,7 +465,7 @@ static int read_key (void) } } else { - scancode = keycode_to_scancode (HIWORD (kbd_data.unicode) & 0x00FF, + scancode = keycode_to_scancode (HIWORD (kbd_data.unicode) & 0x00FF, LOWORD (kbd_data.unicode)); kbd_state [scancode] = (press) ? 1 : 0; last = scancode; @@ -536,7 +536,7 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex e = select (FD_SETSIZE, in, out, except, timeout) ; #endif - if (e > 0) { + if (e > 0) { fd = mouse_fd; /* If data is present on the mouse fd, service it: */ if (fd >= 0 && FD_ISSET (fd, in)) { diff --git a/src/ial/rtos_xvfb.c b/src/ial/rtos_xvfb.c index ec9b830d..a932922d 100644 --- a/src/ial/rtos_xvfb.c +++ b/src/ial/rtos_xvfb.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** rtos_xvfb.c: Input Engine for RTOS X Virtual FrameBuffer -** +** ** Created by Liu Peng, 2007/09/29 */ @@ -98,7 +98,7 @@ void* xVFBCreateEventBuffer (int nr_events) buf->buffer_released = FALSE; return buf; - + } void xVFBDestroyEventBuffer (void* buf) @@ -113,7 +113,7 @@ void xVFBDestroyEventBuffer (void* buf) free (buf); } -/* Get the mouse data if there is a mouse event. +/* Get the mouse data if there is a mouse event. * Return values: * 0: ok; * 1: the buffer full. @@ -124,7 +124,7 @@ int xVFBNotifyNewEvent (const void* xvfb_event_buffer, XVFBEVENT* event) XVFBEVENTBUFFER* buf = (XVFBEVENTBUFFER*)xvfb_event_buffer; if (buf->buffer_released == TRUE) return 2; - + pthread_mutex_lock (&buf->lock); @@ -140,7 +140,7 @@ int xVFBNotifyNewEvent (const void* xvfb_event_buffer, XVFBEVENT* event) buf->events [buf->writepos] = *event; buf->writepos++; - if (buf->writepos >= buf->size) + if (buf->writepos >= buf->size) buf->writepos = 0; pthread_mutex_unlock(&buf->lock); @@ -150,7 +150,7 @@ int xVFBNotifyNewEvent (const void* xvfb_event_buffer, XVFBEVENT* event) fprintf (stderr, "event is put into buf.event_type =%d, mouse_x =%d, mouse_y =%d, mouse_btn =%d\n", event->event_type, event->data.mouse.x, event->data.mouse.y, event->data.mouse.button); #endif - + return 0; } @@ -180,18 +180,18 @@ static int mouse_getbutton (void) if (mouse_buttons & MIDBUTTON) buttons |= IAL_MOUSE_MIDDLEBUTTON; - return buttons; + return buttons; } static int keyboard_update (void) { unsigned char scan_code; - unsigned char nr_changed_keys = 0; + unsigned char nr_changed_keys = 0; scan_code = kbd_data.key_code; kbd_state [scan_code] = kbd_data.key_state ? 1 : 0; - nr_changed_keys = scan_code + 1; + nr_changed_keys = scan_code + 1; return nr_changed_keys; } @@ -204,16 +204,16 @@ static const char* keyboard_getstate (void) static XVFBEVENT* get_event_data (XVFBEVENTBUFFER* buf) { XVFBEVENT* event = NULL; - + sem_wait (&buf->wait); pthread_mutex_lock (&buf->lock); if (buf->readpos != buf->writepos) { event = buf->events + buf->readpos; - + buf->readpos++; - if (buf->readpos >= buf->size) + if (buf->readpos >= buf->size) buf->readpos = 0; } @@ -221,11 +221,11 @@ static XVFBEVENT* get_event_data (XVFBEVENTBUFFER* buf) pthread_mutex_unlock(&buf->lock); return event; - + } -static int wait_event (int which, int maxfd, fd_set *in, +static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { int retvalue = 0; diff --git a/src/ial/skyeye-ep7312.c b/src/ial/skyeye-ep7312.c index 1aea2bca..1b48fb2f 100644 --- a/src/ial/skyeye-ep7312.c +++ b/src/ial/skyeye-ep7312.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* -** skyeye-ep7312.c: Low Level Input Engine for touch screen of +** skyeye-ep7312.c: Low Level Input Engine for touch screen of ** SkyEye EP7312 simulation -** +** ** Created by Wei Yongming, 2005/03/10 */ @@ -128,13 +128,8 @@ static int mouse_getbutton (void) return pen_down; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -147,17 +142,10 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); @@ -188,8 +176,8 @@ BOOL InitSkyEyeEP7312Input (INPUT* input, const char* mdev, const char* mtype) fprintf (stderr, "Error %d opening touch panel\n", errno); return FALSE; } - - // ywc 2004-07-05 + + // ywc 2004-07-05 err = ioctl (ts, TS_PARAMS_GET, &drv_params); if (err == -1) { close (ts); @@ -209,7 +197,7 @@ BOOL InitSkyEyeEP7312Input (INPUT* input, const char* mdev, const char* mtype) drv_params.xy_swap = 0; /* - * according to mc68328digi.h 'How to calculate the parameters', + * according to mc68328digi.h 'How to calculate the parameters', * we have measured: */ mx1 = 508; ux1 = 0; @@ -229,7 +217,7 @@ BOOL InitSkyEyeEP7312Input (INPUT* input, const char* mdev, const char* mtype) drv_params.y_ratio_den = my1 - my2; drv_params.y_offset = uy1 - my1 * drv_params.y_ratio_num / drv_params.y_ratio_den; - //ywc 2004-07-05 + //ywc 2004-07-05 err = ioctl (ts, TS_PARAMS_SET, &drv_params); if (err == -1) { close (ts); diff --git a/src/ial/svgalib.c b/src/ial/svgalib.c index 68f78778..b3a9417c 100644 --- a/src/ial/svgalib.c +++ b/src/ial/svgalib.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -155,13 +155,13 @@ static void mouse_getxy (int* x, int* y) static void mouse_setrange(int minx,int miny,int maxx,int maxy) { - mouse_setxrange(minx,maxx); - mouse_setyrange(miny,maxy); + mouse_setxrange(minx,maxx); + mouse_setyrange(miny,maxy); } static int my_keyboard_update (void) { - if (keyboard_update ()) + if (keyboard_update ()) return NR_KEYS; return 0; diff --git a/src/ial/svpxx.c b/src/ial/svpxx.c index a2ecb29e..0a6c15b7 100644 --- a/src/ial/svpxx.c +++ b/src/ial/svpxx.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -178,16 +178,12 @@ static const char * keyboard_get_state (void) return (char *) state; } -static int wait_event (int which, fd_set * in, fd_set * out, fd_set * except, +static int wait_event (int which, int maxfd, fd_set * in, fd_set * out, fd_set * except, struct timeval *timeout) { int e; -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif if (cur_key) { if (cur_key) { diff --git a/src/ial/t800.c b/src/ial/t800.c index 01b8cca8..fd68d5c8 100644 --- a/src/ial/t800.c +++ b/src/ial/t800.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -98,7 +98,7 @@ static int t800_kbd_read (unsigned char *buf, int *modifiers) *modifiers = 0; /* no modifiers yet */ cc = read (kbd_fd, &buf1, 1); - + *buf = buf1; if (cc > 0) { return 1; @@ -118,7 +118,7 @@ static int keyboard_update (void) int is_pressed; int retvalue; - retvalue = t800_kbd_read (&buf, &modifier); + retvalue = t800_kbd_read (&buf, &modifier); if ((retvalue == -1) || (retvalue == 0)) return 0; @@ -128,7 +128,7 @@ static int keyboard_update (void) ch = buf & 0x7f; if (is_pressed) state[ch] = 1; - else + else state[ch] = 0; } @@ -140,13 +140,8 @@ static const char* keyboard_getstate (void) return state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -158,29 +153,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, } if (which & IAL_MOUSEEVENT && mouse_fd >= 0) { - fd = mouse_fd; /* FIXME: mouse fd may be changed in vt switch! */ + fd = mouse_fd; FD_SET (fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif } if (which & IAL_KEYEVENT && kbd_fd >= 0){ - fd = kbd_fd; /* FIXME: keyboard fd may be changed in vt switch! */ + fd = kbd_fd; FD_SET (kbd_fd, in); -#ifdef _LITE_VERSION if (fd > maxfd) maxfd = fd; -#endif } - /* FIXME: pass the real set size */ -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout) ; -#else - e = select (FD_SETSIZE, in, out, except, timeout) ; -#endif - - if (e > 0) { + if (e > 0) { fd = mouse_fd; /* If data is present on the mouse fd, service it: */ if (fd >= 0 && FD_ISSET (fd, in)) { @@ -205,7 +190,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, BOOL InitT800Input (INPUT* input, const char* mdev, const char* mtype) { kbd_fd = open(KEYBOARD, O_RDONLY | O_NOCTTY); - + if (kbd_fd < 0) return FALSE; diff --git a/src/ial/tf-stb.c b/src/ial/tf-stb.c index ba01681d..043bb1f6 100644 --- a/src/ial/tf-stb.c +++ b/src/ial/tf-stb.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** tf-stb.c: Low Level Input Engine for Tongfang STB. -** +** ** Author: Liu Jianping (RedFlag Software). ** ** Revised by snig, 2001/09/21 @@ -73,287 +73,287 @@ #include "tf-stb.h" #include "tf-code.h" -#define PANEL 1 -#define REMOTER 2 -#define KEYBOARD 3 +#define PANEL 1 +#define REMOTER 2 +#define KEYBOARD 3 BYTE __mg_panel_funcmap[2][16] = { { - SCANCODE_0, - SCANCODE_1, - SCANCODE_2, - SCANCODE_3, - SCANCODE_4, - SCANCODE_5, - SCANCODE_6, - SCANCODE_7, - SCANCODE_8, - SCANCODE_9, - SCANCODE_ENTER, - FUNCCODE_VIDEOMODE, - FUNCCODE_MENU, - FUNCCODE_DISCEXCH, - FUNCCODE_VOLUP, - FUNCCODE_VOLDOWN + SCANCODE_0, + SCANCODE_1, + SCANCODE_2, + SCANCODE_3, + SCANCODE_4, + SCANCODE_5, + SCANCODE_6, + SCANCODE_7, + SCANCODE_8, + SCANCODE_9, + SCANCODE_ENTER, + FUNCCODE_VIDEOMODE, + FUNCCODE_MENU, + FUNCCODE_DISCEXCH, + FUNCCODE_VOLUP, + FUNCCODE_VOLDOWN }, { - FUNCCODE_PLAYPAUSE, - FUNCCODE_STOP, - FUNCCODE_SF, - FUNCCODE_EJECT, - FUNCCODE_FB, - FUNCCODE_FF, - FUNCCODE_PREVIOUS, - FUNCCODE_NEXT, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_PLAYPAUSE, + FUNCCODE_STOP, + FUNCCODE_SF, + FUNCCODE_EJECT, + FUNCCODE_FB, + FUNCCODE_FF, + FUNCCODE_PREVIOUS, + FUNCCODE_NEXT, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE } }; BYTE __mg_remoter_funcmap[6][16] = { { - SCANCODE_0, - SCANCODE_1, - SCANCODE_2, - SCANCODE_3, - SCANCODE_4, - SCANCODE_5, - SCANCODE_6, - SCANCODE_7, - SCANCODE_8, - SCANCODE_9, - SCANCODE_ENTER, - FUNCCODE_CLEAR, // ? - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + SCANCODE_0, + SCANCODE_1, + SCANCODE_2, + SCANCODE_3, + SCANCODE_4, + SCANCODE_5, + SCANCODE_6, + SCANCODE_7, + SCANCODE_8, + SCANCODE_9, + SCANCODE_ENTER, + FUNCCODE_CLEAR, // ? + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_PLAYPAUSE, - FUNCCODE_STOP, - FUNCCODE_SF, - FUNCCODE_EJECT, - FUNCCODE_FB, - FUNCCODE_FF, - FUNCCODE_PREVIOUS, - FUNCCODE_NEXT, - FUNCCODE_SR, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_PLAYPAUSE, + FUNCCODE_STOP, + FUNCCODE_SF, + FUNCCODE_EJECT, + FUNCCODE_FB, + FUNCCODE_FF, + FUNCCODE_PREVIOUS, + FUNCCODE_NEXT, + FUNCCODE_SR, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_POWER, - FUNCCODE_VIDEOMODE, - FUNCCODE_OPMODE, - FUNCCODE_UP, - FUNCCODE_DOWN, - FUNCCODE_LEFT, - FUNCCODE_RIGHT, - FUNCCODE_SELECT, - FUNCCODE_DISCEXCH, - FUNCCODE_SETUP, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_POWER, + FUNCCODE_VIDEOMODE, + FUNCCODE_OPMODE, + FUNCCODE_UP, + FUNCCODE_DOWN, + FUNCCODE_LEFT, + FUNCCODE_RIGHT, + FUNCCODE_SELECT, + FUNCCODE_DISCEXCH, + FUNCCODE_SETUP, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_VOLUP, - FUNCCODE_VOLDOWN, - FUNCCODE_MUTE, - FUNCCODE_LR, - FUNCCODE_AUDIOMODE, - FUNCCODE_3D, - FUNCCODE_EQ, - FUNCCODE_KARAOKE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_VOLUP, + FUNCCODE_VOLDOWN, + FUNCCODE_MUTE, + FUNCCODE_LR, + FUNCCODE_AUDIOMODE, + FUNCCODE_3D, + FUNCCODE_EQ, + FUNCCODE_KARAOKE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_PROG, - FUNCCODE_TITLE, - FUNCCODE_ANGLE, - FUNCCODE_AB, - FUNCCODE_REPEAT, - FUNCCODE_ZOOM, - FUNCCODE_OSD, - FUNCCODE_LANG, - FUNCCODE_SUBTITLE, - FUNCCODE_MENU, - FUNCCODE_DISPLAY, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_PROG, + FUNCCODE_TITLE, + FUNCCODE_ANGLE, + FUNCCODE_AB, + FUNCCODE_REPEAT, + FUNCCODE_ZOOM, + FUNCCODE_OSD, + FUNCCODE_LANG, + FUNCCODE_SUBTITLE, + FUNCCODE_MENU, + FUNCCODE_DISPLAY, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_EMAIL, - FUNCCODE_WEB, - FUNCCODE_START, - FUNCCODE_REFRESH, - FUNCCODE_ENLARGE, - FUNCCODE_FAVORITE, - FUNCCODE_ESC, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_EMAIL, + FUNCCODE_WEB, + FUNCCODE_START, + FUNCCODE_REFRESH, + FUNCCODE_ENLARGE, + FUNCCODE_FAVORITE, + FUNCCODE_ESC, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE } }; BYTE __mg_kb_funcmap[7][16] = { { - SCANCODE_7, - SCANCODE_8, - SCANCODE_9, - SCANCODE_0, - SCANCODE_U, - SCANCODE_I, - SCANCODE_O, - SCANCODE_P, - SCANCODE_J, - SCANCODE_K, - SCANCODE_L, - SCANCODE_SEMICOLON, - SCANCODE_M, - SCANCODE_PERIOD, - SCANCODE_SLASH, - SCANCODE_ENTER + SCANCODE_7, + SCANCODE_8, + SCANCODE_9, + SCANCODE_0, + SCANCODE_U, + SCANCODE_I, + SCANCODE_O, + SCANCODE_P, + SCANCODE_J, + SCANCODE_K, + SCANCODE_L, + SCANCODE_SEMICOLON, + SCANCODE_M, + SCANCODE_PERIOD, + SCANCODE_SLASH, + SCANCODE_ENTER }, { - SCANCODE_F1, - SCANCODE_F2, - SCANCODE_F3, - SCANCODE_F4, - SCANCODE_F5, - SCANCODE_F6, - SCANCODE_F7, - SCANCODE_F8, - SCANCODE_F9, - SCANCODE_F10, - SCANCODE_F11, - SCANCODE_F12, - SCANCODE_ESCAPE, - SCANCODE_NUMLOCK, - SCANCODE_PRINTSCREEN, - SCANCODE_SCROLLLOCK + SCANCODE_F1, + SCANCODE_F2, + SCANCODE_F3, + SCANCODE_F4, + SCANCODE_F5, + SCANCODE_F6, + SCANCODE_F7, + SCANCODE_F8, + SCANCODE_F9, + SCANCODE_F10, + SCANCODE_F11, + SCANCODE_F12, + SCANCODE_ESCAPE, + SCANCODE_NUMLOCK, + SCANCODE_PRINTSCREEN, + SCANCODE_SCROLLLOCK }, { - SCANCODE_BREAK, - SCANCODE_GRAVE, - SCANCODE_1, - SCANCODE_2, - SCANCODE_3, - SCANCODE_4, - SCANCODE_5, - SCANCODE_6, - SCANCODE_MINUS, - SCANCODE_EQUAL, - SCANCODE_BACKSPACE, - SCANCODE_TAB, - SCANCODE_Q, - SCANCODE_W, - SCANCODE_E, - SCANCODE_R + SCANCODE_BREAK, + SCANCODE_GRAVE, + SCANCODE_1, + SCANCODE_2, + SCANCODE_3, + SCANCODE_4, + SCANCODE_5, + SCANCODE_6, + SCANCODE_MINUS, + SCANCODE_EQUAL, + SCANCODE_BACKSPACE, + SCANCODE_TAB, + SCANCODE_Q, + SCANCODE_W, + SCANCODE_E, + SCANCODE_R }, { - SCANCODE_T, - SCANCODE_Y, - SCANCODE_CAPSLOCK, - SCANCODE_A, - SCANCODE_S, - SCANCODE_D, - SCANCODE_F, - SCANCODE_G, - SCANCODE_H, - SCANCODE_Z, - SCANCODE_X, - SCANCODE_C, - SCANCODE_V, - SCANCODE_B, - SCANCODE_N, - SCANCODE_LEFTSHIFT, + SCANCODE_T, + SCANCODE_Y, + SCANCODE_CAPSLOCK, + SCANCODE_A, + SCANCODE_S, + SCANCODE_D, + SCANCODE_F, + SCANCODE_G, + SCANCODE_H, + SCANCODE_Z, + SCANCODE_X, + SCANCODE_C, + SCANCODE_V, + SCANCODE_B, + SCANCODE_N, + SCANCODE_LEFTSHIFT, }, { - FUNCCODE_LEFTWIN, - SCANCODE_CURSORBLOCKUP, - SCANCODE_CURSORBLOCKRIGHT, - SCANCODE_LEFTALT, - FUNCCODE_RIGHTWIN, - SCANCODE_PAGEUP, - SCANCODE_HOME, - SCANCODE_RIGHTALT, - FUNCCODE_APP, - SCANCODE_PAGEDOWN, - SCANCODE_END, - SCANCODE_RIGHTCONTROL, - SCANCODE_INSERT, - SCANCODE_LEFTCONTROL, - SCANCODE_CURSORBLOCKDOWN, - SCANCODE_CURSORBLOCKLEFT, + FUNCCODE_LEFTWIN, + SCANCODE_CURSORBLOCKUP, + SCANCODE_CURSORBLOCKRIGHT, + SCANCODE_LEFTALT, + FUNCCODE_RIGHTWIN, + SCANCODE_PAGEUP, + SCANCODE_HOME, + SCANCODE_RIGHTALT, + FUNCCODE_APP, + SCANCODE_PAGEDOWN, + SCANCODE_END, + SCANCODE_RIGHTCONTROL, + SCANCODE_INSERT, + SCANCODE_LEFTCONTROL, + SCANCODE_CURSORBLOCKDOWN, + SCANCODE_CURSORBLOCKLEFT, }, { - SCANCODE_REMOVE, - SCANCODE_RIGHTCONTROL, - SCANCODE_PAGEDOWN, - SCANCODE_END, - SCANCODE_RIGHTSHIFT, - SCANCODE_SPACE, - SCANCODE_BRACKET_LEFT, - SCANCODE_BRACKET_RIGHT, - SCANCODE_BACKSLASH, - SCANCODE_APOSTROPHE, - SCANCODE_COMMA, - // TODO - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + SCANCODE_REMOVE, + SCANCODE_RIGHTCONTROL, + SCANCODE_PAGEDOWN, + SCANCODE_END, + SCANCODE_RIGHTSHIFT, + SCANCODE_SPACE, + SCANCODE_BRACKET_LEFT, + SCANCODE_BRACKET_RIGHT, + SCANCODE_BACKSLASH, + SCANCODE_APOSTROPHE, + SCANCODE_COMMA, + // TODO + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE }, { - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_MACRO, - FUNCCODE_POWER, - FUNCCODE_NONE, - FUNCCODE_SLEEP, - FUNCCODE_NONE, - FUNCCODE_WAKEUP, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE, - FUNCCODE_NONE + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_MACRO, + FUNCCODE_POWER, + FUNCCODE_NONE, + FUNCCODE_SLEEP, + FUNCCODE_NONE, + FUNCCODE_WAKEUP, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE, + FUNCCODE_NONE } }; @@ -364,47 +364,47 @@ static int button; static BYTE type; static unsigned char state[MGUI_NR_KEYS]; -/************************ code table transferation functions **************/ -/* - * get position code by serial code received +/************************ code table transferation functions **************/ +/* + * get position code by serial code received */ static BYTE get_poscode (BYTE serial_code, int code) { - switch (code) { - case PANEL: - case REMOTER: - case KEYBOARD: - } + switch (code) { + case PANEL: + case REMOTER: + case KEYBOARD: + } - return serial_code; + return serial_code; } /* * get function code by serial code received - */ + */ static BYTE get_funccode (BYTE serial_code, int code) { - int i, j; - BYTE pos_code; + int i, j; + BYTE pos_code; - pos_code = get_poscode (serial_code, code); + pos_code = get_poscode (serial_code, code); - i = pos_code & 0xF0; - j = pos_code & 0x0F; + i = pos_code & 0xF0; + j = pos_code & 0x0F; - switch (code) { - case PANEL: - return __mg_panel_funcmap[i][j]; - case REMOTER: - return __mg_remoter_funcmap[i][j]; - case KEYBOARD: - return __mg_kb_funcmap[i][j]; - default: - return -1; - } + switch (code) { + case PANEL: + return __mg_panel_funcmap[i][j]; + case REMOTER: + return __mg_remoter_funcmap[i][j]; + case KEYBOARD: + return __mg_kb_funcmap[i][j]; + default: + return -1; + } } @@ -417,35 +417,35 @@ static int mouse_update (void) { BYTE mouse_data[2]; BYTE data1, data2; - + read (serial, mouse_data, 2); data1 = mouse_data[0]; data2 = mouse_data[1]; - + // mouse button state - button = 0; + button = 0; if (mouse_data[1] & 0x10) button |= IAL_MOUSE_LEFTBUTTON; if (mouse_data[1] & 0x20) - button |= IAL_MOUSE_RIGHTBUTTON; - + button |= IAL_MOUSE_RIGHTBUTTON; + // x move left or right - if (mouse_data[1] & 0x40) - mousex -= mouse_data[0] & 0x3F; - else - mousex += mouse_data[0] & 0x3F; - + if (mouse_data[1] & 0x40) + mousex -= mouse_data[0] & 0x3F; + else + mousex += mouse_data[0] & 0x3F; + // get y data data1 >>= 2; data1 &= 0x30; - data2 &= 0x0F; - data1 &= data2; + data2 &= 0x0F; + data1 &= data2; // y move up or down - if (mouse_data[1] & 0x80) - mousey += data1; - else - mousey -= data1; - + if (mouse_data[1] & 0x80) + mousey += data1; + else + mousey -= data1; + if (mousex >= 640) mousex = 639; if (mousex <= 0) @@ -455,7 +455,7 @@ static int mouse_update (void) mousey = 480; if (mousey <= 0) mousey = 0; - + return 0; } @@ -476,53 +476,53 @@ static void mouse_setrange(int minx,int miny,int maxx,int maxy) static int keyboard_update(void) { - BYTE serial_code[2]; - + BYTE serial_code[2]; + read (serial, serial_code, 2); if (type == 1) { - state[get_funccode (serial_code[0] & 0x7F, KEYBOARD)] = 1; - if (serial_code[1] & 0x80) //win-r - state[FUNCCODE_RIGHTWIN] = 1; - if (serial_code[1] & 0x40) //win-l - state[FUNCCODE_LEFTWIN] = 1; - if (serial_code[1] & 0x20) //shift-r - state[SCANCODE_RIGHTSHIFT] = 1; - if (serial_code[1] & 0x10) //shift-l - state[SCANCODE_LEFTSHIFT] = 1; - if (serial_code[1] & 0x08) //ctrl-r - state[SCANCODE_RIGHTCONTROL] = 1; - if (serial_code[1] & 0x04) //ctrl-l + state[get_funccode (serial_code[0] & 0x7F, KEYBOARD)] = 1; + if (serial_code[1] & 0x80) //win-r + state[FUNCCODE_RIGHTWIN] = 1; + if (serial_code[1] & 0x40) //win-l + state[FUNCCODE_LEFTWIN] = 1; + if (serial_code[1] & 0x20) //shift-r + state[SCANCODE_RIGHTSHIFT] = 1; + if (serial_code[1] & 0x10) //shift-l + state[SCANCODE_LEFTSHIFT] = 1; + if (serial_code[1] & 0x08) //ctrl-r + state[SCANCODE_RIGHTCONTROL] = 1; + if (serial_code[1] & 0x04) //ctrl-l state[SCANCODE_LEFTCONTROL] = 1; - if (serial_code[1] & 0x02) //alt-r - state[SCANCODE_RIGHTALT] = 1; - if (serial_code[1] & 0x01) //alt-l - state[SCANCODE_LEFTALT] = 1; + if (serial_code[1] & 0x02) //alt-r + state[SCANCODE_RIGHTALT] = 1; + if (serial_code[1] & 0x01) //alt-l + state[SCANCODE_LEFTALT] = 1; } else if (type == 2) { - state[get_funccode (serial_code[0] & 0x7F, KEYBOARD)] = 0; + state[get_funccode (serial_code[0] & 0x7F, KEYBOARD)] = 0; if (!serial_code[1] & 0x80) //win-r state[FUNCCODE_RIGHTWIN] = 0; - if (!serial_code[1] & 0x40) //win-l + if (!serial_code[1] & 0x40) //win-l state[FUNCCODE_LEFTWIN] = 0; - if (!serial_code[1] & 0x20) //shift-r + if (!serial_code[1] & 0x20) //shift-r state[SCANCODE_RIGHTSHIFT] = 0; - if (!serial_code[1] & 0x10) //shift-l + if (!serial_code[1] & 0x10) //shift-l state[SCANCODE_LEFTSHIFT] = 0; - if (!serial_code[1] & 0x08) //ctrl-r + if (!serial_code[1] & 0x08) //ctrl-r state[SCANCODE_RIGHTCONTROL] = 0; - if (!serial_code[1] & 0x04) //ctrl-l + if (!serial_code[1] & 0x04) //ctrl-l state[SCANCODE_LEFTCONTROL] = 0; - if (!serial_code[1] & 0x02) //alt-r - state[SCANCODE_RIGHTALT] = 0; - if (!serial_code[1] & 0x01) //alt-l - state[SCANCODE_LEFTALT] = 0; + if (!serial_code[1] & 0x02) //alt-r + state[SCANCODE_RIGHTALT] = 0; + if (!serial_code[1] & 0x01) //alt-l + state[SCANCODE_LEFTALT] = 0; } else if (type == 5) { // from front panel - state[get_funccode(serial_code[0] & 0x7F, PANEL)] = 1; + state[get_funccode(serial_code[0] & 0x7F, PANEL)] = 1; } else if (type == 6) { // from remote control - state[get_funccode(serial_code[0] & 0x7F, REMOTER)] = 1; - } + state[get_funccode(serial_code[0] & 0x7F, REMOTER)] = 1; + } return 0; } @@ -531,8 +531,6 @@ static const char * keyboard_geserialstate(void) return (char *)state; } -#ifdef _LITE_VERSION - static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { @@ -552,74 +550,65 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex e = select (maxfd + 1, in, out, except, timeout) ; - if (e < 0) - return -1; + if (e < 0) + return -1; if (serial >= 0 && FD_ISSET (serial, in)) { FD_CLR (serial, in); - read (serial, &esc, 1); - if (esc != 0x1B) { - fprintf (stderr, "Read input data error.\n"); - return -1; - } - - read (serial, &type, 1); - switch (type) { - case 1: // keyboard - case 2: // keyboard - return IAL_KEYEVENT; - case 3: // mouse - return IAL_MOUSEEVENT; - case 5: // front panel keypad - return IAL_KEYEVENT; - case 6: // remote control - return IAL_KEYEVENT; - default: - fprintf (stderr, "Not supported ESC code.\n"); - return 0; - } + read (serial, &esc, 1); + if (esc != 0x1B) { + fprintf (stderr, "Read input data error.\n"); + return -1; + } + + read (serial, &type, 1); + switch (type) { + case 1: // keyboard + case 2: // keyboard + return IAL_KEYEVENT; + case 3: // mouse + return IAL_MOUSEEVENT; + case 5: // front panel keypad + return IAL_KEYEVENT; + case 6: // remote control + return IAL_KEYEVENT; + default: + fprintf (stderr, "Not supported ESC code.\n"); + return 0; + } } return 0; } -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -{ - // do nothing - return 0; -} -#endif - static void set_leds ( unsigned int leds ) { } static int init_serial (void) { - struct termios term; - + struct termios term; + serial = open ("/dev/ttyS0", O_RDONLY | O_NOCTTY); // FIXME while VFD included if (serial < 0) { fprintf (stderr, "IAL: Can not open /dev/ttyS0 for Tongfang STB!\n"); - return -1; + return -1; } - + if ( tcgetattr (serial, &term) < 0 ) { - perror ("TFSTB tcgetattr"); - return -1; - } + perror ("TFSTB tcgetattr"); + return -1; + } cfsetispeed (&term, B9600); cfsetospeed (&term, B9600); if ( tcsetattr (serial, TCSANOW, &term) < 0 ) { - perror ("TFSTB tcsetattr"); - return -1; - } + perror ("TFSTB tcsetattr"); + return -1; + } return 0; } @@ -628,8 +617,8 @@ BOOL InitTFSTBInput (INPUT* input, const char* mdev, const char* mtype) { int i ; - if (init_serial () < 0) - return FALSE; + if (init_serial () < 0) + return FALSE; for (i = 0 ; i < MGUI_NR_KEYS; i++) state[i] = 0; @@ -650,8 +639,8 @@ BOOL InitTFSTBInput (INPUT* input, const char* mdev, const char* mtype) void TermTFSTBInput (void) { if (serial >= 0) - close (serial); - + close (serial); + } #endif /* _TFSTB_IAL */ diff --git a/src/ial/thor.c b/src/ial/thor.c index 1fb98508..5ba9882a 100644 --- a/src/ial/thor.c +++ b/src/ial/thor.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -102,10 +102,10 @@ static int mouse_update(void) static void mouse_getxy(int *x, int* y) { - if (mousex < 0) mousex = 0; - if (mousey < 0) mousey = 0; - if (mousex > 239) mousex = 239; - if (mousey > 319) mousey = 319; + if (mousex < 0) mousex = 0; + if (mousey < 0) mousey = 0; + if (mousex > 239) mousex = 239; + if (mousey > 319) mousey = 319; *x = mousex; *y = mousey; @@ -125,7 +125,7 @@ static int keyboard_update(void) int retvalue; retvalue = read_keypad(&buf); - + if ((retvalue == -1) || (retvalue == 0)) return 0; else { /* retvalue > 0 */ @@ -134,7 +134,7 @@ static int keyboard_update(void) if (is_pressed) { state[ch] = 1; } - else + else state[ch] = 0; } @@ -148,28 +148,13 @@ static const char* keyboard_getstate(void) } -#ifdef _LITE_VERSION -#if 0 -int IsSysPadKey(unsigned char scancode) { - if ((scancode == SCANCODE_PHONE) || (scancode == SCANCODE_HANGUP)) - return 1; - else - return 0; -} - -void FillSKBDBuffer(unsigned char ch) { - *_input_buff_writepointer++ = ch; - if ((_input_buff_writepointer - _input_buff) >= INPUTBUFF_LEN) - _input_buff_writepointer = _input_buff; -} -#endif static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { fd_set rfds; int fd, e; int retvalue = 0; - + if (!in) { in = &rfds; FD_ZERO (in); @@ -179,41 +164,41 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex FD_SET (ts, in); if (ts > maxfd) maxfd = ts; } - -#ifdef USE_KEYPAD + +#ifdef USE_KEYPAD if (which & IAL_KEYEVENT && pad >= 0){ FD_SET (pad, in); if (pad > maxfd) maxfd = pad; } #endif - + e = select (maxfd + 1, in, out, except, timeout) ; - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); - + pos.x=-1; pos.y=-1; // FIXME: maybe failed due to the struct alignment. - read (ts, &pos, sizeof (POS)); + read (ts, &pos, sizeof (POS)); if (pos.x != 0 && pos.y != 0) { - //CASANOVA - float tmpx, tmpy; - - tmpx = pos.x; - tmpy = pos.y; - + //CASANOVA + float tmpx, tmpy; + + tmpx = pos.x; + tmpy = pos.y; + tmpx /= AX; - tmpy /= AY; - - tmpx -= BX; - tmpy -= BY; - - pos.x = (unsigned short)(tmpx < 0?0:tmpx); - pos.y = (unsigned short)(tmpy < 0?0:tmpy); - + tmpy /= AY; + + tmpx -= BX; + tmpy -= BY; + + pos.x = (unsigned short)(tmpx < 0?0:tmpx); + pos.y = (unsigned short)(tmpy < 0?0:tmpy); + mousex = pos.x; mousey = pos.y; } @@ -221,12 +206,12 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex retvalue |= IAL_MOUSEEVENT; } -#ifdef USE_KEYPAD +#ifdef USE_KEYPAD if (pad >= 0 && FD_ISSET(pad, in)) { - + FD_CLR(pad, in); retvalue |= IAL_KEYEVENT; - + } #endif } else if (e < 0) { @@ -242,11 +227,11 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ( (which & IAL_MOUSEEVENT) == IAL_MOUSEEVENT) { ufd.fd = ts; - ufd.events = POLLIN; + ufd.events = POLLIN; if ( poll (&ufd, 1, timeout) > 0) { // FIXME: maybe failed due to the struct alignment. - read (ts, &pos, sizeof(POS)); + read (ts, &pos, sizeof(POS)); return IAL_MOUSEEVENT; } } @@ -266,14 +251,14 @@ BOOL InitTHORInput (INPUT* input, const char* mdev, const char* mtype) fp = fopen("/tmp/calibrate.conf", "r"); if (fp == NULL) { - fprintf (stderr, "IAL: Can not read calibrate conf!\n"); - return FALSE; + fprintf (stderr, "IAL: Can not read calibrate conf!\n"); + return FALSE; } - fscanf(fp, "%f %f %f %f", &AX, &AY, &BX, &BY); + fscanf(fp, "%f %f %f %f", &AX, &AY, &BX, &BY); printf("DEBUG: AX=%f AY=%f BX=%f BY=%f\n", AX, AY, BX, BY); fclose(fp); - -#ifdef USE_KEYPAD + +#ifdef USE_KEYPAD pad = open ("/tmp/pad", O_RDONLY); if ( pad < 0 ) { pad = open ("/tmp/key", O_RDONLY); @@ -288,7 +273,7 @@ BOOL InitTHORInput (INPUT* input, const char* mdev, const char* mtype) #else pad = -1; #endif - + input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; @@ -306,13 +291,7 @@ BOOL InitTHORInput (INPUT* input, const char* mdev, const char* mtype) mousex = 0; mousey = 0; pos.x=pos.y=pos.b=0; - -//#ifdef _LITE_VERSION -// if (mgIsServer) -// init_vtswitch (kbd_fd); -//#endif - return TRUE; } @@ -323,39 +302,39 @@ void TermTHORInput (void) } static unsigned char KEYPAD_SCANCODE[10] = { - 0, - SCANCODE_CURSORBLOCKUP, //SCANCODE_KEYPADF1, - SCANCODE_KEYPADF2, - SCANCODE_KEYPADF3, - SCANCODE_KEYPADF4, - SCANCODE_CURSORBLOCKRIGHT,//SCANCODE_KEYPADF5, - SCANCODE_CURSORBLOCKDOWN,//SCANCODE_KEYPADF6, - SCANCODE_CURSORBLOCKLEFT,//SCANCODE_KEYPADF7, - SCANCODE_KEYPADF8, - SCANCODE_ENTER//SCANCODE_KEYPADF9 + 0, + SCANCODE_CURSORBLOCKUP, //SCANCODE_KEYPADF1, + SCANCODE_KEYPADF2, + SCANCODE_KEYPADF3, + SCANCODE_KEYPADF4, + SCANCODE_CURSORBLOCKRIGHT,//SCANCODE_KEYPADF5, + SCANCODE_CURSORBLOCKDOWN,//SCANCODE_KEYPADF6, + SCANCODE_CURSORBLOCKLEFT,//SCANCODE_KEYPADF7, + SCANCODE_KEYPADF8, + SCANCODE_ENTER//SCANCODE_KEYPADF9 }; static int read_keypad(unsigned char* key) { - int ret; + int ret; unsigned char tmp; - if (pad < 0) { - *key = 0; - return 0; - } + if (pad < 0) { + *key = 0; + return 0; + } - ret = read(pad, &tmp, 1); - if (ret <= 0) { - *key = 0; - } else if (tmp < 10 && tmp > 0) { - *key = KEYPAD_SCANCODE[tmp]; - } else if (tmp < (0x80 + 10) && tmp > 0x80) { + ret = read(pad, &tmp, 1); + if (ret <= 0) { + *key = 0; + } else if (tmp < 10 && tmp > 0) { + *key = KEYPAD_SCANCODE[tmp]; + } else if (tmp < (0x80 + 10) && tmp > 0x80) { *key = KEYPAD_SCANCODE[tmp - 0x80] + 0x80; } else { - fprintf(stderr, "IAL KEYPAD BUG: Illegal key = %d\n", tmp); - *key = 0; - ret = 0; - } - return ret; + fprintf(stderr, "IAL KEYPAD BUG: Illegal key = %d\n", tmp); + *key = 0; + ret = 0; + } + return ret; } #endif /* _THOR_IAL */ diff --git a/src/ial/tslibial.c b/src/ial/tslibial.c index f403df4e..a83d43a3 100644 --- a/src/ial/tslibial.c +++ b/src/ial/tslibial.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -131,11 +131,11 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex e = select (FD_SETSIZE, in, out, except, timeout); #endif - if (e > 0) { + if (e > 0) { if (fd > 0 && FD_ISSET (fd, in)) { return IAL_MOUSEEVENT; } - } + } else if (e < 0) { return -1; } @@ -167,7 +167,7 @@ BOOL InitTSLibInput(INPUT* input, const char* mdev, const char* mtype) _WRN_PRINTF ("IAL>TSLib: can not config ts device\n"); return FALSE; } - + input->update_mouse = mouse_update; input->get_mouse_xy = mouse_getxy; input->set_mouse_xy = NULL; @@ -181,7 +181,7 @@ BOOL InitTSLibInput(INPUT* input, const char* mdev, const char* mtype) void TermTSLibInput(void) { if (ts) { - ts_close(ts); + ts_close(ts); ts = NULL; } } diff --git a/src/ial/ucb1x00.c b/src/ial/ucb1x00.c index 5c37c84a..8d5fee06 100644 --- a/src/ial/ucb1x00.c +++ b/src/ial/ucb1x00.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** ucb1x00.c: IAL Engine for UCB1x00 board. -** +** ** Author: Zhong Shuyi (2003/12/28) */ @@ -72,16 +72,16 @@ #include "ucb1x00.h" -#define _DEBUG_UCB1X00 0 +#define _DEBUG_UCB1X00 0 /* ------------------------------------------------------------------------- */ #ifndef KEY_RELEASED -#define KEY_RELEASED 0x80 +#define KEY_RELEASED 0x80 #endif #ifndef KEY_NUM -#define KEY_NUM 0x7F +#define KEY_NUM 0x7F #endif /* for data reading from /dev/tpanel */ @@ -145,13 +145,13 @@ static int keyboard_update(void) key = btn_state & KEY_NUM; if (key == SCANCODE_CURSORLEFT) - key = SCANCODE_CURSORBLOCKLEFT; + key = SCANCODE_CURSORBLOCKLEFT; else if (key == SCANCODE_CURSORRIGHT) - key = SCANCODE_CURSORBLOCKRIGHT; + key = SCANCODE_CURSORBLOCKRIGHT; else if (key == SCANCODE_CURSORUP) - key = SCANCODE_CURSORBLOCKUP; + key = SCANCODE_CURSORBLOCKUP; else if (key == SCANCODE_CURSORDOWN) - key = SCANCODE_CURSORBLOCKDOWN; + key = SCANCODE_CURSORBLOCKDOWN; state[key] = status; @@ -163,13 +163,8 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { fd_set rfds; int retvalue = 0; @@ -181,23 +176,15 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && ts >= 0) { FD_SET (ts, in); -#ifdef _LITE_VERSION if (ts > maxfd) maxfd = ts; -#endif } if ((which & IAL_KEYEVENT) && kb_fd >= 0){ FD_SET (kb_fd, in); -#ifdef _LITE_VERSION if(kb_fd > maxfd) maxfd = kb_fd; -#endif } -#ifdef _LITE_VERSION if ( select (maxfd + 1, in, out, except, timeout) < 0 ) -#else - if ( select (FD_SETSIZE, in, out, except, timeout) < 0 ) -#endif - return -1; + return -1; if (ts >= 0 && FD_ISSET (ts, in)) { @@ -205,18 +192,18 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ( read (ts, &raw_pos, sizeof (RAW_POS)) == sizeof(RAW_POS) ) { if (raw_pos.header != 0) { - transform(&pos, &raw_pos); + transform(&pos, &raw_pos); } - else + else pos.header = raw_pos.header; - pos.header = ( pos.header > 0 ? 4:0 ); - printf("raw:header=%d x=%d y=%d\n", raw_pos.header, raw_pos.x, raw_pos.y); - printf("header=%d x=%d y=%d\n", pos.header, pos.x, pos.y); + pos.header = ( pos.header > 0 ? 4:0 ); + printf("raw:header=%d x=%d y=%d\n", raw_pos.header, raw_pos.x, raw_pos.y); + printf("header=%d x=%d y=%d\n", pos.header, pos.x, pos.y); retvalue |= IAL_MOUSEEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -228,19 +215,19 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if (read(kb_fd, &scankey, sizeof(scankey)) == sizeof(scankey)) { #if _DEBUG_UCB1X00 - printf ("scankey = %d\n", scankey); + printf ("scankey = %d\n", scankey); #endif - /* 224 where from ? */ - if (scankey == 224) { - return -1; - } + /* 224 where from ? */ + if (scankey == 224) { + return -1; + } btn_state = scankey; retvalue |= IAL_KEYEVENT; } else { - fprintf (stderr, "read pos data error!\n"); - return -1; + fprintf (stderr, "read pos data error!\n"); + return -1; } } @@ -254,26 +241,26 @@ BOOL InitUCB1X00Input (INPUT* input, const char* mdev, const char* mtype) const char *p; int i = 0, j = 0; - //read /etc/pointercal + //read /etc/pointercal conffd = open ("/etc/pointercal", O_RDONLY); if(conffd < 0) { - fprintf (stderr, "UCB1X00: Can not open calibrate configure\n"); - return FALSE; + fprintf (stderr, "UCB1X00: Can not open calibrate configure\n"); + return FALSE; } read(conffd, buff, 128); while(j <7) { - p = &buff[i]; - if(j == 0) a = atoi(p); - else if(j == 1) b = atoi(p); - else if(j == 2) c = atoi(p); - else if(j == 3) d = atoi(p); - else if(j == 4) e = atoi(p); - else if(j == 5) f = atoi(p); - else if(j == 6) s = atoi(p); - else break; - j ++; - while(buff[i] != 0x20 && buff[i] != 0) i++; - i ++; + p = &buff[i]; + if(j == 0) a = atoi(p); + else if(j == 1) b = atoi(p); + else if(j == 2) c = atoi(p); + else if(j == 3) d = atoi(p); + else if(j == 4) e = atoi(p); + else if(j == 5) f = atoi(p); + else if(j == 6) s = atoi(p); + else break; + j ++; + while(buff[i] != 0x20 && buff[i] != 0) i++; + i ++; } close(conffd); @@ -307,7 +294,7 @@ BOOL InitUCB1X00Input (INPUT* input, const char* mdev, const char* mtype) input->wait_event = wait_event; pos.x = pos.y = pos.header = 0; - + return TRUE; } @@ -316,7 +303,7 @@ void TermUCB1X00Input (void) if (ts >= 0) close(ts); if (kb_fd >= 0) - close(kb_fd); + close(kb_fd); } #endif /* _UCB1X00_IAL */ diff --git a/src/ial/usvfbinput.c b/src/ial/usvfbinput.c index f1116727..f1917760 100644 --- a/src/ial/usvfbinput.c +++ b/src/ial/usvfbinput.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** usvfbinput.c: Input Engine for UnixSocket Virtual Frame Buffer -** +** ** Created by Vincent Wei, 2018/07/29 */ diff --git a/src/ial/utpmc.c b/src/ial/utpmc.c index e1076875..3fa3b795 100644 --- a/src/ial/utpmc.c +++ b/src/ial/utpmc.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** utpmc.c: IAL Engine for UTPMC board. -** +** ** Author: Zhong Shuyi (2003/12/28) */ @@ -148,13 +148,8 @@ static const unsigned char* keyboard_getpdtate(void) return (unsigned char *)key_state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -#endif { static unsigned int last_mouse_x; static unsigned int last_mouse_y; @@ -170,25 +165,16 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, if ((which & IAL_MOUSEEVENT) && touchpad_fd >= 0) { FD_SET (touchpad_fd, in); -#ifdef _LITE_VERSION if (touchpad_fd > maxfd) maxfd = touchpad_fd; -#endif } if ((which & IAL_KEYEVENT) && keypad_fd >= 0){ FD_SET (keypad_fd, in); -#ifdef _LITE_VERSION if (keypad_fd > maxfd) maxfd = keypad_fd; -#endif } -#ifdef _LITE_VERSION e = select (maxfd + 1, in, out, except, timeout); -#else - e = select (FD_SETSIZE, in, out, except, timeout); -#endif - - if (e > 0) { + if (e > 0) { if (touchpad_fd >= 0 && FD_ISSET (touchpad_fd, in)) { PEN_XYZ touch_info_raw; TOUCHINFO touch_info; @@ -203,14 +189,14 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, switch (touch_info.status) { case 2: /* lbutton down */ /* mask small mouse move event */ - if (is_leftbutton_down + if (is_leftbutton_down && (abs(last_mouse_x - touch_info.x) < PEN_X_THRESHOLD) && (abs(last_mouse_y - touch_info.y) < PEN_Y_THRESHOLD)) break; else { last_mouse_x = touch_info.x; last_mouse_y = touch_info.y; - + mousex = touch_info.x; mousey = touch_info.y; @@ -291,7 +277,7 @@ BOOL InitUTPMCInput (INPUT* input, const char* mdev, const char* mtype) } set_calibration(); - + return TRUE; } @@ -304,8 +290,8 @@ void TermUTPMCInput (void) close (keypad_fd); } -/*************************************************** - following code doing touchpad calibration +/*************************************************** + following code doing touchpad calibration ****************************************************/ static void set_calibration(void) { @@ -322,8 +308,8 @@ static void set_calibration(void) matrix.fn = -4865400; matrix.divider = 526662; } - - if (read (fd, &matrix, sizeof(CALIBRATION_MATRIX)) + + if (read (fd, &matrix, sizeof(CALIBRATION_MATRIX)) != sizeof(CALIBRATION_MATRIX)) { matrix.an = 187720; matrix.bn = 2180; diff --git a/src/ial/vp2008.c b/src/ial/vp2008.c index b6a299eb..f748528b 100644 --- a/src/ial/vp2008.c +++ b/src/ial/vp2008.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** vp2008.c: The vp2008 IAL engine. -** +** ** Created by Wei Yongming, 2001/09/13 */ @@ -64,112 +64,112 @@ #include "vp2008.h" typedef struct InputEvent { - unsigned int dummy1; - unsigned int dummy2; - unsigned short type; - unsigned short code; - unsigned int value; + unsigned int dummy1; + unsigned int dummy2; + unsigned short type; + unsigned short code; + unsigned int value; } Myinputevent; typedef struct KeyMap { - int key_code; - ushort unicode; - ushort shift_unicode; - ushort ctrl_unicode; - ushort fn_key_code; - ushort fn_unicode; - ushort fn_shift_unicode; - ushort fn_ctrl_unicode; + int key_code; + ushort unicode; + ushort shift_unicode; + ushort ctrl_unicode; + ushort fn_key_code; + ushort fn_unicode; + ushort fn_shift_unicode; + ushort fn_ctrl_unicode; }yealinkKeyMap; -#define NOT_EXIST_KEY { MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff} +#define NOT_EXIST_KEY { MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff} static const yealinkKeyMap yealinkKeyM[] = { - /* 000 */ NOT_EXIST_KEY, - /* 001 */ { MY_SCANCODE_1, '1', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 002 */ { MY_SCANCODE_4, '4', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 003 */ { MY_SCANCODE_7, '7', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 004 */ { MY_SCANCODE_NOTEXIST, '*', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 005 */ { MY_SCANCODE_P, 'p', 'P', 'P'-64, MY_SCANCODE_7, '&', 0xffff, 0xffff}, - /* 006 */ { MY_SCANCODE_BACKSPACE, 8, 8, 0xffff, MY_SCANCODE_BACKSPACE, 0xffff, 0xffff, 0xffff}, - /* 007 */ { MY_SCANCODE_ENTER, 13, 13, 0xffff, MY_SCANCODE_ENTER, 13, 13, 0xffff}, - /* 008 */ { MY_SCANCODE_CURSORBLOCKRIGHT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_END, 0xffff, 0xffff, 0xffff}, - /* 009 */ { MY_SCANCODE_2, '2', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 010 */ { MY_SCANCODE_5, '5', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 011 */ { MY_SCANCODE_8, '8', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 012 */ { MY_SCANCODE_0, '0', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 013 */ { MY_SCANCODE_O, 'o', 'O', 'O'-64, MY_SCANCODE_5, '%', 0xffff, 0xffff}, - /* 014 */ { MY_SCANCODE_L, 'l', 'L', 'L'-64, MY_SCANCODE_0, ')', 0xffff, 0xffff}, - /* 015 */ { MY_SCANCODE_CURSORBLOCKUP, 0xffff , 0xffff , 0xffff , MY_SCANCODE_PAGEUP, 0xffff, 0xffff, 0xffff}, - /* 016 */ { MY_SCANCODE_CURSORBLOCKDOWN, 0xffff , 0xffff , 0xffff , MY_SCANCODE_PAGEDOWN, 0xffff, 0xffff, 0xffff}, - /* 017 */ { MY_SCANCODE_3, '3', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 018 */ { MY_SCANCODE_6, '6', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 019 */ { MY_SCANCODE_9, '9', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 020 */ { MY_SCANCODE_NOTEXIST, '#', 0xffff, 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 021 */ { MY_SCANCODE_I, 'i', 'I', 'I'-64, MY_SCANCODE_4, '$', 0xffff, 0xffff}, - /* 022 */ { MY_SCANCODE_K, 'k', 'K', 'K'-64, MY_SCANCODE_9, '(', 0xffff, 0xffff}, - /* 023 */ { MY_SCANCODE_M, 'm', 'M', 'M'-64, MY_SCANCODE_SEMICOLON, ':', 0xffff, 0xffff}, - /* 024 */ { MY_SCANCODE_CURSORBLOCKLEFT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_HOME, 0xffff, 0xffff, 0xffff}, - /* 025 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 026 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 027 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 028 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 029 */ { MY_SCANCODE_U, 'u', 'U', 'U'-64, MY_SCANCODE_2, '@', 0xffff, 0xffff}, - /* 030 */ { MY_SCANCODE_J, 'j', 'J', 'J'-64, MY_SCANCODE_GRAVE, '`', 0xffff, 0xffff}, - /* 031 */ { MY_SCANCODE_N, 'n', 'N', 'N'-64, MY_SCANCODE_BACKSLASH, '\\', 0xffff, 0xffff}, - /* 032 */ { MY_SCANCODE_REMOVE, 0xffff , 0xffff , 0xffff , MY_SCANCODE_REMOVE, 0xffff, 0xffff, 0xffff}, - /* 033 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 034 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 035 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 036 */ { MY_SCANCODE_F9, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 037 */ { MY_SCANCODE_Y, 'y', 'Y', 'Y'-64, MY_SCANCODE_1, '!', 0xffff, 0xffff}, - /* 038 */ { MY_SCANCODE_H, 'h', 'H', 'H'-64, MY_SCANCODE_6, '^', 0xffff, 0xffff}, - /* 039 */ { MY_SCANCODE_B, 'b', 'B', 'B'-64, MY_SCANCODE_BACKSLASH, '|', 0xffff, 0xffff}, - /* 040 */ { MY_SCANCODE_INSERT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_APOSTROPHE, '"', 0xffff, 0xffff}, - /* 041 */ { MY_SCANCODE_F1, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 042 */ { MY_SCANCODE_F3, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 043 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 044 */ { MY_SCANCODE_F10, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 045 */ { MY_SCANCODE_T, 't', 'T', 'T'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 046 */ { MY_SCANCODE_G, 'g', 'G', 'G'-64, MY_SCANCODE_GRAVE, '~', 0xffff, 0xffff}, - /* 047 */ { MY_SCANCODE_V, 'v', 'V', 'V'-64, MY_SCANCODE_EQUAL, '=', 0xffff, 0xffff}, - /* 048 */ { MY_SCANCODE_SPACE, ' ', ' ', 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 049 */ { MY_SCANCODE_F2, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 050 */ { MY_SCANCODE_F4, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 051 */ { MY_SCANCODE_F6, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 052 */ { MY_SCANCODE_F11, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 053 */ { MY_SCANCODE_R, 'r', 'R', 'R'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 054 */ { MY_SCANCODE_D, 'd', 'D', 'D'-64, MY_SCANCODE_BRACKET_LEFT, '{', 0xffff, 0xffff}, - /* 055 */ { MY_SCANCODE_F, 'f', 'F', 'F'-64, MY_SCANCODE_BRACKET_RIGHT, '}', 0xffff, 0xffff}, - /* 056 */ { MY_SCANCODE_C, 'c', 'C', 'C'-64, MY_SCANCODE_SLASH, '/', 0xffff, 0xffff}, - /* 057 */ { MY_SCANCODE_F7, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 058 */ { MY_SCANCODE_F8, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 059 */ { MY_SCANCODE_COMMA, ',', 0xffff, 0xffff, MY_SCANCODE_SEMICOLON, ';', 0xffff, 0xffff}, - /* 060 */ { MY_SCANCODE_PERIOD, '.', 0xffff, 0xffff, MY_SCANCODE_SLASH, '?', 0xffff, 0xffff}, - /* 061 */ { MY_SCANCODE_E, 'e', 'E', 'E'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 062 */ { MY_SCANCODE_S, 's', 'S', 'S'-64, MY_SCANCODE_BRACKET_RIGHT, ']', 0xffff, 0xffff}, - /* 063 */ { MY_SCANCODE_X, 'x', 'X', 'X'-64, MY_SCANCODE_MINUS, '-', 0xffff, 0xffff}, - /* 064 */ { MY_SCANCODE_MENU, 0xffff, 0xffff, 0xffff, MY_SCANCODE_MENU, 0xffff, 0xffff, 0xffff}, - /* 065 */ NOT_EXIST_KEY, - /* 066 */ NOT_EXIST_KEY, - /* 067 */ { MY_SCANCODE_MINUS, '_', 0xffff, 0xffff, MY_SCANCODE_COMMA, '<', 0xffff, 0xffff}, - /* 068 */ { MY_SCANCODE_APOSTROPHE, '\'', 0xffff, 0xffff, MY_SCANCODE_PERIOD, '>', 0xffff, 0xffff}, - /* 069 */ { MY_SCANCODE_Q, 'q', 'Q', 'Q'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 070 */ { MY_SCANCODE_W, 'w', 'W', 'W'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 071 */ { MY_SCANCODE_A, 'a', 'A', 'A'-64, MY_SCANCODE_BRACKET_LEFT, '[', 0xffff, 0xffff}, - /* 072 */ { MY_SCANCODE_Z, 'z', 'Z', 'Z'-64, MY_SCANCODE_EQUAL, '+', 0xffff, 0xffff}, - /* 073 */ { MY_SCANCODE_LEFTSHIFT, 0xffff, 0xffff, 0xffff, MY_SCANCODE_LEFTSHIFT, 0xffff, 0xffff, 0xffff}, - /* 074-Fn */{ MY_SCANCODE_FN, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 075 */ { MY_SCANCODE_LEFTCONTROL, 0xffff, 0xffff, 0xffff, MY_SCANCODE_LEFTCONTROL, 0xffff, 0xffff, 0xffff}, - /* 076 */ { MY_SCANCODE_LEFTALT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_LEFTALT, 0xffff, 0xffff, 0xffff}, - /* 077 */ { MY_SCANCODE_ESCAPE, 0x1b , 0x1b , 0xffff , MY_SCANCODE_ESCAPE, 0x1b, 0x1b, 0xffff}, - /* 078 */ { MY_SCANCODE_TAB, 9, 9, 0xffff, MY_SCANCODE_TAB, 0xffff, 0xffff, 0xffff}, - /* 079 */ NOT_EXIST_KEY, - /* 080 */ NOT_EXIST_KEY, - /* 081 */ NOT_EXIST_KEY, - /* 082 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, - /* 083 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 000 */ NOT_EXIST_KEY, + /* 001 */ { MY_SCANCODE_1, '1', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 002 */ { MY_SCANCODE_4, '4', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 003 */ { MY_SCANCODE_7, '7', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 004 */ { MY_SCANCODE_NOTEXIST, '*', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 005 */ { MY_SCANCODE_P, 'p', 'P', 'P'-64, MY_SCANCODE_7, '&', 0xffff, 0xffff}, + /* 006 */ { MY_SCANCODE_BACKSPACE, 8, 8, 0xffff, MY_SCANCODE_BACKSPACE, 0xffff, 0xffff, 0xffff}, + /* 007 */ { MY_SCANCODE_ENTER, 13, 13, 0xffff, MY_SCANCODE_ENTER, 13, 13, 0xffff}, + /* 008 */ { MY_SCANCODE_CURSORBLOCKRIGHT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_END, 0xffff, 0xffff, 0xffff}, + /* 009 */ { MY_SCANCODE_2, '2', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 010 */ { MY_SCANCODE_5, '5', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 011 */ { MY_SCANCODE_8, '8', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 012 */ { MY_SCANCODE_0, '0', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 013 */ { MY_SCANCODE_O, 'o', 'O', 'O'-64, MY_SCANCODE_5, '%', 0xffff, 0xffff}, + /* 014 */ { MY_SCANCODE_L, 'l', 'L', 'L'-64, MY_SCANCODE_0, ')', 0xffff, 0xffff}, + /* 015 */ { MY_SCANCODE_CURSORBLOCKUP, 0xffff , 0xffff , 0xffff , MY_SCANCODE_PAGEUP, 0xffff, 0xffff, 0xffff}, + /* 016 */ { MY_SCANCODE_CURSORBLOCKDOWN, 0xffff , 0xffff , 0xffff , MY_SCANCODE_PAGEDOWN, 0xffff, 0xffff, 0xffff}, + /* 017 */ { MY_SCANCODE_3, '3', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 018 */ { MY_SCANCODE_6, '6', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 019 */ { MY_SCANCODE_9, '9', 0xffff, 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 020 */ { MY_SCANCODE_NOTEXIST, '#', 0xffff, 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 021 */ { MY_SCANCODE_I, 'i', 'I', 'I'-64, MY_SCANCODE_4, '$', 0xffff, 0xffff}, + /* 022 */ { MY_SCANCODE_K, 'k', 'K', 'K'-64, MY_SCANCODE_9, '(', 0xffff, 0xffff}, + /* 023 */ { MY_SCANCODE_M, 'm', 'M', 'M'-64, MY_SCANCODE_SEMICOLON, ':', 0xffff, 0xffff}, + /* 024 */ { MY_SCANCODE_CURSORBLOCKLEFT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_HOME, 0xffff, 0xffff, 0xffff}, + /* 025 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 026 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 027 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 028 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 029 */ { MY_SCANCODE_U, 'u', 'U', 'U'-64, MY_SCANCODE_2, '@', 0xffff, 0xffff}, + /* 030 */ { MY_SCANCODE_J, 'j', 'J', 'J'-64, MY_SCANCODE_GRAVE, '`', 0xffff, 0xffff}, + /* 031 */ { MY_SCANCODE_N, 'n', 'N', 'N'-64, MY_SCANCODE_BACKSLASH, '\\', 0xffff, 0xffff}, + /* 032 */ { MY_SCANCODE_REMOVE, 0xffff , 0xffff , 0xffff , MY_SCANCODE_REMOVE, 0xffff, 0xffff, 0xffff}, + /* 033 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 034 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 035 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 036 */ { MY_SCANCODE_F9, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 037 */ { MY_SCANCODE_Y, 'y', 'Y', 'Y'-64, MY_SCANCODE_1, '!', 0xffff, 0xffff}, + /* 038 */ { MY_SCANCODE_H, 'h', 'H', 'H'-64, MY_SCANCODE_6, '^', 0xffff, 0xffff}, + /* 039 */ { MY_SCANCODE_B, 'b', 'B', 'B'-64, MY_SCANCODE_BACKSLASH, '|', 0xffff, 0xffff}, + /* 040 */ { MY_SCANCODE_INSERT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_APOSTROPHE, '"', 0xffff, 0xffff}, + /* 041 */ { MY_SCANCODE_F1, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 042 */ { MY_SCANCODE_F3, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 043 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 044 */ { MY_SCANCODE_F10, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 045 */ { MY_SCANCODE_T, 't', 'T', 'T'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 046 */ { MY_SCANCODE_G, 'g', 'G', 'G'-64, MY_SCANCODE_GRAVE, '~', 0xffff, 0xffff}, + /* 047 */ { MY_SCANCODE_V, 'v', 'V', 'V'-64, MY_SCANCODE_EQUAL, '=', 0xffff, 0xffff}, + /* 048 */ { MY_SCANCODE_SPACE, ' ', ' ', 0xffff, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 049 */ { MY_SCANCODE_F2, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 050 */ { MY_SCANCODE_F4, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 051 */ { MY_SCANCODE_F6, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 052 */ { MY_SCANCODE_F11, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 053 */ { MY_SCANCODE_R, 'r', 'R', 'R'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 054 */ { MY_SCANCODE_D, 'd', 'D', 'D'-64, MY_SCANCODE_BRACKET_LEFT, '{', 0xffff, 0xffff}, + /* 055 */ { MY_SCANCODE_F, 'f', 'F', 'F'-64, MY_SCANCODE_BRACKET_RIGHT, '}', 0xffff, 0xffff}, + /* 056 */ { MY_SCANCODE_C, 'c', 'C', 'C'-64, MY_SCANCODE_SLASH, '/', 0xffff, 0xffff}, + /* 057 */ { MY_SCANCODE_F7, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 058 */ { MY_SCANCODE_F8, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 059 */ { MY_SCANCODE_COMMA, ',', 0xffff, 0xffff, MY_SCANCODE_SEMICOLON, ';', 0xffff, 0xffff}, + /* 060 */ { MY_SCANCODE_PERIOD, '.', 0xffff, 0xffff, MY_SCANCODE_SLASH, '?', 0xffff, 0xffff}, + /* 061 */ { MY_SCANCODE_E, 'e', 'E', 'E'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 062 */ { MY_SCANCODE_S, 's', 'S', 'S'-64, MY_SCANCODE_BRACKET_RIGHT, ']', 0xffff, 0xffff}, + /* 063 */ { MY_SCANCODE_X, 'x', 'X', 'X'-64, MY_SCANCODE_MINUS, '-', 0xffff, 0xffff}, + /* 064 */ { MY_SCANCODE_MENU, 0xffff, 0xffff, 0xffff, MY_SCANCODE_MENU, 0xffff, 0xffff, 0xffff}, + /* 065 */ NOT_EXIST_KEY, + /* 066 */ NOT_EXIST_KEY, + /* 067 */ { MY_SCANCODE_MINUS, '_', 0xffff, 0xffff, MY_SCANCODE_COMMA, '<', 0xffff, 0xffff}, + /* 068 */ { MY_SCANCODE_APOSTROPHE, '\'', 0xffff, 0xffff, MY_SCANCODE_PERIOD, '>', 0xffff, 0xffff}, + /* 069 */ { MY_SCANCODE_Q, 'q', 'Q', 'Q'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 070 */ { MY_SCANCODE_W, 'w', 'W', 'W'-64, MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 071 */ { MY_SCANCODE_A, 'a', 'A', 'A'-64, MY_SCANCODE_BRACKET_LEFT, '[', 0xffff, 0xffff}, + /* 072 */ { MY_SCANCODE_Z, 'z', 'Z', 'Z'-64, MY_SCANCODE_EQUAL, '+', 0xffff, 0xffff}, + /* 073 */ { MY_SCANCODE_LEFTSHIFT, 0xffff, 0xffff, 0xffff, MY_SCANCODE_LEFTSHIFT, 0xffff, 0xffff, 0xffff}, + /* 074-Fn */{ MY_SCANCODE_FN, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 075 */ { MY_SCANCODE_LEFTCONTROL, 0xffff, 0xffff, 0xffff, MY_SCANCODE_LEFTCONTROL, 0xffff, 0xffff, 0xffff}, + /* 076 */ { MY_SCANCODE_LEFTALT, 0xffff , 0xffff , 0xffff , MY_SCANCODE_LEFTALT, 0xffff, 0xffff, 0xffff}, + /* 077 */ { MY_SCANCODE_ESCAPE, 0x1b , 0x1b , 0xffff , MY_SCANCODE_ESCAPE, 0x1b, 0x1b, 0xffff}, + /* 078 */ { MY_SCANCODE_TAB, 9, 9, 0xffff, MY_SCANCODE_TAB, 0xffff, 0xffff, 0xffff}, + /* 079 */ NOT_EXIST_KEY, + /* 080 */ NOT_EXIST_KEY, + /* 081 */ NOT_EXIST_KEY, + /* 082 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, + /* 083 */ { MY_SCANCODE_NOTEXIST, 0xffff , 0xffff , 0xffff , MY_SCANCODE_NOTEXIST, 0xffff, 0xffff, 0xffff}, }; static unsigned char state [MY_NR_KEYS]; @@ -198,308 +198,287 @@ static int thresh = 5; /* acceleration threshhold */ static int Mouse_Read (int *dx, int *dy, int *dz, int *bp) { - static unsigned char buf[5]; - static int buttons[4] = { 0, 4, 1, 5}; - static int nbytes; - int n; + static unsigned char buf[5]; + static int buttons[4] = { 0, 4, 1, 5}; + static int nbytes; + int n; - while ((n = read (mouse_fd, &buf [nbytes], 4 - nbytes))) { - if (n < 0) { - if (errno == EINTR) - continue; - else - return -1; - } + while ((n = read (mouse_fd, &buf [nbytes], 4 - nbytes))) { + if (n < 0) { + if (errno == EINTR) + continue; + else + return -1; + } - nbytes += n; + nbytes += n; - if (nbytes == 4) { - int wheel; + if (nbytes == 4) { + int wheel; - if ((buf[0] & 0xc0) != 0) { - buf[0] = buf[1]; - buf[1] = buf[2]; - buf[2] = buf[3]; - nbytes = 3; + if ((buf[0] & 0xc0) != 0) { + buf[0] = buf[1]; + buf[1] = buf[2]; + buf[2] = buf[3]; + nbytes = 3; - return -1; - } + return -1; + } - /* FORM XFree86 4.0.1 */ - *bp = buttons[(buf[0] & 0x03)]; - *dx = (buf[0] & 0x10) ? buf[1] - 256 : buf[1]; - *dy = (buf[0] & 0x20) ? -(buf[2] - 256) : -buf[2]; + /* FORM XFree86 4.0.1 */ + *bp = buttons[(buf[0] & 0x03)]; + *dx = (buf[0] & 0x10) ? buf[1] - 256 : buf[1]; + *dy = (buf[0] & 0x20) ? -(buf[2] - 256) : -buf[2]; - /* Is a wheel event? */ - if ((wheel = buf[3]) != 0) { - if(wheel > 0x7f) { - *bp = WHEEL_UP; - } - else { - *bp = WHEEL_DOWN; - } - } + /* Is a wheel event? */ + if ((wheel = buf[3]) != 0) { + if(wheel > 0x7f) { + *bp = WHEEL_UP; + } + else { + *bp = WHEEL_DOWN; + } + } - *dz = 0; - nbytes = 0; - return 1; - } - } - return 0; + *dz = 0; + nbytes = 0; + return 1; + } + } + return 0; } static int mouse_update(void) { - int dx,dy,dz; - int r; - int sign; + int dx,dy,dz; + int r; + int sign; - dx = dy = 0; - r = Mouse_Read(&dx, &dy, &dz, &buttons); - if (r <= 0) - return 0; + dx = dy = 0; + r = Mouse_Read(&dx, &dy, &dz, &buttons); + if (r <= 0) + return 0; - sign = 1; - if (dx < 0) { - sign = -1; - dx = -dx; - } - if (dx > thresh) - dx = thresh + (dx - thresh) * scale; - dx *= sign; - xpos += dx; - if( xpos < minx ) - xpos = minx; - if( xpos > maxx ) - xpos = maxx; + sign = 1; + if (dx < 0) { + sign = -1; + dx = -dx; + } + if (dx > thresh) + dx = thresh + (dx - thresh) * scale; + dx *= sign; + xpos += dx; + if( xpos < minx ) + xpos = minx; + if( xpos > maxx ) + xpos = maxx; - sign = 1; - if (dy < 0) { - sign = -1; - dy = -dy; - } - if (dy > thresh) - dy = thresh + (dy - thresh) * scale; - dy *= sign; - ypos += dy; - if ( ypos < miny ) - ypos = miny; - if ( ypos > maxy ) - ypos = maxy; + sign = 1; + if (dy < 0) { + sign = -1; + dy = -dy; + } + if (dy > thresh) + dy = thresh + (dy - thresh) * scale; + dy *= sign; + ypos += dy; + if ( ypos < miny ) + ypos = miny; + if ( ypos > maxy ) + ypos = maxy; - return 1; + return 1; } static void mouse_getxy (int* x, int* y) { - *x = xpos; - *y = ypos; + *x = xpos; + *y = ypos; } static void mouse_setposition (int newx, int newy) { - if (newx < minx) - newx = minx; - if (newx > maxx) - newx = maxx; - if (newy < miny) - newy = miny; - if (newy > maxy) - newy = maxy; - if (newx == xpos && newy == ypos) - return; - xpos = newx; - ypos = newy; + if (newx < minx) + newx = minx; + if (newx > maxx) + newx = maxx; + if (newy < miny) + newy = miny; + if (newy > maxy) + newy = maxy; + if (newx == xpos && newy == ypos) + return; + xpos = newx; + ypos = newy; } static int mouse_getbutton (void) { - return buttons; + return buttons; } static void mouse_setrange (int newminx, int newminy, int newmaxx, int newmaxy) { - minx = newminx; - miny = newminy; - maxx = newmaxx; - maxy = newmaxy; - mouse_setposition ((newminx + newmaxx) / 2, (newminy + newmaxy) / 2); + minx = newminx; + miny = newminy; + maxx = newmaxx; + maxy = newmaxy; + mouse_setposition ((newminx + newmaxx) / 2, (newminy + newmaxy) / 2); } static void mouse_suspend(void) { - if (mouse_fd > 0) - close (mouse_fd); + if (mouse_fd > 0) + close (mouse_fd); - mouse_fd = -1; + mouse_fd = -1; } static int mouse_resume(void) { - mouse_fd = open (IAL_MDev, O_RDWR | O_NONBLOCK); - if (mouse_fd < 0) { - mouse_fd = open (IAL_MDev, O_RDONLY | O_NONBLOCK); - if (mouse_fd < 0) - return -1; - } - else { - write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)); - } + mouse_fd = open (IAL_MDev, O_RDWR | O_NONBLOCK); + if (mouse_fd < 0) { + mouse_fd = open (IAL_MDev, O_RDONLY | O_NONBLOCK); + if (mouse_fd < 0) + return -1; + } + else { + write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)); + } - return mouse_fd; + return mouse_fd; } static int keyboard_update(void) { - return MY_NR_KEYS; + return MY_NR_KEYS; } static int read_key (void) { - Myinputevent event; - if (read(btn_fd, &event, sizeof(Myinputevent)) != sizeof(Myinputevent)) - { + Myinputevent event; + if (read(btn_fd, &event, sizeof(Myinputevent)) != sizeof(Myinputevent)) + { return 0; - } - if (event.code == 0) - { - return 0; - } + } + if (event.code == 0) + { + return 0; + } - int bIsPress = event.value != 0; - if ( event.code < sizeof(yealinkKeyM) / sizeof(yealinkKeyMap)) - { - const yealinkKeyMap currentKey = yealinkKeyM[event.code]; - if(currentKey.key_code == MY_SCANCODE_FN) // key_fn - { - fn = bIsPress; - state[MY_SCANCODE_FN] = bIsPress; - } - int keyCode = fn ? currentKey.fn_key_code : currentKey.key_code; - if(keyCode == MY_SCANCODE_NOTEXIST) - { - return 0; - } - state[keyCode] = bIsPress; - } - return 1; + int bIsPress = event.value != 0; + if ( event.code < sizeof(yealinkKeyM) / sizeof(yealinkKeyMap)) + { + const yealinkKeyMap currentKey = yealinkKeyM[event.code]; + if(currentKey.key_code == MY_SCANCODE_FN) // key_fn + { + fn = bIsPress; + state[MY_SCANCODE_FN] = bIsPress; + } + int keyCode = fn ? currentKey.fn_key_code : currentKey.key_code; + if(keyCode == MY_SCANCODE_NOTEXIST) + { + return 0; + } + state[keyCode] = bIsPress; + } + return 1; } static const char * keyboard_get_state (void) { - return (char *)state; + return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { - fd_set rfds; - int e; + fd_set rfds; + int retvalue = 0; + int fd, e; if (!in) { in = &rfds; FD_ZERO (in); } - e = select (maxfd + 1, in, out, except, timeout) ; + if (which & IAL_MOUSEEVENT && mouse_fd >= 0) { + fd = mouse_fd; + FD_SET (fd, in); + } - if (e < 0) { - return -1; - } - return 0; + if ((which & IAL_KEYEVENT) && btn_fd >= 0){ + fd = btn_fd; + FD_SET (btn_fd, in); + } + + e = select (FD_SETSIZE, in, out, except, timeout) ; + + if (e > 0) { + fd = mouse_fd; + /* If data is present on the mouse fd, service it: */ + if (fd >= 0 && FD_ISSET (fd, in)) { + FD_CLR (fd, in); + retvalue |= IAL_MOUSEEVENT; + } + + fd = btn_fd; + if (fd >= 0 && FD_ISSET(fd, in)) { + FD_CLR(fd, in); + if (read_key()) + { + retvalue |= IAL_KEYEVENT; + } + else + { + return -1; + } + } + + } else if (e < 0) { + return -1; + } + + return retvalue; } -#else -static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, - struct timeval *timeout) -{ - fd_set rfds; - int retvalue = 0; - int fd, e; - - if (!in) { - in = &rfds; - FD_ZERO (in); - } - - if (which & IAL_MOUSEEVENT && mouse_fd >= 0) { - fd = mouse_fd; - FD_SET (fd, in); - } - - if ((which & IAL_KEYEVENT) && btn_fd >= 0){ - fd = btn_fd; - FD_SET (btn_fd, in); - } - - e = select (FD_SETSIZE, in, out, except, timeout) ; - - if (e > 0) { - fd = mouse_fd; - /* If data is present on the mouse fd, service it: */ - if (fd >= 0 && FD_ISSET (fd, in)) { - FD_CLR (fd, in); - retvalue |= IAL_MOUSEEVENT; - } - - fd = btn_fd; - if (fd >= 0 && FD_ISSET(fd, in)) { - FD_CLR(fd, in); - if (read_key()) - { - retvalue |= IAL_KEYEVENT; - } - else - { - return -1; - } - } - - } else if (e < 0) { - return -1; - } - - return retvalue; -} -#endif BOOL InitVP2008Input (INPUT* input, const char* mdev, const char* mtype) { - mouse_fd = open (mdev, O_RDWR | O_NONBLOCK); - if (mouse_fd < 0) { - mouse_fd = open (mdev, O_RDONLY | O_NONBLOCK); - if (mouse_fd < 0){ - fprintf (stderr, "VP2008: Can not open mouse!\n"); - return FALSE; - } - } - else { - write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)); - } + mouse_fd = open (mdev, O_RDWR | O_NONBLOCK); + if (mouse_fd < 0) { + mouse_fd = open (mdev, O_RDONLY | O_NONBLOCK); + if (mouse_fd < 0){ + fprintf (stderr, "VP2008: Can not open mouse!\n"); + return FALSE; + } + } + else { + write (mouse_fd, IMPS2_Param, sizeof (IMPS2_Param)); + } - btn_fd = open ("/dev/input/event0", O_RDONLY); - if (btn_fd < 0 ) { - fprintf (stderr, "VP2008: Can not open button key!\n"); - return FALSE; - } + btn_fd = open ("/dev/input/event0", O_RDONLY); + if (btn_fd < 0 ) { + fprintf (stderr, "VP2008: Can not open button key!\n"); + return FALSE; + } - xpos = 0; - ypos = 0; - buttons = 0; - minx = 0; - miny = 0; - maxx = WIDTHOFPHYSCREEN; - maxy = HEIGHTOFPHYSCREEN; + xpos = 0; + ypos = 0; + buttons = 0; + minx = 0; + miny = 0; + maxx = WIDTHOFPHYSCREEN; + maxy = HEIGHTOFPHYSCREEN; - input->update_mouse = mouse_update; - input->get_mouse_xy = mouse_getxy; - input->set_mouse_xy = mouse_setposition; - input->get_mouse_button = mouse_getbutton; - input->set_mouse_range = mouse_setrange; - input->suspend_mouse= mouse_suspend; - input->resume_mouse = mouse_resume; + input->update_mouse = mouse_update; + input->get_mouse_xy = mouse_getxy; + input->set_mouse_xy = mouse_setposition; + input->get_mouse_button = mouse_getbutton; + input->set_mouse_range = mouse_setrange; + input->suspend_mouse= mouse_suspend; + input->resume_mouse = mouse_resume; input->update_keyboard = keyboard_update; input->get_keyboard_state = keyboard_get_state; @@ -512,11 +491,11 @@ BOOL InitVP2008Input (INPUT* input, const char* mdev, const char* mtype) void TermVP2008Input (void) { - if (mouse_fd >= 0) - close(mouse_fd); + if (mouse_fd >= 0) + close(mouse_fd); - if (btn_fd >= 0) - close(btn_fd); + if (btn_fd >= 0) + close(btn_fd); } #endif /* _VP2008_IAL */ diff --git a/src/ial/vr4181.c b/src/ial/vr4181.c index 80ac5a72..836cc25c 100644 --- a/src/ial/vr4181.c +++ b/src/ial/vr4181.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** vr4181.c: Low Level Input Engine for NEC VR4181 debug board. -** +** ** Author: Luo Gang (Red Flag Software). */ @@ -333,7 +333,7 @@ static int VrTpanelRead(int fd, int *px, int *py, int *pz, unsigned int *pb) * but it provides steadier pointer. * * If you adjust iir_shift_bits, you may also want to adjust the sample interval - * in VrTpanelInit. + * in VrTpanelInit. * * The filter gain is fixed at 8 times the input (gives room for increased resolution * potentially added by the noise-dithering). @@ -504,9 +504,9 @@ again: */ #ifdef REMOTE_TEST XYPOINT transformed = {iir_out_x, iir_out_y}; -#else +#else XYPOINT transformed = {iir_out_y, iir_out_x}; -#endif +#endif transformed = DeviceToScreen(transformed); /* @@ -567,10 +567,10 @@ static int keyboard_update(void) //keycode = Key_Right break; case 0x8: -//keycode = Key_Down +//keycode = Key_Down break; case 0xa: -//keycode = Key_Left +//keycode = Key_Left break; case 0x3: //keycode = Key_Up @@ -594,15 +594,15 @@ static int keyboard_update(void) //keycode = Key_AP1 break; case 257: -//keycode = Key_AP2 +//keycode = Key_AP2 break; case 258: -//keycode = Key_AP3 +//keycode = Key_AP3 break; case 259: -//keycode = Key_AP4 +//keycode = Key_AP4 break; - } + } return 0; } @@ -612,7 +612,6 @@ static const char* keyboard_getstate(void) return (char *)state; } -#ifdef _LITE_VERSION static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { @@ -639,10 +638,10 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex maxfd = btn_fd; } #endif - + e = select (maxfd + 1, in, out, except, timeout) ; - if (e > 0) { + if (e > 0) { if (ts >= 0 && FD_ISSET (ts, in)) { FD_CLR (ts, in); @@ -653,15 +652,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex mousey = y; mousez = b; -#if REMOTE_TEST +#if REMOTE_TEST fprintf(stderr,"result:\t\t%d\n",result); fprintf(stderr,"mousex\tmousey\tmousez:\t%d\t%d\t%d\n",mousex,mousey,mousez); -#endif +#endif mousez = ( mousez > 0 ? IAL_MOUSE_LEFTBUTTON:0); - retvalue |=IAL_MOUSEEVENT; + retvalue |=IAL_MOUSEEVENT; } } - + #ifdef _VR_BUTTONS if (btn_fd >= 0 && FD_ISSET(btn_fd, in)) { unsigned short code; @@ -670,15 +669,15 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex btn_state = code; retvalue |= IAL_KEYEVENT; } -#endif +#endif } else if (e < 0) { return -1; } return retvalue; } -#else +#if 0 static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, struct timeval *timeout) { @@ -686,7 +685,7 @@ static int wait_event (int which, fd_set *in, fd_set *out, fd_set *except, struct pollfd ufd; if (which & IAL_MOUSEEVENT) { ufd.fd = ts; - ufd.events = POLLIN; + ufd.events = POLLIN; if (poll (&ufd, 1, timeout) > 0) { result = VrTpanelRead(ts, &x, &y, &z, &b); if (result == 2 || result == 3) { diff --git a/src/ial/vxi386_input.c b/src/ial/vxi386_input.c index 3701bce8..dc8308c8 100644 --- a/src/ial/vxi386_input.c +++ b/src/ial/vxi386_input.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -66,27 +66,27 @@ static UGL_INPUT_SERVICE_ID inputServiceId; static UGL_DEVICE_ID devId; static UGL_MSG msg; -static UGL_GC_ID gc; +static UGL_GC_ID gc; static UGL_INPUT_DEV_ID pointerDevId; static UGL_INT32 pdType; -static UGL_CDDB_ID cursorDdb; +static UGL_CDDB_ID cursorDdb; int ascii_to_scancode(int asc2); int comm_ts_getdata (short *x, short *y, short *button) -{ - *x = msg.data.pointer.position.x; - *y = msg.data.pointer.position.y; +{ + *x = msg.data.pointer.position.x; + *y = msg.data.pointer.position.y; *x = *x<1024 ? *x : 1024; *y = *y<768 ? *y : 768; - - *button = (msg.data.pointer.buttonState) ; - #ifdef _DEBUG_CURSOR_ + *button = (msg.data.pointer.buttonState) ; + + #ifdef _DEBUG_CURSOR_ uglCursorMove(devId, - msg.data.pointer.position.x, - msg.data.pointer.position.y); + msg.data.pointer.position.x, + msg.data.pointer.position.y); #endif return 0; } @@ -94,26 +94,26 @@ int comm_kb_getdata (short *key, short *status) { *key = ascii_to_scancode (msg.data.keyboard.key); if (msg.data.keyboard.modifiers & UGL_KBD_KEYDOWN) - *status = 1; + *status = 1; else - *status = 0; - - return 0; + *status = 0; + + return 0; } int comm_wait_for_input (void) { UGL_STATUS status; __mg_os_time_delay(10); - + status = uglInputMsgGet (inputServiceId, &msg, UGL_NO_WAIT); - + if (status != UGL_STATUS_Q_EMPTY) { if (msg.type == MSG_KEYBOARD){ msg.type = 0; return VX_KBINPUT; }else if (msg.type == MSG_POINTER) { - msg.type = 0; + msg.type = 0; return VX_MOUSEINPUT; } } @@ -121,8 +121,8 @@ int comm_wait_for_input (void) } static int scancode_table[SCANCODE_USER]= -{ -0, //0 +{ +0, //0 0, 0, 0, @@ -130,12 +130,12 @@ static int scancode_table[SCANCODE_USER]= 0, 0, 0, -SCANCODE_BACKSPACE, //8 +SCANCODE_BACKSPACE, //8 SCANCODE_TAB, 0, 0, 0, -SCANCODE_ENTER, //13 +SCANCODE_ENTER, //13 0, 0, 0, @@ -149,7 +149,7 @@ SCANCODE_ENTER, //13 0, 0, 0, -SCANCODE_ESCAPE, //27 +SCANCODE_ESCAPE, //27 0, 0, 0, @@ -166,89 +166,89 @@ SCANCODE_9, /*sign (()*/ SCANCODE_0, /*sign ())*/ SCANCODE_8, /* sign(*) */ SCANCODE_EQUAL, /*sign (+)*/ -SCANCODE_COMMA, //44, -SCANCODE_MINUS, //45 +SCANCODE_COMMA, //44, +SCANCODE_MINUS, //45 SCANCODE_PERIOD, SCANCODE_SLASH, // / -SCANCODE_0, //48 -SCANCODE_1, //49 -SCANCODE_2, //50 -SCANCODE_3, //51 -SCANCODE_4, //52 -SCANCODE_5, //53 -SCANCODE_6, //54 -SCANCODE_7, //55 -SCANCODE_8, //56 -SCANCODE_9, //57 -SCANCODE_SEMICOLON, //58: -SCANCODE_SEMICOLON, //59; +SCANCODE_0, //48 +SCANCODE_1, //49 +SCANCODE_2, //50 +SCANCODE_3, //51 +SCANCODE_4, //52 +SCANCODE_5, //53 +SCANCODE_6, //54 +SCANCODE_7, //55 +SCANCODE_8, //56 +SCANCODE_9, //57 +SCANCODE_SEMICOLON, //58: +SCANCODE_SEMICOLON, //59; 0, -SCANCODE_EQUAL, //61 +SCANCODE_EQUAL, //61 0, 0, SCANCODE_2, /* @ */ -SCANCODE_A, //65 +SCANCODE_A, //65 SCANCODE_B, SCANCODE_C, SCANCODE_D, -SCANCODE_E, +SCANCODE_E, SCANCODE_F, SCANCODE_G, SCANCODE_H, -SCANCODE_I, +SCANCODE_I, SCANCODE_J, SCANCODE_K, SCANCODE_L, SCANCODE_M, SCANCODE_N, -SCANCODE_O, -SCANCODE_P, -SCANCODE_Q, -SCANCODE_R, +SCANCODE_O, +SCANCODE_P, +SCANCODE_Q, +SCANCODE_R, SCANCODE_S, -SCANCODE_T, -SCANCODE_U, +SCANCODE_T, +SCANCODE_U, SCANCODE_V, -SCANCODE_W, +SCANCODE_W, SCANCODE_X, -SCANCODE_Y, -SCANCODE_Z, //90 +SCANCODE_Y, +SCANCODE_Z, //90 SCANCODE_BRACKET_LEFT, /* [ */ SCANCODE_BACKSLASH, /* \ */ SCANCODE_BRACKET_RIGHT, /* ] */ SCANCODE_6, -SCANCODE_MINUS, /* _ (95)*/ +SCANCODE_MINUS, /* _ (95)*/ 0, -SCANCODE_A, //97 +SCANCODE_A, //97 SCANCODE_B, SCANCODE_C, SCANCODE_D, -SCANCODE_E, +SCANCODE_E, SCANCODE_F, SCANCODE_G, SCANCODE_H, -SCANCODE_I, +SCANCODE_I, SCANCODE_J, SCANCODE_K, SCANCODE_L, SCANCODE_M, SCANCODE_N, -SCANCODE_O, -SCANCODE_P, -SCANCODE_Q, -SCANCODE_R, +SCANCODE_O, +SCANCODE_P, +SCANCODE_Q, +SCANCODE_R, SCANCODE_S, -SCANCODE_T, -SCANCODE_U, +SCANCODE_T, +SCANCODE_U, SCANCODE_V, -SCANCODE_W, +SCANCODE_W, SCANCODE_X, -SCANCODE_Y, -SCANCODE_Z , //122 +SCANCODE_Y, +SCANCODE_Z , //122 }; //0xE000 -static int scancode_private1_table[22] = +static int scancode_private1_table[22] = { SCANCODE_HOME, SCANCODE_END, @@ -276,18 +276,18 @@ SCANCODE_RIGHTALT, }; //0xEf00 -static int scancode_private2_table[13] = +static int scancode_private2_table[13] = { 0,//0 -SCANCODE_F1, -SCANCODE_F2, -SCANCODE_F3, -SCANCODE_F4, -SCANCODE_F5, -SCANCODE_F6, -SCANCODE_F7, -SCANCODE_F8, -SCANCODE_F9, +SCANCODE_F1, +SCANCODE_F2, +SCANCODE_F3, +SCANCODE_F4, +SCANCODE_F5, +SCANCODE_F6, +SCANCODE_F7, +SCANCODE_F8, +SCANCODE_F9, SCANCODE_F10, SCANCODE_F11, SCANCODE_F12, @@ -296,17 +296,17 @@ SCANCODE_F12, int ascii_to_scancode (int asc2) { unsigned int ret, index=0; - + ret = (asc2) & 0xef00; index = asc2 & 0x00ff; - + if (ret==0) { - return scancode_table[index]; + return scancode_table[index]; } else if (ret == 0xe000) { return scancode_private1_table [index]; } else if (ret == 0xef00) { return scancode_private2_table[index]; - } + } return 0; } diff --git a/src/ial/vxppc_input.c b/src/ial/vxppc_input.c index 0400a90f..a5850b4b 100644 --- a/src/ial/vxppc_input.c +++ b/src/ial/vxppc_input.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -70,16 +70,16 @@ static UGL_EVENT event; int ascii_to_scancode(int asc2); int comm_ts_getdata (short *x, short *y, short *button) -{ +{ int tmp; - *x = pInputEvent->x; - *y = pInputEvent->y; + *x = pInputEvent->x; + *y = pInputEvent->y; *x<1024 ? *x : 1024 ; *y<768 ? *y : 768 ; - - *button = (pInputEvent->type.pointer.buttonState) ; + + *button = (pInputEvent->type.pointer.buttonState) ; return 0; } @@ -87,19 +87,19 @@ int comm_kb_getdata (short *key, short *status) { *key = ascii_to_scancode (pInputEvent->type.keyboard.key); if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN) - *status = 1; + *status = 1; else - *status = 0; - - return 0; + *status = 0; + + return 0; } int comm_wait_for_input (void) { UGL_STATUS status; __mg_os_time_delay(10); - + status = uglInputEventGet (eventServiceId, UGL_NO_WAIT, (UGL_EVENT *)pInputEvent, sizeof (UGL_EVENT)); - + if (status == UGL_STATUS_OK) { if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD){ @@ -114,8 +114,8 @@ int comm_wait_for_input (void) } static int scancode_table[SCANCODE_USER]= -{ -0, //0 +{ +0, //0 0, 0, 0, @@ -123,12 +123,12 @@ static int scancode_table[SCANCODE_USER]= 0, 0, 0, -SCANCODE_BACKSPACE, //8 +SCANCODE_BACKSPACE, //8 SCANCODE_TAB, 0, 0, 0, -SCANCODE_ENTER, //13 +SCANCODE_ENTER, //13 0, 0, 0, @@ -142,7 +142,7 @@ SCANCODE_ENTER, //13 0, 0, 0, -SCANCODE_ESCAPE, //27 +SCANCODE_ESCAPE, //27 0, 0, 0, @@ -159,89 +159,89 @@ SCANCODE_9, /*sign (()*/ SCANCODE_0, /*sign ())*/ SCANCODE_8, /* sign(*) */ SCANCODE_EQUAL, /*sign (+)*/ -SCANCODE_COMMA, //44, -SCANCODE_MINUS, //45 +SCANCODE_COMMA, //44, +SCANCODE_MINUS, //45 SCANCODE_PERIOD, SCANCODE_SLASH, // / -SCANCODE_0, //48 -SCANCODE_1, //49 -SCANCODE_2, //50 -SCANCODE_3, //51 -SCANCODE_4, //52 -SCANCODE_5, //53 -SCANCODE_6, //54 -SCANCODE_7, //55 -SCANCODE_8, //56 -SCANCODE_9, //57 -SCANCODE_SEMICOLON, //58: -SCANCODE_SEMICOLON, //59; +SCANCODE_0, //48 +SCANCODE_1, //49 +SCANCODE_2, //50 +SCANCODE_3, //51 +SCANCODE_4, //52 +SCANCODE_5, //53 +SCANCODE_6, //54 +SCANCODE_7, //55 +SCANCODE_8, //56 +SCANCODE_9, //57 +SCANCODE_SEMICOLON, //58: +SCANCODE_SEMICOLON, //59; 0, -SCANCODE_EQUAL, //61 +SCANCODE_EQUAL, //61 0, 0, SCANCODE_2, /* @ */ -SCANCODE_A, //65 +SCANCODE_A, //65 SCANCODE_B, SCANCODE_C, SCANCODE_D, -SCANCODE_E, +SCANCODE_E, SCANCODE_F, SCANCODE_G, SCANCODE_H, -SCANCODE_I, +SCANCODE_I, SCANCODE_J, SCANCODE_K, SCANCODE_L, SCANCODE_M, SCANCODE_N, -SCANCODE_O, -SCANCODE_P, -SCANCODE_Q, -SCANCODE_R, +SCANCODE_O, +SCANCODE_P, +SCANCODE_Q, +SCANCODE_R, SCANCODE_S, -SCANCODE_T, -SCANCODE_U, +SCANCODE_T, +SCANCODE_U, SCANCODE_V, -SCANCODE_W, +SCANCODE_W, SCANCODE_X, -SCANCODE_Y, -SCANCODE_Z, //90 +SCANCODE_Y, +SCANCODE_Z, //90 SCANCODE_BRACKET_LEFT, /* [ */ SCANCODE_BACKSLASH, /* \ */ SCANCODE_BRACKET_RIGHT, /* ] */ SCANCODE_6, -SCANCODE_MINUS, /* _ (95)*/ +SCANCODE_MINUS, /* _ (95)*/ 0, -SCANCODE_A, //97 +SCANCODE_A, //97 SCANCODE_B, SCANCODE_C, SCANCODE_D, -SCANCODE_E, +SCANCODE_E, SCANCODE_F, SCANCODE_G, SCANCODE_H, -SCANCODE_I, +SCANCODE_I, SCANCODE_J, SCANCODE_K, SCANCODE_L, SCANCODE_M, SCANCODE_N, -SCANCODE_O, -SCANCODE_P, -SCANCODE_Q, -SCANCODE_R, +SCANCODE_O, +SCANCODE_P, +SCANCODE_Q, +SCANCODE_R, SCANCODE_S, -SCANCODE_T, -SCANCODE_U, +SCANCODE_T, +SCANCODE_U, SCANCODE_V, -SCANCODE_W, +SCANCODE_W, SCANCODE_X, -SCANCODE_Y, -SCANCODE_Z , //122 +SCANCODE_Y, +SCANCODE_Z , //122 }; //0xE000 -static int scancode_private1_table[22] = +static int scancode_private1_table[22] = { SCANCODE_HOME, SCANCODE_END, @@ -269,18 +269,18 @@ SCANCODE_RIGHTALT, }; //0xEf00 -static int scancode_private2_table[13] = +static int scancode_private2_table[13] = { 0,//0 -SCANCODE_F1, -SCANCODE_F2, -SCANCODE_F3, -SCANCODE_F4, -SCANCODE_F5, -SCANCODE_F6, -SCANCODE_F7, -SCANCODE_F8, -SCANCODE_F9, +SCANCODE_F1, +SCANCODE_F2, +SCANCODE_F3, +SCANCODE_F4, +SCANCODE_F5, +SCANCODE_F6, +SCANCODE_F7, +SCANCODE_F8, +SCANCODE_F9, SCANCODE_F10, SCANCODE_F11, SCANCODE_F12, @@ -289,17 +289,17 @@ SCANCODE_F12, int ascii_to_scancode (int asc2) { unsigned int ret, index=0; - + ret = (asc2) & 0xef00; index = asc2 & 0x00ff; - + if (ret==0) { - return scancode_table[index]; + return scancode_table[index]; } else if (ret == 0xe000) { return scancode_private1_table [index]; } else if (ret == 0xef00) { return scancode_private2_table[index]; - } + } return 0; } diff --git a/src/ial/winial.c b/src/ial/winial.c index 73c18941..b76278b8 100644 --- a/src/ial/winial.c +++ b/src/ial/winial.c @@ -11,35 +11,35 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ @@ -68,21 +68,21 @@ static int IsPipeClose=0; static int pipeClean (void); static void notify_wvfb (void); -void ErrorExit(LPTSTR lpszFunction) +void ErrorExit(LPTSTR lpszFunction) { - TCHAR szBuf[80]; + TCHAR szBuf[80]; LPVOID lpMsgBuf; - DWORD dw = GetLastError(); + DWORD dw = GetLastError(); FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); - + fprintf (stderr, "%s", szBuf); LocalFree(lpMsgBuf); @@ -93,18 +93,18 @@ int win_IALInit (void) char pipe_str[50]; notify_wvfb (); - _sleep (500); + _sleep (500); sprintf(pipe_str, "\\\\.\\pipe\\wvfbEventPipe"); - hEventPipe = CreateFile (pipe_str, GENERIC_READ, 0, NULL, + hEventPipe = CreateFile (pipe_str, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hEventPipe == INVALID_HANDLE_VALUE) { ErrorExit ("wvfb ial"); printf ("waiting for wvfb ..........................\n"); - if (!WaitNamedPipe(pipe_str, 10000)) + if (!WaitNamedPipe(pipe_str, 10000)) { - printf("Could not open wvfb pipe\n"); + printf("Could not open wvfb pipe\n"); return -1; } } @@ -132,15 +132,15 @@ void win_IALClose (void) CloseHandle (hEventPipe); notify_wvfb (); printf ("win_IALClose :windows wvfb ial is closed\n"); - IsPipeClose = 1; + IsPipeClose = 1; } static int pipeClean (void) { - if (!IsPipeClose) { + if (!IsPipeClose) { CloseHandle (hEventPipe); notify_wvfb (); - } + } return 0; } @@ -159,41 +159,41 @@ int win_GetEventData (void* data, size_t len) int win_fd_set (int fd, void *set) { - FD_SET(fd, (fd_set *)set); + FD_SET(fd, (fd_set *)set); } int win_fd_clr (int fd, void *set) { - FD_CLR(fd, (fd_set *)set); + FD_CLR(fd, (fd_set *)set); } int win_fd_isset (int fd, void *set) { - FD_ISSET(fd, (fd_set *)set); + FD_ISSET(fd, (fd_set *)set); } int win_fd_zero (void *set) { - FD_ZERO((fd_set *)set); + FD_ZERO((fd_set *)set); } int win_select(int nfds, void *readfds, void *writefds, void *exceptfds, const struct timeval *timeout) { - return select (nfds, (fd_set *)readfds, (fd_set *)writefds, (fd_set *)exceptfds, timeout); + return select (nfds, (fd_set *)readfds, (fd_set *)writefds, (fd_set *)exceptfds, timeout); } int win_readsock(int s, char *buf, int len, int flags) { - return recv( (SOCKET) s, buf, len, flags); + return recv( (SOCKET) s, buf, len, flags); } int win_writesock(int s, const char* buff, int len, int flags){ - return send( (SOCKET)s, buff, len, flags); + return send( (SOCKET)s, buff, len, flags); } void win_closesock(int s) { - closesocket((SOCKET)s); + closesocket((SOCKET)s); } #endif /* WIN32 */ diff --git a/src/ial/wvfbial.c b/src/ial/wvfbial.c index c6ba19b5..6348bf99 100644 --- a/src/ial/wvfbial.c +++ b/src/ial/wvfbial.c @@ -11,41 +11,41 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * This file is part of MiniGUI, a mature cross-platform windowing * and Graphics User Interface (GUI) support system for embedded systems * and smart IoT devices. - * + * * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 1998~2002, WEI Yongming - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * + * * Or, - * + * * As this program is a library, any link to this program must follow * GNU General Public License version 3 (GPLv3). If you cannot accept * GPLv3, you need to be licensed from FMSoft. - * + * * If you have got a commercial license of this program, please use it * under the terms and conditions of the commercial license. - * + * * For more information about the commercial license, please refer to * . */ /* ** wvfb.c: Input Engine for Windows Virtual FrameBuffer -** +** ** Created by snig, 2004/6/22 */ @@ -141,8 +141,8 @@ static int keyboard_update (void) static unsigned char last = 0; #if 0 - printf ("key info: (0x%x(0x%x), %x, %s, %s)\n", kbd_data.keycode, - HIWORD(kbd_data.keycode) & 0x00FF, kbd_data.keystate, + printf ("key info: (0x%x(0x%x), %x, %s, %s)\n", kbd_data.keycode, + HIWORD(kbd_data.keycode) & 0x00FF, kbd_data.keystate, kbd_data.press?"Pressed":"Released", kbd_data.repeat?"repeat":"no repete"); #endif