Skip to contentSkip to conversation

xen,input: xen-kbdfront pointing device resolution support

PATCH Superseded Juergen Gross 2 participants 15 messages Apr 11, 2017

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover xen,input: xen-kbdfront pointing device resolution support

As my patch tying the resolution of the xen pointing device to that of the framebuffer wasn't accepted add support for different resolutions via a module parameter.

Another possibility would be to set parameters via Xenstore, but this is broken (patch 2 fixes that) and not yet supported by Xen tools.

V2: patch 1: make resolution changes via xenstore visible in sysfs

Juergen Gross (2):
xen,input: add xen-kbdfront module parameter for setting resolution xen,input: repair xen-kbdfront resolution setting via xenstore

 drivers/input/misc/xen-kbdfront.c | 50 ++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 16 deletions(-)
Signature · 1 line
2.12.0
#1 lore raw

PATCH v2 1/2 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.

---
 drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/input/misc/xen-kbdfront.c +14 -4
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
 	char phys[32];
 };
 
+enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(size, int, NULL, 0444);
+MODULE_PARM_DESC(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 *);
@@ -174,8 +180,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, size[KPARAM_WIDTH], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, size[KPARAM_HEIGHT], 0, 0);
 	} else {
 		input_set_capability(ptr, EV_REL, REL_X);
 		input_set_capability(ptr, EV_REL, REL_Y);
@@ -344,12 +350,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 
 		/* Set input abs params to match backend screen res */
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
+				 "width", "%d", &val) > 0) {
 			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
+			size[KPARAM_WIDTH] = val;
+		}
 
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
+				 "height", "%d", &val) > 0) {
 			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
+			size[KPARAM_HEIGHT] = val;
+		}
 
 		break;
 
Signature · 1 line
2.12.0
#9 lore raw

PATCH v2 2/2 xen,input: repair xen-kbdfront resolution setting via xenstore

In reply to Juergen Gross

Setting the pointing device resolution via Xenstore isn't working
reliably: in case XenbusStateInitWait has been missed the resolution settings won't be read. Correct this.

---
 drivers/input/misc/xen-kbdfront.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
drivers/input/misc/xen-kbdfront.c +20 -12
index 90e7981a7768..fc28f59dfa93 100644
@@ -312,11 +312,27 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 	info->gref = -1;
 }
 
+static void xenkbd_set_connected(struct xenbus_device *dev)
+{
+	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
+	int ret;
+
+	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_warn("xenkbd: can't request abs-pointer");
+	}
+
+	xenbus_switch_state(dev, XenbusStateConnected);
+}
+
 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;
+	int val;
 
 	switch (backend_state) {
 	case XenbusStateInitialising:
@@ -327,16 +343,7 @@ 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);
+		xenkbd_set_connected(dev);
 		break;
 
 	case XenbusStateConnected:
@@ -346,7 +353,8 @@ 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 */
+			/* No InitWait seen yet, fudge it. */
+			xenkbd_set_connected(dev);
 
 		/* Set input abs params to match backend screen res */
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
Signature · 1 line
2.12.0
#8 lore raw

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

In reply to 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.

---
 drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/input/misc/xen-kbdfront.c +14 -4
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
 	char phys[32];
 };
 
+enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };
+module_param_array(size, int, NULL, 0444);
+MODULE_PARM_DESC(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 *);
@@ -174,8 +180,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, size[KPARAM_WIDTH], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, size[KPARAM_HEIGHT], 0, 0);
 	} else {
 		input_set_capability(ptr, EV_REL, REL_X);
 		input_set_capability(ptr, EV_REL, REL_Y);
@@ -344,12 +350,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 
 		/* Set input abs params to match backend screen res */
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
+				 "width", "%d", &val) > 0) {
 			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
+			size[KPARAM_WIDTH] = val;
+		}
 
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
+				 "height", "%d", &val) > 0) {
 			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
+			size[KPARAM_HEIGHT] = val;
+		}
 
 		break;
 
Signature · 7 lines
2.12.0


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

PATCH v2 2/2 xen, input: repair xen-kbdfront resolution setting via xenstore

In reply to Juergen Gross

Setting the pointing device resolution via Xenstore isn't working
reliably: in case XenbusStateInitWait has been missed the resolution settings won't be read. Correct this.

---
 drivers/input/misc/xen-kbdfront.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)
drivers/input/misc/xen-kbdfront.c +20 -12
index 90e7981a7768..fc28f59dfa93 100644
@@ -312,11 +312,27 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 	info->gref = -1;
 }
 
