From: jinhyung.jo Date: Wed, 14 Oct 2015 06:56:34 +0000 (+0900) Subject: tablet: Applying the screen size in the driver probing. X-Git-Tag: TizenStudio_2.0_p2.3.2~2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e587f9a0cc20335ca3a38ffea4519b9aa5e111e;p=sdk%2Femulator%2Femulator-kernel.git tablet: Applying the screen size in the driver probing. The screen size is required when the initializing driver, in order to apply the correct absolute coordinates of the mouse. Conflicts: drivers/maru/maru_virtio_tablet.c Change-Id: Iaf385d1c482614595de4d82b7d5b434648b67d5d Signed-off-by: Jinhyung Jo (cherry picked from commit 91bac12b09a68f975a7a7800d9902918886e0751) --- diff --git a/drivers/maru/maru_virtio_tablet.c b/drivers/maru/maru_virtio_tablet.c index 225db2408998..ef22ebccb64c 100644 --- a/drivers/maru/maru_virtio_tablet.c +++ b/drivers/maru/maru_virtio_tablet.c @@ -46,6 +46,9 @@ MODULE_DESCRIPTION("Emulator Virtio Tablet driver"); #define DEVICE_NAME "virtio-tablet" #define MAX_BUF_COUNT 25 +#define DEFAULT_WIDTH 1920 +#define DEFAULT_HEIGHT 1080 +#define CMDLINE_VIDEO_PARAM "video=LVDS-1:" /* This structure must match the qemu definitions */ typedef struct EmulTabletEvent { @@ -158,6 +161,9 @@ static void vq_tablet_callback(struct virtqueue *vq) static int virtio_tablet_probe(struct virtio_device *vdev) { int ret = 0; + char *cmdline = NULL; + int width = 0; + int height = 0; printk(KERN_INFO "virtio tablet driver is probed\n"); @@ -207,9 +213,48 @@ static int virtio_tablet_probe(struct virtio_device *vdev) | BIT_MASK(EV_ABS) | BIT_MASK(EV_MSC); - /* 32767 is max size of usbdevice tablet. */ - input_abs_set_max(vtb->idev, ABS_X, 32767); - input_abs_set_max(vtb->idev, ABS_Y, 32767); + cmdline = strstr(saved_command_line, CMDLINE_VIDEO_PARAM); + if (cmdline != NULL) { + char *tmp; + + cmdline += strlen(CMDLINE_VIDEO_PARAM); + tmp = strsep(&cmdline, "x"); + if (tmp != NULL) { + ret = kstrtoint(tmp, 10, &width); + if (ret) { + printk(KERN_WARNING "cannot find the width value\n"); + width = 0; + } + + tmp = strsep(&cmdline, "-"); + if (tmp != NULL) { + ret = kstrtoint(tmp, 10, &height); + if (ret) { + printk(KERN_WARNING "cannot find the height value\n"); + height = 0; + } + } else { + printk(KERN_WARNING "Invalid bpp separator:" + " cannot find the height value\n"); + } + } else { + printk(KERN_WARNING "Invalid resolution separator: " + " cannot find the width value\n"); + } + } else { + printk(KERN_WARNING "cannot find the video parameter(%s) " + "in the kernel command line\n", CMDLINE_VIDEO_PARAM); + } + + if (!width || !height) { + width = DEFAULT_WIDTH; + height = DEFAULT_HEIGHT; + printk(KERN_WARNING "cannot find the width or height, " + "use default values %dx%d\n", width, height); + } + + input_set_abs_params(vtb->idev, ABS_X, 0, width, 0, 0); + input_set_abs_params(vtb->idev, ABS_Y, 0, height, 0, 0); set_bit(BTN_LEFT, vtb->idev->keybit); set_bit(BTN_RIGHT, vtb->idev->keybit);