New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dell XPS 15 9550] Mode won't switch to ac #362

Open
yaronsumel opened this Issue Sep 4, 2018 · 26 comments

Comments

Projects
None yet
3 participants
@yaronsumel
Copy link

yaronsumel commented Sep 4, 2018

Symptom data

  1. Does the problem occur on battery or AC or both?
    AC
  2. Attach the full output of tlp-stat via https://gist.github.com/ for all cases of 1.
    https://gist.github.com/yaronsumel/3b3194b1ffb08f8d8425566a653a2131

Expected behavior

when laptop is plugged in again to AC the mode stays battery

Actual behavior

Should have switched to AC

Steps to reproduce the problem

plug the laptop to ac

@yaronsumel

This comment has been minimized.

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Sep 10, 2018

Maybe your charger isn't detected properly. Please show the output of

tlp-stat --psup

with AC connected.

Then show the corresponding output of

tlp-stat --pev

when

  1. disconnecting AC
  2. connecting AC
@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Sep 14, 2018

@linrunner It was reproduce-able really easy about week ago.. at this moment after updating to kernel 4.18.7 it seems fine.. will update the ticket with more info if its back. so far its ok :) thanks for tlp ..great work.

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 22, 2018

@linrunner the problem is happening again.

battery -> ac

$ sudo tlp-stat --pev
--- TLP 1.1 --------------------------------------------

+++ Monitor power supply events -- cancel with ^C

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [1948.314120] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=73
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5260000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12836000
SEQNUM=20254
SUBSYSTEM=power_supply
USEC_INITIALIZED=1948272839


UDEV  [1956.920625] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=73
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5259000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12229000
SEQNUM=20287
SUBSYSTEM=power_supply
USEC_INITIALIZED=1956886422

UDEV  [1959.933309] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=73
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5259000
POWER_SUPPLY_CURRENT_NOW=1000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12221000
SEQNUM=20320
SUBSYSTEM=power_supply
USEC_INITIALIZED=1959908302

ac -> battery -> ac

UDEV  [2084.790358] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=75
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5394000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12914000
SEQNUM=21089
SUBSYSTEM=power_supply
USEC_INITIALIZED=2084748861

UDEV  [2090.666023] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=75
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5395000
POWER_SUPPLY_CURRENT_NOW=1000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12322000
SEQNUM=21122
SUBSYSTEM=power_supply
USEC_INITIALIZED=2090641228

UDEV  [2093.714228] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=75
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5395000
POWER_SUPPLY_CURRENT_NOW=1000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12312000
SEQNUM=21123
SUBSYSTEM=power_supply
USEC_INITIALIZED=2093687758

Mode: battery

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 22, 2018

And after reboot

--- TLP 1.1 --------------------------------------------

+++ Monitor power supply events -- cancel with ^C

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [30.328578] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=80
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5698000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12960000
SEQNUM=6954
SUBSYSTEM=power_supply
USEC_INITIALIZED=30279084

UDEV  [30.768434] change   /devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC
POWER_SUPPLY_NAME=AC
POWER_SUPPLY_ONLINE=0
SEQNUM=6953
SUBSYSTEM=power_supply
USEC_INITIALIZED=30237181

UDEV  [42.130443] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=80
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5697000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Unknown
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12344000
SEQNUM=7091
SUBSYSTEM=power_supply
USEC_INITIALIZED=42114737

UDEV  [42.553632] change   /devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC
POWER_SUPPLY_NAME=AC
POWER_SUPPLY_ONLINE=1
SEQNUM=7090
SUBSYSTEM=power_supply
USEC_INITIALIZED=42093006

UDEV  [45.002837] change   /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
ACTION=change
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
POWER_SUPPLY_CAPACITY=80
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_CHARGE_FULL=7112000
POWER_SUPPLY_CHARGE_FULL_DESIGN=7368000
POWER_SUPPLY_CHARGE_NOW=5697000
POWER_SUPPLY_CURRENT_NOW=1000
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_MANUFACTURER=SMP
POWER_SUPPLY_MODEL_NAME=DELL 1P6KD5A
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_SERIAL_NUMBER=795
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_TECHNOLOGY=Li-poly
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=11400000
POWER_SUPPLY_VOLTAGE_NOW=12418000
SEQNUM=7092
SUBSYSTEM=power_supply
USEC_INITIALIZED=44992987

correct Mode: AC

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 23, 2018

@linrunner so I have been managed to reproduce that time after time now. If laptop booted-up with AC connected it will work correctly and if laptop booted-up while on battery the mode will always stays battery

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 23, 2018

