Skip to contentSkip to conversation

xen,input: add xen-kbdfront module parameter for setting resolution

PATCH Applied Juergen Gross 3 participants 17 messages Apr 11, 2017 – Apr 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xen,input: add xen-kbdfront module parameter for setting resolution

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
 drivers/input/misc/xen-kbdfront.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +14 -25
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
 	char phys[32];
 };
 
+enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+	"Pointing device width, height in pixels (default 800,600)");
+
 static int xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
 	if (!info->page)
 		goto error_nomem;
 
+	/* Set input abs params to match backend screen res */
 	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+						  ptr_size[KPARAM_X]);
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+						  ptr_size[KPARAM_Y]);
 	if (abs) {
 		ret = xenbus_write(XBT_NIL, dev->nodename,
 				   "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (abs) {
 		__set_bit(EV_ABS, ptr->evbit);
-		input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-		input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+		input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
 	} else {
 		input_set_capability(ptr, EV_REL, REL_X);
 		input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 static void xenkbd_backend_changed(struct xenbus_device *dev,
 				   enum xenbus_state backend_state)
 {
-	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-	int ret, val;
-
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateInitWait:
-InitWait:
-		if (xenbus_read_unsigned(info->xbdev->otherend,
-					 "feature-abs-pointer", 0)) {
-			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-					   "request-abs-pointer", "1");
-			if (ret)
-				pr_warning("xenkbd: can't request abs-pointer");
-		}
-
 		xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
@@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		 * get Connected twice here.
 		 */
 		if (dev->state != XenbusStateConnected)
-			goto InitWait; /* no InitWait seen yet, fudge it */
-
-		/* Set input abs params to match backend screen res */
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+			xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
 	case XenbusStateClosed:
Signature · 1 line
2.12.0
Reviewed-by on v3 1/1
#1 lore raw

Hi, Juergen!

Quoted 91 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
  drivers/input/misc/xen-kbdfront.c | 39 ++++++++++++++-------------------------
  1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +13 -19
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
  	char phys[32];
  };
 
+enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+	"Pointing device width, height in pixels (default 800,600)");
+
  static int xenkbd_remove(struct xenbus_device *);
  static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
  static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
  	if (!info->page)
  		goto error_nomem;
 
