Usb-moded with enabled USB tethering blocks sleep/suspend

Hi,

About a year ago, I turned USB tethering on using this https://jolla.zendesk.com/hc/en-us/articles/203548266#usb guide. I used it just for a few hours and forgot about it.

But some time ago, I noticed that my phone is not going to sleep anymore.
After a few attempts to find out the reason, I managed to solve this mystery today. Looks like usb-moded-connection-sharing-android-connman-config blocks entering the sleep state.
Removing the package and restarting the USB-mode daemon did the trick.

Not sure if this is worth issuing a BUG report, but I want to help others trying to save battery life.

1 Like

Always file a bug report with something like this. If it should be automated, works sometimes automated and other times not, then it’s a bug.

I am using internet via USB.

Can you explain how you found that out? I’d like to make sure this isn’t happening for me.

I started with mumbo-jumbo with ps and various stats, but what really gave me the clue was looking at /sys/kernel/debug/wakeup_lock.
I found usb_moded_state there, and pkcon search usb reminded me of usb tethering I’ve enabled once. After I removed the package installed for tethering, sleep states appeared again.

Strange, I am currently connected and do not see this file:

ll /sys/kernel/debug/wake*
-r--r--r--    1 root     root           0 Jan  1  1970 /sys/kernel/debug/wakeup_sources

What do you think the file /sys/kernel/debug/wakeup_lock does?

And what exactly do you mean by ā€œsleep states appeared againā€? Appeared where?

Just to be clear, I presume that by sleep you mean something deeper than just screen off.

Yes, by ā€˜sleep’ state, I mean the processor’s mode that indicates it does nothing (with no or minimal power draw, called idle states or C-states) and waits for an action/interrupt to wake it up. Some processes request an instant processor reaction and prevent the CPU from going to sleep, as going out of sleep takes some time.

Regarding how to observe whether CPU goes to sleep or not, use SysMon (available on OpenRepos) and/or SystemDataScope (Chum) (see Monitor CPU usage overnight for screenshots and more info).

If your /sys/kernel/debug does not have wake_lock/unlock files, kernel is not configured with CONFIG_PM_WAKELOCKS enabled.