@linrunner probably related to #343

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Oct 24, 2018

TLP cant't work properly without AC events like this

UDEV  [42.553632] change   /devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0003:00/power_supply/AC (power_supply)
ACTION=change

Maybe a BIOS issue. Is it at the latest version?

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 24, 2018

@linrunner Bios/Kernel/Os on latest. What if TLP would have depend on power_supply/BAT* and POWER_SUPPLY_STATUS=Charging

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Oct 24, 2018

Batteries are not always charging when AC is plugged in. So this is not enough to distinguish between AC and BAT safely.

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 24, 2018

IMO charged status and ac online=1 should have AC mode as well ... How about manual fallback when unrecognized ?

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 24, 2018

@linrunner ended up with these rules.. seems to work. anything else to add here ?

ACTION=="change", SUBSYSTEM=="power_supply", ATTR{status}=="Unknown", RUN+="/usr/sbin/tlp ac"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{status}=="Full", RUN+="/usr/sbin/tlp ac"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{status}=="Charging", RUN+="/usr/sbin/tlp ac"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", RUN+="/usr/sbin/tlp bat"
@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Oct 27, 2018

So I guess AC is present, only the event is missing for your laptop. To be sure, please show after booting on BAT and AC plugged afterwards:

tlp-stat --pev
@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 28, 2018

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Oct 28, 2018

Sorry, I meant

tlp-stat --psup
@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Oct 28, 2018

booted with battery
--- TLP 1.1 --------------------------------------------

+++ Power supply diagnostic
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/device/path:_SB_.BAT0

booted with ac
--- TLP 1.1 --------------------------------------------

+++ Power supply diagnostic
/sys/class/power_supply/AC/type:Mains
/sys/class/power_supply/AC/online:1
/sys/class/power_supply/AC/device/path:_SB_.AC__
/sys/class/power_supply/BAT0/type:Battery
/sys/class/power_supply/BAT0/present:1
/sys/class/power_supply/BAT0/device/path:_SB_.BAT0

@rducom

This comment has been minimized.

Copy link

rducom commented Nov 5, 2018

I have the same symptoms, sometimes it works, sometimes not. Same missing AC udev event when it doesn't works. (plug the battery, and only a BAT event). But it "seems" resolved since I sudo apt install acpitool.

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Nov 6, 2018

@rducom already installed.. but thanks :)

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Nov 6, 2018

@yaronsumel : ok, not what I hoped to see when booted on bat.

You may very well keep your rules as a local workaround. They're however not suitable for production code.

@rducom

This comment has been minimized.

Copy link

rducom commented Nov 7, 2018

Problem is back on my side... so sorry for the noise, installing acpitool didn't resolve the pb

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Nov 7, 2018

@linrunner sure.. anything that I've missed in those rules ? and @rducom well .. just apply these rules

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Nov 12, 2018

@yaronsumel : your rules are ok, but they don't cover all cases. Resume after Suspend (tlp resume), System startup (tlp init start) and a simple tlp start require a reliable AC detection without udev power supply events.

@linrunner linrunner added the won't fix label Nov 12, 2018

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Nov 12, 2018

EDIT: this is not a kernel bug. See below.

@linrunner linrunner changed the title Mode won't switch to ac [Dell XPS 15 9550] Mode won't switch to ac Dec 9, 2018

@linrunner linrunner closed this Dec 9, 2018

@linrunner linrunner added the duplicate label Dec 9, 2018

@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Dec 9, 2018

Duplicate of #223 . See the FAQ.

linrunner added a commit that referenced this issue Jan 13, 2019

linrunner added a commit that referenced this issue Jan 18, 2019

Issue #343, #362, #375: circumvent broken AC/charger detection.
Rationale: some systems only recognize the ACPI mains device when
plugged in during boot or not at all. This is a firmware bug.

Solution: treat battery status "Discharging" as battery mode and
everything else except "Unknown" as AC, but don't stop looking
for AC.

References:
* #343
* #362
* #375
@linrunner

This comment has been minimized.

Copy link
Owner

linrunner commented Jan 18, 2019

Hi @yaronsumel ,

I guess I have a proper solution now. Could you please test with the master branch? Without your custom rules of course.

@linrunner linrunner reopened this Jan 18, 2019

@linrunner linrunner added fix committed and removed won't fix labels Jan 18, 2019

@yaronsumel

This comment has been minimized.

Copy link

yaronsumel commented Jan 20, 2019

@linrunner First of all thanks for the wonderful work you putting in this project 🥇 . Sure ill check it against master and report results back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment