# network & USB mouse connection drops w/state change of power

## duderonomy

[updated]

I am experiencing some issues that affect usability, on a new Gentoo install on a Lenovo T420 laptop. 

Otherwise, the installation feels very solid and is fast as anything I have used. 

I want to sort out a configuration issue. 

When I connect/disconnect the power adapter, 

both networking (eth0) and USB mouse stops working.

Within 2-4 seconds the functionality returns. 

How can I diagnose the cause of this or fix it? 

I think I am only running laptop-tools and cpufreqtools, now. 

Previously I had installed wpa_supplicant, ifplugd, wicd, etc. 

Cheers!

 :Very Happy: Last edited by duderonomy on Fri Apr 13, 2012 9:23 pm; edited 2 times in total

----------

## CrankyPenguin

Well to start with, have you installed any scripts that run on acpi events?  Anything that, for example, initiates a power saving mode?  

Some laptops and some laptop scripts engage power saving features for various devices such as the disks (spinning them down), the lcd panel (dimming), and even network connections (powering down or off) when the laptop goes to battery or to a low-power state.  It sounds to me like this is what is happening, perhaps through ifplugd.

I would start by going to dmesg and seeing if there are any events that appear in your logs when you switch to battery mode.  Any messages such as "signal low state" might be meaningful.  

I would also check the configurations for ifplugd and wicd to see if either one tries to set eth0 to a low power or power-save state.  Either one might be causing a crisis for your laptop.

----------

## duderonomy

Thank you for the useful feedback...

I did not realize a userland utility that I installed and may have mis- (or not) configured 

could be bringing down the interface for my convenience when touch the power connection.  :Smile: 

Well, I could start over and then  re-evaluate. 

Could any readers with a functional Linux OS laptop recommend the 

minimal set of acpi related utilities, that I need? 

My goal is for the laptop to switch network interfaces automatically, placing a priority 

on wired interface. You know, just like a Mac.  :Smile: 

Thx!

 :Very Happy: 

----------

## WvR

Check out NetworkManager (net-misc/networkmanager). It manages all interfaces and places emphasis on wired connections if available. 

As for ACPI: I have a Lenovo Thinkpad with the normal acpid and laptop-mode-tools (app-laptop/laptop-mode-tools) which takes care of most of the power management via a daemon (/etc/init.d/laptop_mode). For the CPU I use cpufrequtils.

----------

## duderonomy

Thanks for the questions CrankyPenguin...

AFAIK, I have not installed any program that initiate a power saving mode. (not sure)

I removed ifplugd and wicd.

Thanks to everyone too! 

I read everyone's replies and did more reading based on all comments.  :Smile: 

Thx!

And here's a log... evidently I need to handle these HKEY events, somehow... 