+	/* Set input abs params to match backend screen res */
  	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+						  ptr_size[KPARAM_X]);
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+						  ptr_size[KPARAM_Y]);
  	if (abs) {
  		ret = xenbus_write(XBT_NIL, dev->nodename,
  				   "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
  	if (abs) {
  		__set_bit(EV_ABS, ptr->evbit);
-		input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-		input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+		input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
  	} else {
  		input_set_capability(ptr, EV_REL, REL_X);
  		input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
  static void xenkbd_backend_changed(struct xenbus_device *dev,
  				   enum xenbus_state backend_state)
  {
-	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-	int ret, val;
-
  	switch (backend_state) {
  	case XenbusStateInitialising:
  	case XenbusStateInitialised:
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
  		break;
 
  	case XenbusStateInitWait:
-InitWait:
-		if (xenbus_read_unsigned(info->xbdev->otherend,
-					 "feature-abs-pointer", 0)) {
-			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-					   "request-abs-pointer", "1");
-			if (ret)
-				pr_warning("xenkbd: can't request abs-pointer");
-		}
-
  		xenbus_switch_state(dev, XenbusStateConnected);
  		break;
 
@@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
  		 * get Connected twice here.
  		 */
  		if (dev->state != XenbusStateConnected)
-			goto InitWait; /* no InitWait seen yet, fudge it */
-
-		/* Set input abs params to match backend screen res */
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)

drivers/input/misc/xen-kbdfront.c static void xenkbd_backend_changed(struct xenbus_device *dev, · line 345

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -6
-			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+			xenbus_switch_state(dev, XenbusStateConnected);
  		break;
 
  	case XenbusStateClosed:

I have tested this patch and here we go

I also tested this with my patches for multi-touch support and almost ready to push those as well. With this respect, I have a question on how this can better be done: my patches depend on your patch + they depend on new kbdif.h queued for Linux 4.12.

What do you guys think would be the best approach for upstreaming multi-touch then?

Thank you,
Oleksandr

Reviewed-by on v3 1/1
#4 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross

Hi, Juergen!

Quoted 91 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
  drivers/input/misc/xen-kbdfront.c | 39 ++++++++++++++-------------------------
  1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +13 -19
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
  	char phys[32];
  };
 
+enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+	"Pointing device width, height in pixels (default 800,600)");
+
  static int xenkbd_remove(struct xenbus_device *);
  static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
  static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
  	if (!info->page)
  		goto error_nomem;
 
+	/* Set input abs params to match backend screen res */
  	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+						  ptr_size[KPARAM_X]);
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+						  ptr_size[KPARAM_Y]);
  	if (abs) {
  		ret = xenbus_write(XBT_NIL, dev->nodename,
  				   "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
  	if (abs) {
  		__set_bit(EV_ABS, ptr->evbit);
-		input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-		input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+		input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
  	} else {
  		input_set_capability(ptr, EV_REL, REL_X);
  		input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
  static void xenkbd_backend_changed(struct xenbus_device *dev,
  				   enum xenbus_state backend_state)
  {
-	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-	int ret, val;
-
  	switch (backend_state) {
  	case XenbusStateInitialising:
  	case XenbusStateInitialised:
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
  		break;
 
  	case XenbusStateInitWait:
-InitWait:
-		if (xenbus_read_unsigned(info->xbdev->otherend,
-					 "feature-abs-pointer", 0)) {
-			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-					   "request-abs-pointer", "1");
-			if (ret)
-				pr_warning("xenkbd: can't request abs-pointer");
-		}
-
  		xenbus_switch_state(dev, XenbusStateConnected);
  		break;
 
@@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
  		 * get Connected twice here.
  		 */
  		if (dev->state != XenbusStateConnected)
-			goto InitWait; /* no InitWait seen yet, fudge it */
-
-		/* Set input abs params to match backend screen res */
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)

drivers/input/misc/xen-kbdfront.c static void xenkbd_backend_changed(struct xenbus_device *dev, · line 345

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -6
-			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+			xenbus_switch_state(dev, XenbusStateConnected);
  		break;
 
  	case XenbusStateClosed:

I have tested this patch and here we go

I also tested this with my patches for multi-touch support and almost ready to push those as well. With this respect, I have a question on how this can better be done: my patches depend on your patch + they depend on new kbdif.h queued for Linux 4.12.

What do you guys think would be the best approach for upstreaming multi-touch then?

Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Oleksandr Andrushchenko
Quoted 107 lines · Oleksandr Andrushchenko

Hi, Juergen!

Quoted 92 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
  drivers/input/misc/xen-kbdfront.c | 39
++++++++++++++-------------------------
  1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +11 -5
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
      char phys[32];
  };
  +enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+    "Pointing device width, height in pixels (default 800,600)");
+
  static int xenkbd_remove(struct xenbus_device *);
  static int xenkbd_connect_backend(struct xenbus_device *, struct
 xenkbd_info *);
  static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
      if (!info->page)
          goto error_nomem;
  +    /* Set input abs params to match backend screen res */
      abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer",
 0);
+    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+                          ptr_size[KPARAM_X]);
+    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+                          ptr_size[KPARAM_Y]);
      if (abs) {
          ret = xenbus_write(XBT_NIL, dev->nodename,
                     "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
        if (abs) {
          __set_bit(EV_ABS, ptr->evbit);
-        input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-        input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+        input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+        input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
      } else {
          input_set_capability(ptr, EV_REL, REL_X);
          input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct
 xenkbd_info *info)
  static void xenkbd_backend_changed(struct xenbus_device *dev,
                     enum xenbus_state backend_state)
  {
-    struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-    int ret, val;
-
      switch (backend_state) {
      case XenbusStateInitialising:

case XenbusStateInitialised:

drivers/input/misc/xen-kbdfront.c +0 -9
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct
 xenbus_device *dev,
          break;
        case XenbusStateInitWait:
-InitWait:
-        if (xenbus_read_unsigned(info->xbdev->otherend,
-                     "feature-abs-pointer", 0)) {
-            ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-                       "request-abs-pointer", "1");
-            if (ret)
-                pr_warning("xenkbd: can't request abs-pointer");
-        }
-
          xenbus_switch_state(dev, XenbusStateConnected);
          break;
  @@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct

xenbus_device *dev,

           * get Connected twice here.
           */
          if (dev->state != XenbusStateConnected)
drivers/input/misc/xen-kbdfront.c +0 -4
-            goto InitWait; /* no InitWait seen yet, fudge it */
-
-        /* Set input abs params to match backend screen res */
-        if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,

drivers/input/misc/xen-kbdfront.c static void xenkbd_backend_changed(struct xenbus_device *dev, · line 345

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -7
-                 "width", "%d", &val) > 0)
-            input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-        if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-                 "height", "%d", &val) > 0)
-            input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+            xenbus_switch_state(dev, XenbusStateConnected);
          break;
        case XenbusStateClosed:

