Anthony J. Martinez

Librem 14 USB-C Charging in Qubes OS - Baseline

Sometime either last week, or the week before, my Purism Librem 14 gave me a bit of a scare. While transfering a large amount of data across the internet, and plugged in, it just died. It was fairly hot here in The Netherlands, and in the loft my office is in it was even hotter. My intial belief, or really fear, was that the brand new laptop was dead. Such is my luck in most cases, and after more than a little time in combat I am conditioned to expect the worst. Heat kills, and it would not be the first time I have seen it happen.

Fortunately, the device itself was not dead as in brick but was dead as in 0% charge remaining. Even though the USB-C power supply I am using, and the USB-C hub I was powering through at the time can handle plenty of wattage, it appears that the power requested was not greater than or equal to the power consumed. As our dear friend Newton explained quite a long time ago there ain't no such thing as a free lunch. I ran out of juice. Charging at 10W might have something to do with it:

Now the above is just my first sample of the charging profile, and the data were taken while the laptop was mostly idle. The data were collected the same way I did it before, parsed with our friend Python, and plotted with Bokeh.

For the next test(s), I will throw some load at the system and see what I can determine from the battery stats. What I am looking for now is whether or not I see the indication of charging whilst the battery energy continues to decrease minute over minute at full load. What is most interesting to me so far is that I have in fact been able to use the full power of the system for hours on end, and it appears that my decision to execute a backup in Qubes (itself an extraordinarily inefficient process) with low battery life may have had some impact on the situation. It should not have mattered, but what should be and what is are rarely unified in practice.

On the upside, and as a topic to detail in another post, the scare did provide the necessary push towards actually configuring Borg Backup scripts for my most critical VMs. Now, in addition to my full VM backups there are also de-duplicated and encrypted Borg backups of those VMs that I can run in seconds to my backup server back in the US.

The Python responsible for the chart above
from glob import glob

import pandas as pd

from bokeh.plotting import figure
from bokeh.embed import autoload_static
from bokeh.resources import CDN

samples = glob("*.txt")
samples.sort()

charge_profile = { "energy": [], "rate": [] }

for sample in samples:
    with open(sample, 'r') as f:
        for line in f:
            if "energy:" in line:
                charge_profile['energy'].append(line.split(':')[1].lstrip().split()[0])
            if "energy-rate:" in line:
                charge_profile['rate'].append(line.split(':')[1].lstrip().split()[0])

df = pd.DataFrame(charge_profile)

p = figure(x_axis_label="Time (m)", y_axis_label="Wh (Navy), W (Firebrick)", title="Librem 14 Charging Profile")

p.multi_line([df.index, df.index], [df.energy, df.rate], color=["navy", "firebrick"])

js, tag = autoload_static(p, CDN, '/tech/ext/librem-14-charging.js')

# Then write the js and tag out...