```
Apr 13 12:36:16 localhost nobody: ACPI event unhandled: ac_adapter AC 00000080 00000000

Apr 13 12:36:16 localhost kernel: [375271.481187] ata1.00: configured for UDMA/133

Apr 13 12:36:16 localhost kernel: [375271.481192] ata1: EH complete

Apr 13 12:36:16 localhost kernel: [375271.481280] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA

Apr 13 12:36:16 localhost laptop-mode: Laptop mode 

Apr 13 12:36:16 localhost laptop-mode: enabled, active

Apr 13 12:36:16 localhost kernel: [375271.533388] thinkpad_acpi: unknown possible thermal alarm or keyboard event received

Apr 13 12:36:16 localhost kernel: [375271.533393] thinkpad_acpi: unhandled HKEY event 0x6040

Apr 13 12:36:16 localhost kernel: [375271.533395] thinkpad_acpi: please report the conditions when this event happened to ibm-acpi-devel@lists.sourceforge.net

Apr 13 12:36:16 localhost kernel: [375271.533705] thinkpad_acpi: EC reports that Thermal Table has changed

Apr 13 12:36:16 localhost dhcpcd[3496]: eth0: carrier lost

Apr 13 12:36:16 localhost ntpd[6480]: ntpd exiting on signal 15

Apr 13 12:36:16 localhost start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user nobody by (uid=0)

Apr 13 12:36:16 localhost ntpd[6701]: ntpd 4.2.6p3@1.2290-o Fri Mar 16 20:44:55 UTC 2012 (1)

Apr 13 12:36:16 localhost ntpd[6702]: proto: precision = 0.107 usec

Apr 13 12:36:16 localhost ntpd[6702]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123

Apr 13 12:36:16 localhost ntpd[6702]: Listen and drop on 1 v6wildcard :: UDP 123

Apr 13 12:36:16 localhost ntpd[6702]: Listen normally on 2 lo 127.0.0.1 UDP 123

Apr 13 12:36:16 localhost ntpd[6702]: Listen normally on 3 eth0 fe80::221:ccff:fe6e:5b50 UDP 123

Apr 13 12:36:16 localhost ntpd[6702]: Listen normally on 4 lo ::1 UDP 123

Apr 13 12:36:16 localhost ntpd[6702]: peers refreshed

Apr 13 12:36:16 localhost ntpd[6702]: Listening on routing socket on fd #21 for interface updates

Apr 13 12:36:16 localhost ntpd[6702]: Deferring DNS for 0.gentoo.pool.ntp.org 1

Apr 13 12:36:16 localhost ntpd[6702]: Deferring DNS for 1.gentoo.pool.ntp.org 1

Apr 13 12:36:16 localhost ntpd[6702]: Deferring DNS for 2.gentoo.pool.ntp.org 1

Apr 13 12:36:16 localhost ntpd[6702]: Deferring DNS for 3.gentoo.pool.ntp.org 1

Apr 13 12:36:16 localhost ntpd[6710]: signal_no_reset: signal 17 had flags 4000000

Apr 13 12:36:17 localhost kernel: [375272.264755] usb 1-1.1: usb auto-suspend, wakeup 0

Apr 13 12:36:17 localhost kernel: [375272.284403] usb 1-1.4: usb auto-suspend, wakeup 0

Apr 13 12:36:17 localhost kernel: [375272.316357] usb 1-1.6: usb auto-suspend, wakeup 0

Apr 13 12:36:17 localhost nobody: ACPI event unhandled: ibm/hotkey HKEY 00000080 00006040

Apr 13 12:36:17 localhost nobody: ACPI event unhandled: ibm/hotkey HKEY 00000080 00006030

Apr 13 12:36:17 localhost nobody: ACPI event unhandled: thermal_zone THM0 00000081 00000000

Apr 13 12:36:17 localhost nobody: ACPI event unhandled: battery BAT0 00000080 00000001

Apr 13 12:36:17 localhost laptop-mode: Laptop mode 

Apr 13 12:36:17 localhost laptop-mode: enabled, 

Apr 13 12:36:17 localhost laptop-mode: active [unchanged]

Apr 13 12:36:17 localhost nobody: ACPI event unhandled: battery BAT0 00000080 00000001

Apr 13 12:36:17 localhost laptop-mode: Laptop mode 

Apr 13 12:36:17 localhost laptop-mode: enabled, 

Apr 13 12:36:17 localhost laptop-mode: active [unchanged]

Apr 13 12:36:18 localhost ntpd_intres[6710]: host name not found: 0.gentoo.pool.ntp.org

Apr 13 12:36:18 localhost ntpd_intres[6710]: host name not found: 1.gentoo.pool.ntp.org

Apr 13 12:36:18 localhost ntpd_intres[6710]: host name not found: 2.gentoo.pool.ntp.org

Apr 13 12:36:18 localhost ntpd_intres[6710]: host name not found: 3.gentoo.pool.ntp.org

Apr 13 12:36:19 localhost kernel: [375274.323812] hub 1-1:1.0: hub_suspend

Apr 13 12:36:19 localhost kernel: [375274.323827] usb 1-1: unlink qh256-0001/ffff880117921b00 start 1 [1/0 us]

Apr 13 12:36:19 localhost kernel: [375274.324100] usb 1-1: usb auto-suspend, wakeup 1

Apr 13 12:36:20 localhost kernel: [375275.348020] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx

Apr 13 12:36:20 localhost dhcpcd[3496]: eth0: carrier acquired

Apr 13 12:36:20 localhost dhcpcd[3496]: eth0: rebinding lease of 10.7.100.153

Apr 13 12:36:20 localhost dhcpcd[3496]: eth0: acknowledged 10.7.100.153 from 10.7.0.5

Apr 13 12:36:20 localhost dhcpcd[3496]: eth0: checking for 10.7.100.153

Apr 13 12:36:21 localhost kernel: [375276.266902] usb 2-1.2: unlink qh8-0e01/ffff8800d66f8c00 start 4 [1/2 us]

Apr 13 12:36:21 localhost kernel: [375276.267663] usb 2-1.2: usb auto-suspend, wakeup 1

Apr 13 12:36:21 localhost kernel: [375276.331786] hub 1-0:1.0: hub_suspend

Apr 13 12:36:21 localhost kernel: [375276.331797] usb usb1: bus auto-suspend, wakeup 1

Apr 13 12:36:21 localhost kernel: [375276.331800] ehci_hcd 0000:00:1a.0: suspend root hub

Apr 13 12:36:21 localhost kernel: [375276.342769] ehci_hcd 0000:00:1a.0: PCI INT A disabled

Apr 13 12:36:21 localhost kernel: [375276.342774] ehci_hcd 0000:00:1a.0: hcd_pci_runtime_suspend: 0

Apr 13 12:36:21 localhost kernel: [375276.342836] ehci_hcd 0000:00:1a.0: PME# enabled

Apr 13 12:36:21 localhost kernel: [375276.353760] ehci_hcd 0000:00:1a.0: power state changed by ACPI to D3

Apr 13 12:36:21 localhost ntpd_intres[5264]: parent died before we finished, exiting

Apr 13 12:36:23 localhost kernel: [375278.274880] hub 2-1:1.0: hub_suspend

Apr 13 12:36:23 localhost kernel: [375278.274900] usb 2-1: unlink qh256-0001/ffff880118cc6680 start 1 [1/0 us]

Apr 13 12:36:23 localhost kernel: [375278.275058] usb 2-1: usb auto-suspend, wakeup 1

Apr 13 12:36:25 localhost kernel: [375280.282881] hub 2-0:1.0: hub_suspend

Apr 13 12:36:25 localhost kernel: [375280.282900] usb usb2: bus auto-suspend, wakeup 1

Apr 13 12:36:25 localhost kernel: [375280.282906] ehci_hcd 0000:00:1d.0: suspend root hub

Apr 13 12:36:25 localhost kernel: [375280.293874] ehci_hcd 0000:00:1d.0: PCI INT A disabled

Apr 13 12:36:25 localhost kernel: [375280.293883] ehci_hcd 0000:00:1d.0: hcd_pci_runtime_suspend: 0

Apr 13 12:36:25 localhost kernel: [375280.293966] ehci_hcd 0000:00:1d.0: PME# enabled

Apr 13 12:36:25 localhost kernel: [375280.304857] ehci_hcd 0000:00:1d.0: power state changed by ACPI to D3

Apr 13 12:36:25 localhost dhcpcd[3496]: eth0: leased 10.7.100.153 for 1209600 seconds

Apr 13 12:36:25 localhost ntpd[6702]: ntpd exiting on signal 15

Apr 13 12:36:25 localhost start-stop-daemon: pam_unix(start-stop-daemon:session): session opened for user nobody by (uid=0)

Apr 13 12:36:25 localhost ntpd[7230]: ntpd 4.2.6p3@1.2290-o Fri Mar 16 20:44:55 UTC 2012 (1)

Apr 13 12:36:25 localhost ntpd[7231]: proto: precision = 0.111 usec

Apr 13 12:36:25 localhost ntpd[7231]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: Listen and drop on 1 v6wildcard :: UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: Listen normally on 2 lo 127.0.0.1 UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: Listen normally on 3 eth0 10.7.100.153 UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: Listen normally on 4 eth0 fe80::221:ccff:fe6e:5b50 UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: Listen normally on 5 lo ::1 UDP 123

Apr 13 12:36:25 localhost ntpd[7231]: peers refreshed

Apr 13 12:36:25 localhost ntpd[7231]: Listening on routing socket on fd #22 for interface updates

Apr 13 12:36:35 localhost ntpd_intres[5990]: parent died before we finished, exiting

Apr 13 12:36:48 localhost ntpd_intres[6710]: parent died before we finished, exiting

```

----------

## duderonomy

after more reading and looking at my system, 

I realize that I am running both laptop-mode-tools and pm-utils. 

I read that interactions can occur. 

After setting CONTROL_ETHERNET="0" (from "auto")

this seems to have helped a lot. 

I have not read enough about power management to know which

package or collection of packages yields a quality User experience 

without surprises. 

cheers!

 :Very Happy: 

----------

## duderonomy

Is it necessary to have both upower and pm-utils?

I was thinking to remove pm-utils; to see if upower will handle things.

----------