I have tested this patch and here we go

Quoted 1 line

Thanks.

Quoted 8 lines

I also tested this with my patches for multi-touch support and almost ready to push those as well. With this respect, I have a question on how this can better be done: my patches depend on your patch + they depend on new kbdif.h queued for Linux 4.12.

What do you guys think would be the best approach for upstreaming multi-touch then?

Mention the dependency in the commit message below a marker line containing only '---' (without the "'"). Probably there will be at least a few review rounds so the patches you are depending on have a chance to make it into the kernel until your patches are applied. In case your code is perfect from the beginning we can coordinate the pull requests to be in correct sequence. :-)

Juergen

#3 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Oleksandr Andrushchenko
Quoted 107 lines · Oleksandr Andrushchenko

Hi, Juergen!

Quoted 92 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
  drivers/input/misc/xen-kbdfront.c | 39
++++++++++++++-------------------------
  1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +11 -5
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
      char phys[32];
  };
  +enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+    "Pointing device width, height in pixels (default 800,600)");
+
  static int xenkbd_remove(struct xenbus_device *);
  static int xenkbd_connect_backend(struct xenbus_device *, struct
 xenkbd_info *);
  static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
      if (!info->page)
          goto error_nomem;
  +    /* Set input abs params to match backend screen res */
      abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer",
 0);
+    ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+                          ptr_size[KPARAM_X]);
+    ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+                          ptr_size[KPARAM_Y]);
      if (abs) {
          ret = xenbus_write(XBT_NIL, dev->nodename,
                     "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
        if (abs) {
          __set_bit(EV_ABS, ptr->evbit);
-        input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-        input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+        input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+        input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
      } else {
          input_set_capability(ptr, EV_REL, REL_X);
          input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct
 xenkbd_info *info)
  static void xenkbd_backend_changed(struct xenbus_device *dev,
                     enum xenbus_state backend_state)
  {
-    struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-    int ret, val;
-
      switch (backend_state) {
      case XenbusStateInitialising:

case XenbusStateInitialised:

drivers/input/misc/xen-kbdfront.c +0 -9
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct
 xenbus_device *dev,
          break;
        case XenbusStateInitWait:
-InitWait:
-        if (xenbus_read_unsigned(info->xbdev->otherend,
-                     "feature-abs-pointer", 0)) {
-            ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-                       "request-abs-pointer", "1");
-            if (ret)
-                pr_warning("xenkbd: can't request abs-pointer");
-        }
-
          xenbus_switch_state(dev, XenbusStateConnected);
          break;
  @@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct

xenbus_device *dev,

           * get Connected twice here.
           */
          if (dev->state != XenbusStateConnected)
drivers/input/misc/xen-kbdfront.c +0 -4
-            goto InitWait; /* no InitWait seen yet, fudge it */
-
-        /* Set input abs params to match backend screen res */
-        if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,

drivers/input/misc/xen-kbdfront.c static void xenkbd_backend_changed(struct xenbus_device *dev, · line 345

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -7
-                 "width", "%d", &val) > 0)
-            input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-        if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-                 "height", "%d", &val) > 0)
-            input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+            xenbus_switch_state(dev, XenbusStateConnected);
          break;
        case XenbusStateClosed:

