#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 {
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");
| 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);