Skip to contentSkip to conversation

HID: hyperv: register as a wakeup source

PATCH Applied Dexuan Cui 3 participants 3 messages Aug 1, 2014 – Aug 4, 2014

Subsystems (2)
lore
Share & tools
lore

Dexuan Cui

author maintainer
#0 lore raw

PATCH 1/1 HID: hyperv: register as a wakeup source

With this patch, we can move the mouse to wake up the VM after the VM executes "echo freeze > /sys/power/state".

This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100

Cc K. Y. Srinivasan <[email protected]>
---
 drivers/hid/hid-hyperv.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hid/hid-hyperv.c +6 -0
index f52dbcb..31fad64 100644
@@ -308,6 +308,9 @@ static void mousevsc_on_receive(struct hv_device *device,
 		memcpy(input_dev->input_buf, input_report->buffer, len);
 		hid_input_report(input_dev->hid_device, HID_INPUT_REPORT,
 				 input_dev->input_buf, len, 1);
+
+		pm_wakeup_event(&input_dev->device->device, 0);
+
 		break;
 	default:
 		pr_err("unsupported hid msg type - type %d len %d",
@@ -549,6 +552,8 @@ static int mousevsc_probe(struct hv_device *device,
 		goto probe_err2;
 	}
 
+	device_init_wakeup(&device->device, true);
+
 	input_dev->connected = true;
 	input_dev->init_complete = true;
 
@@ -571,6 +576,7 @@ static int mousevsc_remove(struct hv_device *dev)
 {
 	struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
 
+	device_init_wakeup(&dev->device, false);
 	vmbus_close(dev->channel);
 	hid_hw_stop(input_dev->hid_device);
 	hid_destroy_device(input_dev->hid_device);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Dexuan Cui [mailto:[email protected]]
Sent: Friday, August 1, 2014 7:27 AM
To: [email protected]; [email protected]; linux- [email protected]; [email protected]; driverdev- [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan; Haiyang Zhang
Subject: [PATCH] HID: hyperv: register as a wakeup source

Quoted 7 lines

With this patch, we can move the mouse to wake up the VM after the VM executes "echo freeze > /sys/power/state".

This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100

Cc K. Y. Srinivasan <[email protected]>
Quoted 38 lines
---
 drivers/hid/hid-hyperv.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hid/hid-hyperv.c index renamed from drivers/hid/hid-hyperv.c +0 -0

f52dbcb..31fad64 100644

drivers/hid/hid-hyperv.c +3 -0
@@ -308,6 +308,9 @@ static void mousevsc_on_receive(struct hv_device
 *device,
 		memcpy(input_dev->input_buf, input_report->buffer, len);
 		hid_input_report(input_dev->hid_device,
 HID_INPUT_REPORT,
 				 input_dev->input_buf, len, 1);
+
+		pm_wakeup_event(&input_dev->device->device, 0);
+
 		break;
drivers/hid/hid-hyperv.c +0 -0
 	default:
 		pr_err("unsupported hid msg type - type %d len %d", @@ -

549,6 +552,8 @@ static int mousevsc_probe(struct hv_device *device,

drivers/hid/hid-hyperv.c +3 -1
 		goto probe_err2;
 	}
 
+	device_init_wakeup(&device->device, true);
+
 	input_dev->connected = true;
 	input_dev->init_complete = true;
@@ -571,6 +576,7 @@ static int mousevsc_remove(struct hv_device *dev)  {
 	struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
 
+	device_init_wakeup(&dev->device, false);
 	vmbus_close(dev->channel);
 	hid_hw_stop(input_dev->hid_device);
 	hid_destroy_device(input_dev->hid_device);
--

1.9.1

Applied
#2 lore raw
In reply to Dexuan Cui
Quoted 7 lines · Dexuan Cui

With this patch, we can move the mouse to wake up the VM after the VM executes "echo freeze > /sys/power/state".

This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100

Cc K. Y. Srinivasan <[email protected]>

Applied, thanks.

Quoted 38 lines
---
 drivers/hid/hid-hyperv.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hid/hid-hyperv.c +6 -0
index f52dbcb..31fad64 100644
@@ -308,6 +308,9 @@ static void mousevsc_on_receive(struct hv_device *device,
 		memcpy(input_dev->input_buf, input_report->buffer, len);
 		hid_input_report(input_dev->hid_device, HID_INPUT_REPORT,
 				 input_dev->input_buf, len, 1);
+
+		pm_wakeup_event(&input_dev->device->device, 0);
+
 		break;
 	default:
 		pr_err("unsupported hid msg type - type %d len %d",
@@ -549,6 +552,8 @@ static int mousevsc_probe(struct hv_device *device,
 		goto probe_err2;
 	}
 
+	device_init_wakeup(&device->device, true);
+
 	input_dev->connected = true;
 	input_dev->init_complete = true;
 
@@ -571,6 +576,7 @@ static int mousevsc_remove(struct hv_device *dev)
 {
 	struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
 
+	device_init_wakeup(&dev->device, false);
 	vmbus_close(dev->channel);
 	hid_hw_stop(input_dev->hid_device);
 	hid_destroy_device(input_dev->hid_device);
Signature · 1 line
1.9.1
Signature · 2 lines
Jiri Kosina
SUSE Labs