Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2020 03:23:17 +0000
From:      <Shichun.Ma@dell.com>
To:        <hps@selasky.org>, <freebsd-usb@freebsd.org>
Cc:        <Jason_YH_Yang@wistron.com>
Subject:   Re: USB keyboard/mouse wake up from S3
Message-ID:  <1579231397567.62223@Dell.com>
In-Reply-To: <685f991f-6cb6-3f27-65d8-38181e4cfa8e@selasky.org>
References:  <1578625588784.46788@Dell.com> <47257477-bace-a9c5-69f5-7a0eb7af3947@selasky.org> <1578648297338.92657@Dell.com>, <685f991f-6cb6-3f27-65d8-38181e4cfa8e@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--_002_157923139756762223Dellcom_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

=0A=
HPS,=0A=
=0A=
Here is my patch to enable USB wakeup under XHCI, I tested USB mouse/keyboa=
rd can wake up system from S3.=0A=
=0A=
Thanks & Regards,=0A=
=0A=
Shichun Ma=0A=
Software Engineer=0A=
Dell | Cloud Client Computing=0A=
office +86 10 82862579,  Mobile +86 13241851528=0A=
shichun_ma@dell.com=0A=
=0A=
=0A=
=0A=
________________________________________=0A=
From: Hans Petter Selasky <hps@selasky.org>=0A=
Sent: Friday, January 10, 2020 5:41 PM=0A=
To: Ma, Horse; freebsd-usb@freebsd.org=0A=
Subject: Re: USB keyboard/mouse wake up from S3=0A=
=0A=
[EXTERNAL EMAIL]=0A=
=0A=
On 2020-01-10 10:24, Shichun.Ma@dell.com wrote:=0A=
> The USB wake up can still even device is detached.=0A=
> Before system enter to S3 and when detach the USB device, we can enable d=
evice's remote wake up feature.=0A=
> it can still send out the resume signal to host if it connected from hard=
ware.=0A=
>=0A=
=0A=
I think we don't do that currently. Would need a patch in the USB core.=0A=
Only during normal USB suspend / resume, not host suspend / resume.=0A=
=0A=
--HPS=0A=

--_002_157923139756762223Dellcom_
Content-Type: text/x-patch; name="usb_wakeup_xhci.diff"
Content-Description: usb_wakeup_xhci.diff
Content-Disposition: attachment; filename="usb_wakeup_xhci.diff"; size=5307;
	creation-date="Fri, 17 Jan 2020 03:22:23 GMT";
	modification-date="Fri, 17 Jan 2020 03:22:23 GMT"
Content-Transfer-Encoding: base64

ZGlmZiAtLWdpdCBhL3N5cy9kZXYvYWNwaWNhL2FjcGkuYyBiL3N5cy9kZXYvYWNwaWNhL2FjcGku
YwppbmRleCA1MDhhZDQ1ZjZkOS4uYTQ0ODc4NzIxNGEgMTAwNjQ0Ci0tLSBhL3N5cy9kZXYvYWNw
aWNhL2FjcGkuYworKysgYi9zeXMvZGV2L2FjcGljYS9hY3BpLmMKQEAgLTMyNTUsMTIgKzMyNTUs
MzEgQEAgYWNwaV93YWtlX3NsZWVwX3ByZXAoQUNQSV9IQU5ETEUgaGFuZGxlLCBpbnQgc3N0YXRl
KQogCWlmIChib290dmVyYm9zZSkKIAkgICAgZGV2aWNlX3ByaW50ZihkZXYsICJ3YWtlX3ByZXAg
ZGlzYWJsZWQgd2FrZSBmb3IgJXMgKFMlZClcbiIsCiAJCWFjcGlfbmFtZShoYW5kbGUpLCBzc3Rh
dGUpOwotICAgIH0gZWxzZSBpZiAoZGV2ICYmIChhY3BpX2dldF9mbGFncyhkZXYpICYgQUNQSV9G
TEFHX1dBS0VfRU5BQkxFRCkgIT0gMCkgeworICAgIH0gZWxzZSBpZiAoZGV2ICYmICgoKGFjcGlf
Z2V0X2ZsYWdzKGRldikgJiBBQ1BJX0ZMQUdfV0FLRV9FTkFCTEVEKSAhPSAwKSB8fAorCQkgICAg
ICAgKHN0cnN0cihhY3BpX25hbWUoaGFuZGxlKSwgIlhIQyIpKSkpIHsgLy9oYXJkIGNvZGUgWEhD
SSBhcyB3YWtlIHVwIHNpZ25hbCwgYW55IHN1c2dnZXN0aW9uIG9uIHRoZSBzZXR0aW5nPwogCWFj
cGlfcHdyX3dha2VfZW5hYmxlKGhhbmRsZSwgMSk7CiAJYWNwaV9TZXRJbnRlZ2VyKGhhbmRsZSwg
Il9QU1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CSAgdWRldi0+cG9ydF9ubyk7CisJaWYgKCFlcnIpCisJCURQUklOVEZOKDAsICJwb3J0ICVk
LCAleDoleCwgZXJyICV4OlxuIiwgdWRldi0+cG9ydF9ubywKKwkJCVVHRVRXKHBzLndQb3J0Q2hh
bmdlKSwgVUdFVFcocHMud1BvcnRTdGF0dXMpLCBlcnIpOworCisJcmV0dXJuIDA7Cit9CmRpZmYg
LS1naXQgYS9zeXMvZGV2L3VzYi91c2JkaS5oIGIvc3lzL2Rldi91c2IvdXNiZGkuaAppbmRleCAw
YTM5Mzg0NDUxMS4uOGJiYmRjMjY4NDkgMTAwNjQ0Ci0tLSBhL3N5cy9kZXYvdXNiL3VzYmRpLmgK
KysrIGIvc3lzL2Rldi91c2IvdXNiZGkuaApAQCAtNzA4LDUgKzcwOCw2IEBAIHZvaWQJKnVzYl9m
aWZvX3NvZnRjKHN0cnVjdCB1c2JfZmlmbyAqZmlmbyk7CiB2b2lkCXVzYl9maWZvX3NldF9jbG9z
ZV96bHAoc3RydWN0IHVzYl9maWZvICosIHVpbnQ4X3QpOwogdm9pZAl1c2JfZmlmb19zZXRfd3Jp
dGVfZGVmcmFnKHN0cnVjdCB1c2JfZmlmbyAqLCB1aW50OF90KTsKIHZvaWQJdXNiX2ZpZm9fZnJl
ZShzdHJ1Y3QgdXNiX2ZpZm8gKmYpOworaW50CXVzYl9zdXNwZW5kX2RldihzdHJ1Y3QgdXNiX2Rl
dmljZSAqdWRldik7CiAjZW5kaWYgLyogX0tFUk5FTCAqLwogI2VuZGlmIC8qIF9VU0JfVVNCRElf
SF8gKi8K

--_002_157923139756762223Dellcom_--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1579231397567.62223>