+static void xenkbd_set_connected(struct xenbus_device *dev)
+{
+	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
+	int ret;
+
+	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_warn("xenkbd: can't request abs-pointer");
+	}
+
+	xenbus_switch_state(dev, XenbusStateConnected);
+}
+
 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;
+	int val;
 
 	switch (backend_state) {
 	case XenbusStateInitialising:
@@ -327,16 +343,7 @@ 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);
+		xenkbd_set_connected(dev);
 		break;
 
 	case XenbusStateConnected:
@@ -346,7 +353,8 @@ 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 */
+			/* No InitWait seen yet, fudge it. */
+			xenkbd_set_connected(dev);
 
 		/* Set input abs params to match backend screen res */
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
Signature · 7 lines
2.12.0


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

Re: [PATCH v2 2/2] xen,input: repair xen-kbdfront resolution setting via xenstore

In reply to Juergen Gross

Hi, Juergen,

could you please make one more patch in the series:

the code that you fix in this patch is ok, but most

of the functionality of the xenkbd_set_connected

is still useless: feature-abs-pointer/request-abs-pointer

negotiation has only meaning at probe time, when we are

configuring input device:

    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);
    } else {
        input_set_capability(ptr, EV_REL, REL_X);
        input_set_capability(ptr, EV_REL, REL_Y);
    }

Once the input device is configured and registered (probe done)

we do not touch/re-configure that input device anymore,

regardless of the setting negotiation at xenkbd_set_connected

time. Thus, this code is not needed and can be cleaned out.

What your patch actually fixes is the fact that

"xenbus_switch_state(dev, XenbusStateConnected);" was not called,

so this is the only line needed.

Thank you,

Oleksandr

Quoted 71 lines · Juergen Gross

Setting the pointing device resolution via Xenstore isn't working
reliably: in case XenbusStateInitWait has been missed the resolution settings won't be read. Correct this.

---
  drivers/input/misc/xen-kbdfront.c | 32 ++++++++++++++++++++------------
  1 file changed, 20 insertions(+), 12 deletions(-)
drivers/input/misc/xen-kbdfront.c +20 -12
index 90e7981a7768..fc28f59dfa93 100644
@@ -312,11 +312,27 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
  	info->gref = -1;
  }
 
+static void xenkbd_set_connected(struct xenbus_device *dev)
+{
+	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
+	int ret;
+
+	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_warn("xenkbd: can't request abs-pointer");
+	}
+
+	xenbus_switch_state(dev, XenbusStateConnected);
+}
+
  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;
+	int val;
 
  	switch (backend_state) {
  	case XenbusStateInitialising:
@@ -327,16 +343,7 @@ 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);
+		xenkbd_set_connected(dev);
  		break;
 
  	case XenbusStateConnected:
@@ -346,7 +353,8 @@ 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 */
+			/* No InitWait seen yet, fudge it. */
+			xenkbd_set_connected(dev);
 
  		/* Set input abs params to match backend screen res */
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
#13 lore raw

Re: [PATCH v2 2/2] xen, input: repair xen-kbdfront resolution setting via xenstore

In reply to Juergen Gross

Hi, Juergen,

could you please make one more patch in the series:

the code that you fix in this patch is ok, but most

of the functionality of the xenkbd_set_connected

is still useless: feature-abs-pointer/request-abs-pointer

negotiation has only meaning at probe time, when we are

configuring input device:

    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);
    } else {
        input_set_capability(ptr, EV_REL, REL_X);
        input_set_capability(ptr, EV_REL, REL_Y);
    }

Once the input device is configured and registered (probe done)

we do not touch/re-configure that input device anymore,

regardless of the setting negotiation at xenkbd_set_connected

time. Thus, this code is not needed and can be cleaned out.

What your patch actually fixes is the fact that

"xenbus_switch_state(dev, XenbusStateConnected);" was not called,

so this is the only line needed.

Thank you,

Oleksandr

Quoted 62 lines · Juergen Gross

Setting the pointing device resolution via Xenstore isn't working
reliably: in case XenbusStateInitWait has been missed the resolution settings won't be read. Correct this.

---
  drivers/input/misc/xen-kbdfront.c | 32 ++++++++++++++++++++------------
  1 file changed, 20 insertions(+), 12 deletions(-)
drivers/input/misc/xen-kbdfront.c +18 -11
index 90e7981a7768..fc28f59dfa93 100644
@@ -312,11 +312,27 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
  	info->gref = -1;
  }
 
+static void xenkbd_set_connected(struct xenbus_device *dev)
+{
+	struct xenkbd_info *info = dev_get_drvdata(&dev->dev);
+	int ret;
+
+	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_warn("xenkbd: can't request abs-pointer");
+	}
+
+	xenbus_switch_state(dev, XenbusStateConnected);
+}
+
  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;
