These are adjustments needed in order for the type cover to work properly:
ATTR -> ATTRS
SUBSYSTEMS -> SUBSYSTEM
{iProduct} -> {product}
The initial sleep command was causing things to not work, so this was removed as well.
If bluetooth is disabled in the BIOS, the bluetoothd process won't be
running. bluetoothctl waits for that process to launch, which means it
timeouts indefinitly, breaking suspend entirely.
By checking if bluetoothd is running before calling bluetoothctl suspend
works fine even if bluetooth is disabled in the BIOS.
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
By using nmcli, users who don't use a systemd based distribution (Gentoo etc.),
can run the sleep script manually, or hook it up to their service manager manually.
This also removes the forced restart if people willingly disabled NetworkManager.
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
On Surface Book 2 it is not possible to archive stable S0ix while bluetooth is
enabled but no device is connected. Either S0ix fails completely, or the
residency is pretty bad. When bluetooth is disabled, or a device such as the pen
is connected, S0ix works fine and residency is great again.
By disabling bluetooth when no device is connected, we get proper S0ix in all
situations. And since no device is connected, the reset won't really matter.
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Using the old script I regulary had the problem, that after resuming
from suspend (or hibernate) the wifi would just break. The only way
to fix it was to restart network manager, or disable it in the GNOME
network settings.
I am not a 100% sure *why*, but this change greatly improved the wifi
stability after resume. I am running this for like 5 days now and
didn't see the wifi breaking once. I suppose, that `modprobe` vs
`modprobe -i` is what makes the difference.
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Integrate the changes discussed in [1] as proposed by @kitakar5525 in
[2]. The IPTS suspend/resume mechanism should work without the need for
unloading/reloading the corresponding modules, so we comment-out and
update the workaround and will handle any issues coming from that via
the IPTS drivers. The workaround is not completely removed yet as want
to provide an easy-to-apply temporary fix in case anything goes wrong.
[1]: https://github.com/jakeday/linux-surface/issues/544
[2]: https://github.com/jakeday/linux-surface/issues/544#issuecomment-519126757