Skip to contentSkip to conversation

USB keyboard can NOT wakeup from S3( suspend to RAM )

DISCUSSION jingyun at cpu-os.ac.cn 5 participants 10 messages Aug 16, 2017 – Sep 5, 2017

lore
Share & tools
lore
#0 lore raw

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit the key of the USB interfaced keyboard; after making sure the box enter suspend state for a while ( which I can tell from the power LED blinks), I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and Ubuntu 14.04 ( 3.13 kernel). And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Thanks again.

Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170816/c3615bcb/attachment.html

#1 lore raw
Quoted 13 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit the key of the USB interfaced keyboard;
after making sure the box enter suspend state for a while ( which I can tell from the power LED blinks),
I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

Quoted 5 lines

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and Ubuntu 14.04 ( 3.13 kernel).
And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Sounds like your system does not support USB wakeup, which is very common, sorry.

good luck!

greg k-h

#2 lore raw
Quoted 6 lines · Greg KH
Quoted 2 lines · jingyun at cpu-os.ac.cn

But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

Sounds like your system does not support USB wakeup, which is very common, sorry.

There's also the fairly good chance that the hardware supports it, but
it's disabled in the BIOS - check if (a) you're running the latest BIOS
from the manufacturer and (b) if there's a BIOS setting for wakeup-on-USB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170830/86034695/attachment-0001.bin

#3 lore raw
In reply to Greg KH

Hi, Greg

Thanks for your time.
First of all, if I do NOT hit the keyboard during the suspend. Then my keyboard CAN wake the system up from suspend.
This has rule out that my system does NOT support USB wakeup. Right ?

Thanks again.

Jim

From: Greg KH
Date: 2017-08-30 14:09
To: jingyun at cpu-os.ac.cn
CC: kernelnewbies
Subject: Re: USB keyboard can NOT wakeup from S3( suspend to RAM )

Quoted 13 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit the key of the USB interfaced keyboard;
after making sure the box enter suspend state for a while ( which I can tell from the power LED blinks),
I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

Quoted 5 lines

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and Ubuntu 14.04 ( 3.13 kernel).
And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Sounds like your system does not support USB wakeup, which is very common, sorry.

good luck!

greg k-h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170831/190228e3/attachment.html

#4 lore raw
Quoted 6 lines · jingyun at cpu-os.ac.cn

Hi, Greg

Thanks for your time.
First of all, if I do NOT hit the keyboard during the suspend. Then my keyboard CAN wake the system up from suspend.
This has rule out that my system does NOT support USB wakeup. Right ?

I really do not know, sorry. Given taht suspend to ram go so fast, how do you know you are hitting the key "during" the suspend? It's an almost instantaneous process.

Check your bios settings about this, or, just don't touch the keyboard until you really do want to wake it up :)

good luck!

greg k-h

#5 lore raw

Hi,Greg

Thanks.
Yes, the suspending takes very litte time.
But the time ,which the suspending takes, has something to do with the hardware. Especially when you using an old mechanical hard disk or something like that.

how do you know you are hitting the key "during" the suspend?
And after notice the problem, I do some hack to confirm that it have to be during the suspending process:
Within funcion kernel/power/suspend.c (4.9 version kernel source)
static int suspend_enter(suspend_state_t state, bool *wakeup),
I added a line code
mdelay(5000);
just before
error = platform_suspend_prepare_late(state);
to increase the time window.
Then rebuild&install the kernel.
After the new kernel runs up, now much easier (we got about 5 seconds more) to reproduce the bug.

Thanks for your time.

Jim

From: Greg KH
Date: 2017-08-31 15:16
To: jingyun at cpu-os.ac.cn
CC: kernelnewbies
Subject: Re: Re: USB keyboard can NOT wakeup from S3( suspend to RAM )

Quoted 6 lines · jingyun at cpu-os.ac.cn

Hi, Greg

Thanks for your time.
First of all, if I do NOT hit the keyboard during the suspend. Then my keyboard CAN wake the system up from suspend.
This has rule out that my system does NOT support USB wakeup. Right ?

I really do not know, sorry. Given taht suspend to ram go so fast, how do you know you are hitting the key "during" the suspend? It's an almost instantaneous process.

Check your bios settings about this, or, just don't touch the keyboard until you really do want to wake it up :)

good luck!

greg k-h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170905/0133868c/attachment.html

#6 lore raw
In reply to jingyun at cpu-os.ac.cn
Quoted 9 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit the key of the USB interfaced keyboard; after making sure the box enter suspend state for a while ( which I can tell from the power LED blinks), I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard? And if it was suspended by from operating system or by pressing button on case wakeup by keyboard does work?

Quoted 8 lines

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and Ubuntu 14.04 ( 3.13 kernel). And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Thanks again.

Jim

