Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting touchpanel module ready for real devices #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/machine/qemuarm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ set(MODULE_KEYS_WEBOS_LINUX YES)
set(MODULE_TOUCHPANEL_WEBOS_LINUX YES)

add_definitions(-DKEYPAD_INPUT_DEVICE=\"/dev/input/event0\")

add_definitions(-DSCREEN_HORIZONTAL_RES=1024)
add_definitions(-DSCREEN_VERTICAL_RES=768)
2 changes: 2 additions & 0 deletions src/machine/qemux86.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ set(MODULE_KEYS_WEBOS_LINUX YES)
set(MODULE_TOUCHPANEL_WEBOS_LINUX YES)

add_definitions(-DKEYPAD_INPUT_DEVICE=\"/dev/input/event1\")
add_definitions(-DSCREEN_HORIZONTAL_RES=1024)
add_definitions(-DSCREEN_VERTICAL_RES=768)
5 changes: 3 additions & 2 deletions src/rockhopper/touchpanel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
# LICENSE@@@

if(${WEBOS_TARGET_MACHINE_IMPL} STREQUAL emulator)
nyx_create_module(TouchpanelMain emulator/touchpanel_common.c emulator/touchpanel_gestures.c emulator/touchpanel.c)

if(${WEBOS_TARGET_MACHINE_IMPL} STREQUAL emulator OR ${WEBOS_TARGET_MACHINE_IMPL} STREQUAL device)
nyx_create_module(TouchpanelMain evdev/touchpanel_common.c evdev/touchpanel_gestures.c evdev/touchpanel.c)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,16 @@ static general_settings_t sGeneralSettings =

static float scaleX, scaleY;

/* Using hardcoded values for now ,since ioctl FBIOGET_VSCREENINFO
on /dev/fb0 is returning invalid values in qemux86 */

#define SCREEN_HORIZONTAL_RES 1024
#define SCREEN_VERTICAL_RES 768

static int
init_touchpanel(void)
{
struct input_absinfo abs;
int maxX, maxY, ret = -1;
#if !defined(SCREEN_HORIZONTAL_RES) && !defined(SCREEN_VERTICAL_RES)
struct fb_var_screeninfo scr_info;
int16_t fd;
#endif


touchpanel_event_fd = open("/dev/input/touchscreen0", O_RDWR);
if(touchpanel_event_fd < 0) {
Expand All @@ -200,8 +199,27 @@ init_touchpanel(void)

init_gesture_state_machine(&sGeneralSettings, 1);

#if !defined(SCREEN_HORIZONTAL_RES) && !defined(SCREEN_VERTICAL_RES)
fd = open("/dev/fb0", O_RDWR);
if (fd < 0) {
return NYX_ERROR_INVALID_FILE_ACCESS;
}

memset(&scr_info,0,sizeof(struct fb_var_screeninfo));

if (ioctl(fd, FBIOGET_VSCREENINFO, &scr_info) != 0) {
ret = NYX_ERROR_INVALID_OPERATION;
goto error;
}

close(fd);

scaleX = (float)scr_info.xres / (float)maxX;
scaleY = (float)scr_info.yres / (float)maxY;
#else
scaleX = (float)SCREEN_HORIZONTAL_RES / (float)maxX;
scaleY = (float)SCREEN_VERTICAL_RES / (float)maxY;
#endif

return 0;
error:
Expand Down