I have tested this patch and here we go

Quoted 1 line

Thanks.

Quoted 8 lines

I also tested this with my patches for multi-touch support and almost ready to push those as well. With this respect, I have a question on how this can better be done: my patches depend on your patch + they depend on new kbdif.h queued for Linux 4.12.

What do you guys think would be the best approach for upstreaming multi-touch then?

Mention the dependency in the commit message below a marker line containing only '---' (without the "'"). Probably there will be at least a few review rounds so the patches you are depending on have a chance to make it into the kernel until your patches are applied. In case your code is perfect from the beginning we can coordinate the pull requests to be in correct sequence. :-)

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#5 lore raw
In reply to Juergen Gross

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Thanks.

Signature · 1 line
Dmitry
maintainer
#14 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Thanks.

Signature · 6 lines
Dmitry

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw
In reply to Dmitry Torokhov
Quoted 10 lines · Dmitry Torokhov

Hi Juergen,

Quoted 7 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

Quoted 7 lines
Quoted 4 lines

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Juergen

#13 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Dmitry Torokhov
Quoted 10 lines · Dmitry Torokhov

Hi Juergen,

Quoted 7 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

Quoted 7 lines
Quoted 4 lines

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer
#7 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 16 lines · Juergen Gross
Quoted 15 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

Quoted 6 lines
Quoted 2 lines

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Quoted 8 lines
Quoted 7 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

Thanks.

Signature · 6 lines
Dmitry

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
maintainer
#8 lore raw
In reply to Juergen Gross
Quoted 16 lines · Juergen Gross
Quoted 15 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

Quoted 6 lines
Quoted 2 lines

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Quoted 8 lines
Quoted 7 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

Thanks.

Signature · 1 line
Dmitry
#9 lore raw
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Juergen Gross
Quoted 17 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Quoted 6 lines
Quoted 3 lines

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Either the guest administrator through guest boot loader or the Xen administrator in the guest config file.

In the case where the problem has been reported (automatic tests of graphical tools) this would be in the guest config file.

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Quoted 6 lines

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

So a small test revealed that only with a resolution matching that of the virtual console the virtual mouse pointer will be at the same position as the real mouse pointer. Working with different resolutions will require some sort of scaling available only if _both_ resolutions are known. And as you don't like the input driver knowing about the console I'm limited to fixed values via module parameters (taking into account the embedded scenario without udev).

Juergen

#12 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Dmitry Torokhov
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Juergen Gross
Quoted 17 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Quoted 6 lines
Quoted 3 lines

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Either the guest administrator through guest boot loader or the Xen administrator in the guest config file.

In the case where the problem has been reported (automatic tests of graphical tools) this would be in the guest config file.

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Quoted 6 lines

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

So a small test revealed that only with a resolution matching that of the virtual console the virtual mouse pointer will be at the same position as the real mouse pointer. Working with different resolutions will require some sort of scaling available only if _both_ resolutions are known. And as you don't like the input driver knowing about the console I'm limited to fixed values via module parameters (taking into account the embedded scenario without udev).

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw
In reply to Juergen Gross
Quoted 54 lines · Juergen Gross
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Juergen Gross
Quoted 17 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Quoted 6 lines
Quoted 3 lines

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Either the guest administrator through guest boot loader or the Xen administrator in the guest config file.

In the case where the problem has been reported (automatic tests of graphical tools) this would be in the guest config file.

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Quoted 6 lines

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

Quoted 7 lines