Signature · 9 lines
Best regards,
Andrey Skvortsov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170830/4b721f02/attachment.bin 
#7 lore raw

Hi, Andrey

Q:
Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard?

Answer?
No.
Wakeup by keyboard doesn't work only if I pressing the keyboard (fast enough) during the suspend. It has nothing to do with suspending method.

Q:
And if it was suspended by from operating system or by pressing button on case wakeup by keyboard does work?

Answer:
The problem has nothing to do with suspending method.
Whatever the suspending method is( from desktop or echo mem > /sys/power/stat ), if I do NOT hit the keyboard during the suspend, then wakeup by keyboard does work.
But if I hit the keyboard fast enough during the suspend, then after the suspend the keyboard seems dead.
And wakeup by keyboard does NOT work any more.

Thanks for your time.

Jim

From: Andrey Skvortsov
Date: 2017-08-30 15:45
To: jingyun at cpu-os.ac.cn
CC: kernelnewbies
Subject: Re: USB keyboard can NOT wakeup from S3( suspend to RAM )

Quoted 9 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit the key of the USB interfaced keyboard; after making sure the box enter suspend state for a while ( which I can tell from the power LED blinks), I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it up by hitting the keyboard.

Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard? And if it was suspended by from operating system or by pressing button on case wakeup by keyboard does work?

Quoted 8 lines

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and Ubuntu 14.04 ( 3.13 kernel). And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Thanks again.

Jim

Signature · 5 lines
Best regards,
Andrey Skvortsov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170831/a2b7858e/attachment.html 
#8 lore raw

Am 31.08.2017 01:06 schrieb jingyun at cpu-os.ac.cn:

Quoted 26 lines

Hi, Andrey

Q:
Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard?

Answer?
No.
Wakeup by keyboard doesn't work only if I pressing the keyboard (fast enough) during the suspend.
It has nothing to do with suspending method.

Q:
And if it was suspended by from operating system or by pressing button on case wakeup by keyboard does work?

Answer:
The problem has nothing to do with suspending method. Whatever the suspending method is( from desktop or echo mem > /sys/power/stat ), if I do NOT hit the keyboard during the suspend, then
wakeup by keyboard does work.
But if I hit the keyboard fast enough during the suspend, then after the suspend the keyboard seems dead.
And wakeup by keyboard does NOT work any more.

Quoted 39 lines

Thanks for your time.

Jim

-------------------------

Quoted 33 lines

FROM: Andrey Skvortsov
DATE: 2017-08-30 15:45
TO: jingyun at cpu-os.ac.cn
CC: kernelnewbies
SUBJECT: Re: USB keyboard can NOT wakeup from S3( suspend to RAM )

Quoted 6 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit

the key of the USB interfaced keyboard;

Quoted 1 line

after making sure the box enter suspend state for a while ( which

I can tell from the power LED blinks),

Quoted 2 lines

I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it

up by hitting the keyboard.

Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard? And if it was suspended by from operating system or by pressing button
on case wakeup by keyboard does work?

Quoted 1 line

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and

Ubuntu 14.04 ( 3.13 kernel).

Quoted 5 lines

And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Thanks again.

Sounds like a bug. Doesn't *have* to be in the kernel though. At least it sounds like
pressing buttons "during" suspending resets a state to resumed before it actually
suspended - preventing to resume...

Is it an ordanary usb keyboard? Could you append the output of lsmod, the modules
you are using and lsusb?

#9 lore raw

Hi,Andrey

Thanks for your time.

Sorry, I have NOT given you guys info.

The lsmod command output is :

Module                  Size  Used by
nls_ascii              16384  1
nls_cp437              20480  1
vfat                   20480  1
fat                    69632  1 vfat
uas                    24576  0
usb_storage            73728  4 uas
fuse                   98304  7
evdev                  24576  8
pcspkr                 16384  0
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
serio_raw              16384  0
sg                     32768  0
ghash_clmulni_intel    16384  0
wmi                    16384  0
ac                     16384  0
button                 16384  0
video                  40960  0
acpi_cpufreq           20480  0
amdkfd                139264  1
radeon               1486848  3
ttm                    98304  1 radeon
drm_kms_helper        155648  1 radeon
drm                   360448  6 radeon,ttm,drm_kms_helper
i2c_algo_bit           16384  1 radeon
ip_tables              24576  0
x_tables               36864  1 ip_tables
ext4                  585728  1
crc16                  16384  1 ext4
jbd2                  106496  1 ext4
crc32c_generic         16384  0
fscrypto               28672  1 ext4
ecb                    16384  0
aesni_intel           167936  0
glue_helper            16384  1 aesni_intel
lrw                    16384  1 aesni_intel
gf128mul               16384  1 lrw
ablk_helper            16384  1 aesni_intel
cryptd                 24576  3 ablk_helper,ghash_clmulni_intel,aesni_intel
aes_x86_64             20480  1 aesni_intel
mbcache                16384  2 ext4
sd_mod                 45056  5
hid_generic            16384  0
usbhid                 53248  0
hid                   122880  2 hid_generic,usbhid
crc32c_intel           24576  2
psmouse               135168  0
xhci_pci               16384  0
xhci_hcd              188416  1 xhci_pci
ehci_pci               16384  0
ahci                   36864  1
libahci                32768  1 ahci
uhci_hcd               45056  0
libata                249856  2 ahci,libahci
ehci_hcd               81920  1 ehci_pci
usbcore               249856  8 usbhid,usb_storage,ehci_hcd,uhci_hcd,xhci_pci,uas,xhci_hcd,ehci_pci
scsi_mod              225280  5 sd_mod,usb_storage,libata,uas,sg
usb_common             16384  1 usbcore
r8169                  81920  0
mii                    16384  1 r8169

