tools: acrnctl: fix: resume default wakeup reason is CBC_WK_RSN_BTN

UOS requires an wakeup reason when resumed from S3 suspend. If user
use "acrnctl resume [VMNAME]" without an reason, 0x0 will be used
as default reason, and this is not work. We can use CBC_WK_RSN_BTN
instead.

Tracked-On: #1550
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
yuhong.tao@intel.com 2018-10-22 15:02:42 +00:00 committed by Xie, Nanlin
parent a6677e6e69
commit a853c05546
1 changed files with 5 additions and 2 deletions

View File

@ -18,8 +18,10 @@
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <stdbool.h>
#include "acrn_mngr.h" #include "acrn_mngr.h"
#include "acrnctl.h" #include "acrnctl.h"
#include "ioc.h"
#define ACRNCTL_OPT_ROOT "/opt/acrn/conf" #define ACRNCTL_OPT_ROOT "/opt/acrn/conf"
@ -468,7 +470,7 @@ static int acrnctl_do_suspend(int argc, char *argv[])
static int acrnctl_do_resume(int argc, char *argv[]) static int acrnctl_do_resume(int argc, char *argv[])
{ {
struct vmmngr_struct *s; struct vmmngr_struct *s;
unsigned reason = 0; unsigned reason = CBC_WK_RSN_BTN;
s = vmmngr_find(argv[1]); s = vmmngr_find(argv[1]);
if (!s) { if (!s) {
@ -479,7 +481,8 @@ static int acrnctl_do_resume(int argc, char *argv[])
if (argc == 3) { if (argc == 3) {
sscanf(argv[2], "%x", &reason); sscanf(argv[2], "%x", &reason);
reason = (reason & (0xff << 24)) ? 0 : reason; reason = (reason & (0xff << 24)) ? 0 : reason;
} } else
printf("No wake up reason, use 0x%x\n", reason);
switch (s->state) { switch (s->state) {
case VM_PAUSED: case VM_PAUSED: