Skip to content

Commit

Permalink
HID: hyperv: register as a wakeup source
Browse files Browse the repository at this point in the history
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

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Dexuan Cui authored and Jiri Kosina committed Aug 4, 2014
1 parent 4c2f503 commit f121045
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/hid/hid-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit f121045

Please sign in to comment.