The output of lsub command :

Bus 008 Device 003: ID 0951:1666 Kingston Technology DataTraveler G4 Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 007: ID 0951:1624 Kingston Technology DataTraveler G2 Bus 005 Device 003: ID 05e3:0610 Genesys Logic, Inc. 4-port hub Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0461:4e04 Primax Electronics, Ltd
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

And also I would like to share some other info:
1 After trying some other more than10 different model USB keyboard , the problem always exists( PS2 keyboard/mouse do NOT have this problem); 2 The problem shows in other different machines(regular desktop machine);
3 The problem exists in linux; window 10 do NOT have it;
3 After adding some print info and delay( mdelay(5000); ) within kernel's suspending routine ( file:kernel/power/suspend.c
function: static int suspend_enter(suspend_state_t state, bool *wakeup)
where: just before error = platform_suspend_prepare_late(state);
) and make the kernel's loglevel to 8( console=ttyS0,115200n8 loglevel=8 no_console_suspend ) from the serial console,
I confirm that there is a time window during the suspending, within which any keypress or mouse press will cause the keyboard or mouse dead. I guess this has to do with kernel (maybe also BIOS).

Thanks again.

Jim

From: Martin Kepplinger
Date: 2017-09-05 14:32
To: jingyun
CC: Andrey Skvortsov; kernelnewbies
Subject: Re: Re: USB keyboard can NOT wakeup from S3( suspend to RAM ) Am 31.08.2017 01:06 schrieb jingyun at cpu-os.ac.cn:

Quoted 26 lines

Hi, Andrey

Q:
Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard?

Answer?
No.
Wakeup by keyboard doesn't work only if I pressing the keyboard (fast enough) during the suspend.
It has nothing to do with suspending method.

Q:
And if it was suspended by from operating system or by pressing button on case wakeup by keyboard does work?

Answer:
The problem has nothing to do with suspending method. Whatever the suspending method is( from desktop or echo mem > /sys/power/stat ), if I do NOT hit the keyboard during the suspend, then
wakeup by keyboard does work.
But if I hit the keyboard fast enough during the suspend, then after the suspend the keyboard seems dead.
And wakeup by keyboard does NOT work any more.

Quoted 39 lines

Thanks for your time.

Jim

-------------------------

Quoted 33 lines

FROM: Andrey Skvortsov
DATE: 2017-08-30 15:45
TO: jingyun at cpu-os.ac.cn
CC: kernelnewbies
SUBJECT: Re: USB keyboard can NOT wakeup from S3( suspend to RAM )

Quoted 6 lines · jingyun at cpu-os.ac.cn

hi, there

thx in advance;

I encounter a strange (maybe) bug:
During the suspending of my linux box(which runs debian 9), I hit

the key of the USB interfaced keyboard;

Quoted 1 line

after making sure the box enter suspend state for a while ( which

I can tell from the power LED blinks),

Quoted 2 lines

I can NOT wakeup it by hit that keyboard any more.
But if I do NOT hit the key during the suspending, I CAN wake it

up by hitting the keyboard.

Do you mean that wakeup by keyboard doesn't work only if PC was suspended by pressing special suspend key on your keyboard? And if it was suspended by from operating system or by pressing button
on case wakeup by keyboard does work?

Quoted 1 line

After that I tried Ubuntu 16.04(runs 4.4 version kernel ) and

Ubuntu 14.04 ( 3.13 kernel).

Quoted 5 lines

And I found all of them got the same problem;

Do not know if this is the right place to ask. Just a try.

Thanks again.

Sounds like a bug. Doesn't *have* to be in the kernel though. At least it sounds like
pressing buttons "during" suspending resets a state to resumed before it actually
suspended - preventing to resume...

Is it an ordanary usb keyboard? Could you append the output of lsmod, the modules
you are using and lsusb?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170905/dbe47a70/attachment-0001.html