Missing Setting to set battery charge limit

Hi,

Lately I’ve been seeing that Battery charging limit setting in KDE plasma does not persist, so I tried the solution present in this link: https://forum.manjaro.org/t/laptop-battery-charging-limit/138704

The basic gist of it was to create a systemd service that manually sets the value in sys/class/power_supply/BAT1/charge_control_end_threshold on boot. This solution had been working fine until I installed tuf-manager from AUR and uninstalled it since it wasn’t able to set the inbuilt keyboard RGB modes.

Currently, the file sys/class/power_supply/BAT1/charge_control_end_threshold is missing and I’m unable to create it even as root. The setting to set charge limit is missing even from plasma settings.

Pls help out

If it’s missing, creating it would be useless. The file should be present if the property is detected in the first place. Check first what you have in /sys/class/power_supply (i.e.: ls /sys/class/power_supply). BAT1 is rather strange, unless your device has 2 batteries as the counting starts from 0.

ls /sys/class/power_supply yields the following output:

ACAD  BAT1

It is kinda strange, but that wouldn’t make the charge_control_end_threshold to disappear.
ls /sys/class/power_supply/BAT1 gives this output:

alarm     capacity_level  charge_full_design  current_now  device  manufacturer  power    serial_number  subsystem   type    voltage_min_design
capacity  charge_full     charge_now          cycle_count  hwmon2  model_name    present  status         technology  uevent  voltage_now

Welcome to the forum! :wave:

Either your laptop manufacturer included battery charging limit support or they didn’t. If it does, then it’s up to the kernel to detect it. Nothing to do with the Desktop Environment.

Please post your system info as outlined here:

Please also see:

What’s the output of:

 ls /sys/class/power_supply/BAT1 | grep charge

If there is support, then you should see output like I see on my System76 Gazelle (gaze17-3060-b) :

charge_control_end_threshold
charge_control_start_threshold
charge_full
charge_full_design
charge_now

Pulled system information using the inxi -v7azy command. It’s output is as follows:

System:
  Kernel: 6.1.31-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1-x86_64
    root=UUID=c7a59d06-b0cc-41da-beb5-2288d0a7c2f3 rw quiet splash
    udev.log_priority=3
  Desktop: KDE Plasma v: 5.27.5 tk: Qt v: 5.15.9 wm: kwin_x11 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: ASUS TUF Gaming A15 FA506QM_FA506QM
    v: 1.0 serial: <filter>
  Mobo: ASUSTeK model: FA506QM v: 1.0 serial: <filter> UEFI: American
    Megatrends LLC. v: FA506QM.314 date: 01/07/2023
Battery:
  ID-1: BAT1 charge: 86.2 Wh (100.0%) condition: 86.2/90.2 Wh (95.5%)
    volts: 17.3 min: 15.9 model: ASUS A32-K55 type: Li-ion serial: N/A
    status: full
Memory:
  System RAM: available: 15.03 GiB used: 13.08 GiB (87.0%)
  Array-1: capacity: 32 GiB slots: 2 EC: None max-module-size: 16 GiB
    note: est.
  Device-1: DIMM 0 type: DDR4 detail: synchronous unbuffered (unregistered)
    size: 8 GiB speed: 3200 MT/s volts: curr: 1.2 min: 1.2 max: 1.2 width (bits):
    data: 64 total: 64 manufacturer: Micron Technology
    part-no: 8ATF1G64HZ-3G2R1 serial: <filter>
  Device-2: DIMM 0 type: DDR4 detail: synchronous unbuffered (unregistered)
    size: 8 GiB speed: 3200 MT/s volts: curr: 1.2 min: 1.2 max: 1.2 width (bits):
    data: 64 total: 64 manufacturer: Micron Technology
    part-no: 8ATF1G64HZ-3G2R1 serial: <filter>