+	int val;
 
  	switch (backend_state) {
  	case XenbusStateInitialising:
@@ -327,16 +343,7 @@ 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);
+		xenkbd_set_connected(dev);
  		break;
 
  	case XenbusStateConnected:

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

Quoted 9 lines
drivers/input/misc/xen-kbdfront.c +2 -1
@@ -346,7 +353,8 @@ 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 */
+			/* No InitWait seen yet, fudge it. */
+			xenkbd_set_connected(dev);
 
  		/* Set input abs params to match backend screen res */
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,

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

#11 lore raw

Re: [PATCH v2 2/2] xen,input: repair xen-kbdfront resolution setting via xenstore

In reply to Oleksandr Andrushchenko
Quoted 28 lines · Oleksandr Andrushchenko

Hi, Juergen,

could you please make one more patch in the series:

the code that you fix in this patch is ok, but most

of the functionality of the xenkbd_set_connected

is still useless: feature-abs-pointer/request-abs-pointer

negotiation has only meaning at probe time, when we are

configuring input device:

    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);
    } else {
        input_set_capability(ptr, EV_REL, REL_X);
        input_set_capability(ptr, EV_REL, REL_Y);
    }

Once the input device is configured and registered (probe done)

we do not touch/re-configure that input device anymore,

regardless of the setting negotiation at xenkbd_set_connected

Quoted 7 lines

time. Thus, this code is not needed and can be cleaned out.

What your patch actually fixes is the fact that

"xenbus_switch_state(dev, XenbusStateConnected);" was not called,

so this is the only line needed.

This makes sense.

I'll modify patch2 according to your suggestion instead of adding another patch removing most of the stuff added by patch 2.

Juergen

#12 lore raw

Re: [PATCH v2 2/2] xen, input: repair xen-kbdfront resolution setting via xenstore

In reply to Oleksandr Andrushchenko
Quoted 28 lines · Oleksandr Andrushchenko

Hi, Juergen,

could you please make one more patch in the series:

the code that you fix in this patch is ok, but most

of the functionality of the xenkbd_set_connected

is still useless: feature-abs-pointer/request-abs-pointer

negotiation has only meaning at probe time, when we are

configuring input device:

    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);
    } else {
        input_set_capability(ptr, EV_REL, REL_X);
        input_set_capability(ptr, EV_REL, REL_Y);
    }

Once the input device is configured and registered (probe done)

we do not touch/re-configure that input device anymore,

regardless of the setting negotiation at xenkbd_set_connected

Quoted 7 lines

time. Thus, this code is not needed and can be cleaned out.

What your patch actually fixes is the fact that

"xenbus_switch_state(dev, XenbusStateConnected);" was not called,

so this is the only line needed.

This makes sense.

I'll modify patch2 according to your suggestion instead of adding another patch removing most of the stuff added by patch 2.

Juergen

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

#2 lore raw

Re: [PATCH v2 1/2] xen,input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 13 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.

---
  drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
drivers/input/misc/xen-kbdfront.c +0 -0
index 3900875dec10..90e7981a7768 100644

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 45

Quoted 5 lines
drivers/input/misc/xen-kbdfront.c +2 -0
@@ -41,6 +41,12 @@ struct xenkbd_info {
  	char phys[32];
  };
 
+enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Quoted 27 lines
drivers/input/misc/xen-kbdfront.c +9 -3
+module_param_array(size, int, NULL, 0444);
+MODULE_PARM_DESC(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 *);
@@ -174,8 +180,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, size[KPARAM_WIDTH], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, size[KPARAM_HEIGHT], 0, 0);
  	} else {
  		input_set_capability(ptr, EV_REL, REL_X);
  		input_set_capability(ptr, EV_REL, REL_Y);
@@ -344,12 +350,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 
  		/* Set input abs params to match backend screen res */
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
+				 "width", "%d", &val) > 0) {
  			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
+			size[KPARAM_WIDTH] = val;
+		}

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

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +3 -1
 
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
+				 "height", "%d", &val) > 0) {
  			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
+			size[KPARAM_HEIGHT] = val;
+		}
 
  		break;
 

Thank you,
Oleksandr

#7 lore raw

Re: [PATCH v2 1/2] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 13 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.

---
  drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
drivers/input/misc/xen-kbdfront.c +0 -0
index 3900875dec10..90e7981a7768 100644

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 45