So a small test revealed that only with a resolution matching that of the virtual console the virtual mouse pointer will be at the same position as the real mouse pointer. Working with different resolutions will require some sort of scaling available only if _both_ resolutions are known. And as you don't like the input driver knowing about the console I'm limited to fixed values via module parameters (taking into account the embedded scenario without udev).

Dmitry, are you okay with this now?

I'd _really_ like to get this in - I'm trying for 3 months now.

Juergen

#11 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 54 lines · Juergen Gross
Quoted 20 lines · Dmitry Torokhov
Quoted 19 lines · Juergen Gross
Quoted 17 lines · Dmitry Torokhov

Hi Juergen,

Quoted 11 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

I guess 2 module parameters are not big deal, but could you tell me why you can't always have them specified in Xenstore?

Quoted 6 lines
Quoted 3 lines

This will depend on Xen version then. I'd prefer to have a way to specify the resolution in case a new kernel is running as a guest of an old Xen version.

Who would be seeting up the kernel parameters in this case? User manually in guest bootloader config?

Either the guest administrator through guest boot loader or the Xen administrator in the guest config file.

In the case where the problem has been reported (automatic tests of graphical tools) this would be in the guest config file.

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

Also, I still think you are going in the wrong direction here. Can your framebuffer size change after booting the guest? If it can, you have to reconcile the new size and the coordinates reported by the pointing device, and I think guest should be doing it. If you look, for example, at vmmouse driver, they do not try to match coordinates it reports to the screen.

Quoted 5 lines

I'm no expert in input driver interface. Can you tell me how the mouse pointer is positioned in case of the vmmouse driver? Are the real limits used just the minimum of pointing device and screen size limits? So specifying a size of 0xffff * 0xffff like the vmmouse driver does will work with any screen size being smaller than that?

Quoted 6 lines

I think 0xffff is just the limits for coordinates reported through this interface; the expectation is that guest window size is not larger than that. I do not recall if the backend reports real screen pointer position, of offset from the (0,0) of guest's window, Thomas might tel you. IIRC code in vmware tools package (that runs in guest) gets notifications about screen changes and reacts accordingly.

Quoted 7 lines

So a small test revealed that only with a resolution matching that of the virtual console the virtual mouse pointer will be at the same position as the real mouse pointer. Working with different resolutions will require some sort of scaling available only if _both_ resolutions are known. And as you don't like the input driver knowing about the console I'm limited to fixed values via module parameters (taking into account the embedded scenario without udev).

Dmitry, are you okay with this now?

I'd _really_ like to get this in - I'm trying for 3 months now.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

maintainer Applied
#15 lore raw
In reply to Juergen Gross
Quoted 8 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

Applied, thank you.

Quoted 96 lines

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
 drivers/input/misc/xen-kbdfront.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +14 -25
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
 	char phys[32];
 };
 
+enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+	"Pointing device width, height in pixels (default 800,600)");
+
 static int xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
 	if (!info->page)
 		goto error_nomem;
 