CPU:
  Info: model: AMD Ryzen 9 5900HX with Radeon Graphics socket: FP6 bits: 64
    type: MT MCP arch: Zen 3 gen: 4 level: v3 note: check built: 2021-22
    process: TSMC n7 (7nm) family: 0x19 (25) model-id: 0x50 (80) stepping: 0
    microcode: 0xA50000C
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 16 MiB
    desc: 1x16 MiB
  Speed (MHz): avg: 1593 high: 3300 min/max: 1200/4679 boost: enabled
    base/boost: 3300/4650 scaling: driver: acpi-cpufreq governor: schedutil
    volts: 1.2 V ext-clock: 100 MHz cores: 1: 3300 2: 1200 3: 1200 4: 1200
    5: 3300 6: 1200 7: 1200 8: 3300 9: 1200 10: 1200 11: 1200 12: 1200 13: 1200
    14: 1200 15: 1200 16: 1200 bogomips: 105453
  Flags: 3dnowprefetch abm adx aes aperfmperf apic arat avic avx avx2 bmi1
    bmi2 bpext cat_l3 cdp_l3 clflush clflushopt clwb clzero cmov cmp_legacy
    constant_tsc cpb cppc cpuid cqm cqm_llc cqm_mbm_local cqm_mbm_total
    cqm_occup_llc cr8_legacy cx16 cx8 de decodeassists erms extapic
    extd_apicid f16c flushbyasid fma fpu fsgsbase fsrm fxsr fxsr_opt ht
    hw_pstate ibpb ibrs ibs invpcid irperf lahf_lm lbrv lm mba mca mce
    misalignsse mmx mmxext monitor movbe msr mtrr mwaitx nonstop_tsc nopl npt
    nrip_save nx ospke osvw overflow_recov pae pat pausefilter pclmulqdq
    pdpe1gb perfctr_core perfctr_llc perfctr_nb pfthreshold pge pku pni popcnt
    pse pse36 rapl rdpid rdpru rdrand rdseed rdt_a rdtscp rep_good sep sha_ni
    skinit smap smca smep ssbd sse sse2 sse4_1 sse4_2 sse4a ssse3 stibp succor
    svm svm_lock syscall tce topoext tsc tsc_scale umip v_spec_ctrl
    v_vmsave_vmload vaes vgif vmcb_clean vme vmmcall vpclmulqdq wbnoinvd wdt
    xgetbv1 xsave xsavec xsaveerptr xsaveopt xsaves
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] vendor: ASUSTeK
    driver: nvidia v: 530.41.03 alternate: nouveau,nvidia_drm non-free: 530.xx+
    status: current (as of 2023-05) arch: Ampere code: GAxxx
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 1 speed: 2.5 GT/s lanes: 8
    link-max: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 01:00.0
    chip-ID: 10de:2520 class-ID: 0300
  Device-2: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    vendor: ASUSTeK driver: amdgpu v: kernel arch: GCN-5 code: Vega
    process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s ports: active: eDP-1 empty: HDMI-A-1
    bus-ID: 05:00.0 chip-ID: 1002:1638 class-ID: 0300 temp: 54.0 C
  Device-3: Sonix USB2.0 HD UVC WebCam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-4:4 chip-ID: 322e:202c
    class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.1
    compositor: kwin_x11 driver: X: loaded: amdgpu,nvidia
    unloaded: modesetting,nouveau alternate: fbdev,nv,vesa dri: radeonsi
    gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: eDP-1 mapped: eDP model: Najing CEC Panda 0x004d built: 2019
    res: 1920x1080 hz: 144 dpi: 142 gamma: 1.2 size: 344x194mm (13.54x7.64")
    diag: 395mm (15.5") ratio: 16:9 modes: max: 1920x1080 min: 640x480
  API: OpenGL v: 4.6 Mesa 23.0.4 renderer: AMD Radeon Graphics (renoir LLVM
    15.0.7 DRM 3.49 6.1.31-2-MANJARO) direct-render: Yes
Audio:
  Device-1: NVIDIA GA106 High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 8
    link-max: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 01:00.1
    chip-ID: 10de:228e class-ID: 0403
  Device-2: AMD Renoir Radeon High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 05:00.1 chip-ID: 1002:1637
    class-ID: 0403
  Device-3: AMD ACP/ACP3X/ACP6x Audio Coprocessor driver: N/A
    alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_pci_acp6x,
    snd_acp_pci, snd_rpl_pci_acp6x, snd_pci_ps, snd_sof_amd_renoir,
    snd_sof_amd_rembrandt pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 05:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-4: AMD Family 17h/19h HD Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 05:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.1.31-2-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl
  Server-2: JACK v: 1.9.22 status: off tools: N/A
  Server-3: PipeWire v: 0.3.70 status: n/a (root, process) with: wireplumber
    status: active tools: pw-cli,wpctl
  Server-4: PulseAudio v: 16.1 status: active (root, process)
    with: pulseaudio-alsa type: plugin tools: pacat,pactl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: e000 bus-ID: 02:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp2s0 state: down mac: <filter>
  Device-2: MEDIATEK MT7921 802.11ax PCI Express Wireless Network Adapter
    vendor: AzureWave driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
    lanes: 1 bus-ID: 03:00.0 chip-ID: 14c3:7961 class-ID: 0280
  IF: wlp3s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: IMC Networks Wireless_Device driver: btusb v: 0.8 type: USB
    rev: 2.1 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-3:3 chip-ID: 13d3:3563
    class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 1 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 1.38 TiB used: 153.74 GiB (10.9%)
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVLQ512HBLU-00B00
    size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: FXM7201Q temp: 31.9 C
    scheme: GPT
  SMART: yes health: PASSED on: 15d 3h cycles: 1,065
    read-units: 8,512,737 [4.35 TB] written-units: 5,728,168 [2.93 TB]
  ID-2: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD10SPZX-24Z10
    family: Blue Mobile (SMR) size: 931.51 GiB block-size: physical: 4096 B
    logical: 512 B type: USB rev: 2.1 spd: 480 Mb/s lanes: 1 mode: 2.0
    sata: 3.1 speed: 6.0 Gb/s tech: HDD rpm: 5400 serial: <filter> fw-rev: 1214
    drive-rev: 05.01A05 temp: 37 C scheme: GPT
  SMART: yes state: enabled health: PASSED on: 210d 23h cycles: 1673 Old-Age:
    UDMA CRC errors: 934 alert: Bad cable/connection?
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 46.83 GiB size: 45.79 GiB (97.79%) used: 26.36 GiB (57.6%)
    fs: ext4 block-size: 4096 B dev: /dev/sda4 maj-min: 8:4 label: man-root
    uuid: c7a59d06-b0cc-41da-beb5-2288d0a7c2f3
  ID-2: /boot/efi raw-size: 2 GiB size: 2 GiB (99.80%) used: 288 KiB (0.0%)
    fs: vfat block-size: 512 B dev: /dev/sda5 maj-min: 8:5 label: N/A
    uuid: B039-A6FC
  ID-3: /run/media/darshk/Data raw-size: 244.14 GiB
    size: 244.14 GiB (100.00%) used: 127.38 GiB (52.2%) fs: ntfs
    block-size: 4096 B dev: /dev/nvme0n1p4 maj-min: 259:4 label: Data
    uuid: 863608C43608B769
Swap:
  Alert: No swap data was found.
Unmounted:
  ID-1: /dev/nvme0n1p1 maj-min: 259:1 size: 260 MiB fs: vfat label: SYSTEM
    uuid: 088D-2880
  ID-2: /dev/nvme0n1p2 maj-min: 259:2 size: 16 MiB fs: N/A label: N/A
    uuid: N/A
  ID-3: /dev/nvme0n1p3 maj-min: 259:3 size: 209.55 GiB fs: ntfs label: OS
    uuid: BC748F21748EDD90
  ID-4: /dev/nvme0n1p5 maj-min: 259:5 size: 800 MiB fs: ntfs label: RECOVERY
    uuid: 20AAC624AAC5F5F6
  ID-5: /dev/nvme0n1p6 maj-min: 259:6 size: 22 GiB fs: ntfs label: RESTORE
    uuid: 2E86234786230EC1
  ID-6: /dev/nvme0n1p7 maj-min: 259:7 size: 200 MiB fs: vfat label: MYASUS
    uuid: 3E23-8D8B
  ID-7: /dev/sda1 maj-min: 8:1 size: 634.95 GiB fs: ntfs label: Games
    uuid: 72C28F7DC28F43F7
  ID-8: /dev/sda2 maj-min: 8:2 size: 201.17 GiB fs: ntfs label: Movies
    uuid: A8C4BA68C4BA3880
  ID-9: /dev/sda3 maj-min: 8:3 size: 46.56 GiB fs: ntfs label: Backups
    uuid: 0F040E1766C8BF13
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-1:2 info: JMicron / USA Gen1 SATA 6Gb/s Bridge
    type: mass storage driver: uas interfaces: 1 rev: 2.1
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 500mA
    chip-ID: 152d:0576 class-ID: 0806 serial: <filter>
  Device-2: 1-2:3 info: Logitech G402 Gaming Mouse type: mouse,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 300mA chip-ID: 046d:c07e class-ID: 0300
    serial: <filter>
  Device-3: 1-4:4 info: Sonix USB2.0 HD UVC WebCam type: video
    driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 500mA chip-ID: 322e:202c class-ID: 0e02
  Hub-2: 2-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 3-2:2 info: SINO WEALTH Gaming KB type: keyboard,HID
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 500mA chip-ID: 258a:002a class-ID: 0300
  Device-2: 3-3:3 info: IMC Networks Wireless_Device type: bluetooth
    driver: btusb interfaces: 3 rev: 2.1 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 100mA chip-ID: 13d3:3563 class-ID: e001 serial: <filter>
  Hub-4: 4-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 59.6 C mobo: N/A gpu: amdgpu temp: 55.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 360 Uptime: 1h 18m wakeups: 2 Init: systemd v: 253
  default: graphical tool: systemctl Compilers: gcc: 13.1.1 alt: 12
  clang: 15.0.7 Packages: pm: pacman pkgs: 1351 libs: 376 tools: pamac
  pm: flatpak pkgs: 0 Shell: Bash (sudo) v: 5.1.16 running-in: konsole
  inxi: 3.3.27

The output of ls /sys/class/power_supply/BAT1 grep charge is as follows:

charge_full
charge_full_design
charge_now

It’s missing these:

You can try setting the values manually as ASUS laptops seem to support it See: Laptop/ASUS - ArchWiki