Quoted 5 lines
drivers/input/misc/xen-kbdfront.c +2 -0
@@ -41,6 +41,12 @@ struct xenkbd_info {
  	char phys[32];
  };
 
+enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Quoted 27 lines
drivers/input/misc/xen-kbdfront.c +9 -3
+module_param_array(size, int, NULL, 0444);
+MODULE_PARM_DESC(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 *);
@@ -174,8 +180,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, size[KPARAM_WIDTH], 0, 0);
+		input_set_abs_params(ptr, ABS_Y, 0, size[KPARAM_HEIGHT], 0, 0);
  	} else {
  		input_set_capability(ptr, EV_REL, REL_X);
  		input_set_capability(ptr, EV_REL, REL_Y);
@@ -344,12 +350,16 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
 
  		/* Set input abs params to match backend screen res */
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "width", "%d", &val) > 0)
+				 "width", "%d", &val) > 0) {
  			input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0);
+			size[KPARAM_WIDTH] = val;
+		}

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

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +3 -1
 
  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "height", "%d", &val) > 0)
+				 "height", "%d", &val) > 0) {
  			input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0);
+			size[KPARAM_HEIGHT] = val;
+		}
 
  		break;
 

Thank you,
Oleksandr

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

#3 lore raw

Re: [PATCH v2 1/2] xen,input: add xen-kbdfront module parameter for setting resolution

In reply to Oleksandr Andrushchenko
Quoted 9 lines · Oleksandr Andrushchenko
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.

---
  drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 44

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -0
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
      char phys[32];
  };
  +enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Sure. After all I think I can merge the patches, as reading width and height a second time while connecting the device seems to be pointless.

While logically patch 2 seems to correct the connection process there was never a problem with it being wrong: width and height would have been already read during probing of the device so missing to read them again wouldn't lead to any wrong settings.

Juergen

#6 lore raw

Re: [PATCH v2 1/2] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Oleksandr Andrushchenko
Quoted 9 lines · Oleksandr Andrushchenko
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.

---
  drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 44

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -0
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
      char phys[32];
  };
  +enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Sure. After all I think I can merge the patches, as reading width and height a second time while connecting the device seems to be pointless.

While logically patch 2 seems to correct the connection process there was never a problem with it being wrong: width and height would have been already read during probing of the device so missing to read them again wouldn't lead to any wrong settings.

Juergen

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

#4 lore raw

Re: [PATCH v2 1/2] xen,input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 24 lines · Juergen Gross
Quoted 9 lines · Oleksandr Andrushchenko
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.

---
   drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
   1 file changed, 14 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 44

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -0
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
       char phys[32];
   };
   +enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Quoted 7 lines

Sure. After all I think I can merge the patches, as reading width and height a second time while connecting the device seems to be pointless.

While logically patch 2 seems to correct the connection process there was never a problem with it being wrong: width and height would have been already read during probing of the device so missing to read them again wouldn't lead to any wrong settings.

Exactly, IMO this driver does need attention, but it will also require changes to qemu-fb-backend if state machine changes. This is why we still use this logic in our backend as well

Quoted 2 lines

Juergen

#5 lore raw

Re: [PATCH v2 1/2] xen, input: add xen-kbdfront module parameter for setting resolution

In reply to Juergen Gross
Quoted 24 lines · Juergen Gross
Quoted 9 lines · Oleksandr Andrushchenko
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.

---
   drivers/input/misc/xen-kbdfront.c | 18 ++++++++++++++----
   1 file changed, 14 insertions(+), 4 deletions(-)
Quoted 14 lines

drivers/input/misc/xen-kbdfront.c struct xenkbd_info { · line 44

Quoted 10 lines
drivers/input/misc/xen-kbdfront.c +1 -0
index 3900875dec10..90e7981a7768 100644
@@ -41,6 +41,12 @@ struct xenkbd_info {
       char phys[32];
   };
   +enum { KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
+static int size[KPARAM_CNT] = { XENFB_WIDTH, XENFB_HEIGHT };

if you are about to release yet another version of the series, could you please also rename "size" to "ptr_size/pointer_size/XXX", so later when I add multi-touch support I can have "mtouch_size" module parameter and they are consistent all together?

Quoted 7 lines

Sure. After all I think I can merge the patches, as reading width and height a second time while connecting the device seems to be pointless.

While logically patch 2 seems to correct the connection process there was never a problem with it being wrong: width and height would have been already read during probing of the device so missing to read them again wouldn't lead to any wrong settings.

Exactly, IMO this driver does need attention, but it will also require changes to qemu-fb-backend if state machine changes. This is why we still use this logic in our backend as well

Quoted 2 lines

Juergen

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