+	/* Set input abs params to match backend screen res */
 	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+						  ptr_size[KPARAM_X]);
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+						  ptr_size[KPARAM_Y]);
 	if (abs) {
 		ret = xenbus_write(XBT_NIL, dev->nodename,
 				   "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (abs) {
 		__set_bit(EV_ABS, ptr->evbit);
-		input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-		input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+		input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
 	} else {
 		input_set_capability(ptr, EV_REL, REL_X);
 		input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 static void xenkbd_backend_changed(struct xenbus_device *dev,
 				   enum xenbus_state backend_state)
 {
-	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-	int ret, val;
-
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateInitWait:
-InitWait:
-		if (xenbus_read_unsigned(info->xbdev->otherend,
-					 "feature-abs-pointer", 0)) {
-			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-					   "request-abs-pointer", "1");
-			if (ret)
-				pr_warning("xenkbd: can't request abs-pointer");
-		}
-
 		xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
@@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		 * get Connected twice here.
 		 */
 		if (dev->state != XenbusStateConnected)
-			goto InitWait; /* no InitWait seen yet, fudge it */
-
-		/* Set input abs params to match backend screen res */
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+			xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
 	case XenbusStateClosed:
Signature · 1 line
2.12.0
Signature · 1 line
Dmitry
maintainer Applied
#16 lore raw

Re: [PATCH v3] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 8 lines · Juergen Gross

Add a parameter for setting the resolution of xen-kbdfront in order to be able to cope with a (virtual) frame buffer of arbitrary resolution.

While at it remove the pointless second reading of parameters from Xenstore in the device connection phase: all parameters are available during device probing already and that is where they should be read.

Applied, thank you.

Quoted 96 lines

---
V3: - merged the two patches
- read Xenstore parameters during probing of the device only

---
 drivers/input/misc/xen-kbdfront.c | 39 ++++++++++++++-------------------------
 1 file changed, 14 insertions(+), 25 deletions(-)
drivers/input/misc/xen-kbdfront.c +14 -25
index 3900875dec10..2fc7895373ab 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
 	char phys[32];
 };
 
+enum { KPARAM_X, KPARAM_Y, KPARAM_CNT };
+static int ptr_size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(ptr_size, int, NULL, 0444);
+MODULE_PARM_DESC(ptr_size,
+	"Pointing device width, height in pixels (default 800,600)");
+
 static int xenkbd_remove(struct xenbus_device *);
 static int xenkbd_connect_backend(struct xenbus_device *, struct xenkbd_info *);
 static void xenkbd_disconnect_backend(struct xenkbd_info *);
@@ -128,7 +134,12 @@ static int xenkbd_probe(struct xenbus_device *dev,
 	if (!info->page)
 		goto error_nomem;
 
+	/* Set input abs params to match backend screen res */
 	abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
+	ptr_size[KPARAM_X] = xenbus_read_unsigned(dev->otherend, "width",
+						  ptr_size[KPARAM_X]);
+	ptr_size[KPARAM_Y] = xenbus_read_unsigned(dev->otherend, "height",
+						  ptr_size[KPARAM_Y]);
 	if (abs) {
 		ret = xenbus_write(XBT_NIL, dev->nodename,
 				   "request-abs-pointer", "1");
@@ -174,8 +185,8 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (abs) {
 		__set_bit(EV_ABS, ptr->evbit);
-		input_set_abs_params(ptr, ABS_X, 0, XENFB_WIDTH, 0, 0);
-		input_set_abs_params(ptr, ABS_Y, 0, XENFB_HEIGHT, 0, 0);
+		input_set_abs_params(ptr, ABS_X, 0, ptr_size[KPARAM_X], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, ptr_size[KPARAM_Y], 0, 0);
 	} else {
 		input_set_capability(ptr, EV_REL, REL_X);
 		input_set_capability(ptr, EV_REL, REL_Y);
@@ -309,9 +320,6 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 static void xenkbd_backend_changed(struct xenbus_device *dev,
 				   enum xenbus_state backend_state)
 {
-	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
-	int ret, val;
-
 	switch (backend_state) {
 	case XenbusStateInitialising:
 	case XenbusStateInitialised:
@@ -321,15 +329,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		break;
 
 	case XenbusStateInitWait:
-InitWait:
-		if (xenbus_read_unsigned(info->xbdev->otherend,
-					 "feature-abs-pointer", 0)) {
-			ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
-					   "request-abs-pointer", "1");
-			if (ret)
-				pr_warning("xenkbd: can't request abs-pointer");
-		}
-
 		xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
@@ -340,17 +339,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 		 * get Connected twice here.
 		 */
 		if (dev->state != XenbusStateConnected)
-			goto InitWait; /* no InitWait seen yet, fudge it */
-
-		/* Set input abs params to match backend screen res */
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
-
-		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
-			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
-
+			xenbus_switch_state(dev, XenbusStateConnected);
 		break;
 
 	case XenbusStateClosed:
Signature · 1 line
2.12.0
Signature · 6 lines
Dmitry

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel