Group: Hardware/RepairsRefurbishingAndMaintenance

From LibrePlanet
< Group:Hardware
Revision as of 17:52, 29 July 2022 by GNUtoo (talk | contribs) (Introduction: Add section about batteries)
Jump to: navigation, search

Introduction

This page is meant to list free software applications or code that can be used to either:

  • Repair devices
  • Do regular device maintenance to keep the devices functional
  • Repurpose devices

Batteries

Linux /sys/class/power_supply/*/

X86 Laptops batteries often have a nonfree firmware somewhere and calibration data. The computer embedded controller usually interfaces with that firmware. And Linux has drivers to talk to the embedded controller to get data about the battery used by laptops.

We can usually get battery information through Linux standard interfaces:

$ grep . /sys/class/power_supply/BAT0/uevent 
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
[...]
POWER_SUPPLY_POWER_NOW=15191000
POWER_SUPPLY_ENERGY_FULL_DESIGN=84240000
POWER_SUPPLY_ENERGY_FULL=32310000
POWER_SUPPLY_ENERGY_NOW=9690000
POWER_SUPPLY_CAPACITY=29
POWER_SUPPLY_CAPACITY_LEVEL=Normal
[...]

So not only we can see if charging works (here it's Discharging) but in a lot of cases, we can even understand how much the battery would last compared to the amount of time it lasted when manufactured.

Here we can simply calculate that by dividing POWER_SUPPLY_ENERGY_FULL by POWER_SUPPLY_ENERGY_FULL_DESIGN:

$ python3
Python 3.9.9 (main, Jan  1 1970, 00:00:01) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 100 * (32310000 / 84240000)
38.35470085470086

Note that this information is only accurate if the calibration data is correct. Batteries typically have I2C interfaces, so it's possible to talk to the battery firmware and it's probably possible to modify its calibration data too in some way.

So the battery I'm using will last 38% of the original battery. So if the battery lasted 5 hours after being manufactured, it will now last about 1 hours and 55 minutes.

In contrast with x86 laptops smartphones also have calibration data (typically in the battery gauge chip), but they often don't have any information on how much the battery would last compared to the original battery life.

A way to find out could be to develop a procedure that drains the battery as fast as possible (for instance using cpuburn to use the CPU as much as possible) and look how much different batteries last.

It might also be possible to caracterize the battery directly with hardware meant to discharge it and measure its voltage with multimeters and sigrok (a free software tool that can retrieve information from some multimeters).

Cooling

cpuburn

The cpuburn software tries to use a CPU core as much as possible so that can be used to test the cooling of a device, or the CPUs. If you have 8 cores, you need to run 8 instances of that software.

Implementations exists for multiple CPU for at least ARM and x86.

Linux

  • Linux has an hwmon subsystem and it can be used to manually control fans
  • Linux can also report various temperature sensors data through the hwmon subsystem

lm_sensors

lm_sensors can use data exported by Linux to print temperatures etc

Flash chips

Flashrom

Flashrom can read and write various flash chips (With Parallel, SPI, FWH, LPC interfaces) so it can potentially be used to repair many devices. You also need a compatible flash programmer (that works with a compatible voltage level) to program flash chips conveniently.

On some computers it can also read/write the computer flash chip that holds the boot software (like the BIOS or UEFI). It can also read/write the flash chip of various cards (like GPUs, network cards, etc). In both cases it's not always able to read/write the full flash chip as sometimes the hardware configuration can prevent that (in case of laptops for instance), and other times the code is not stable enough to write the flash chip (for some GPUs and/or network cards).

Website: https://www.flashrom.org/

GPUs

Games

Various free software 3D games can be used to test GPUs.

Some games need a big quantity of RAM to run (Xonotic and supertuxkart probably require 2GiB of RAM or more for instance).

Many old computers cannot have that much RAM (due to chipset limitations). Even some modern computers have soldered RAM, so in that case RAM can't easily be increased either.

For cases like that, extreme Tux racer uses 3D acceleration and don't require a big quantity of RAM, so it could be used to test GPUs on such computers. It is available in several FSDG compliant distributions like Parabola and Guix.

Phoronix test suite

Phoronix test suite can also be used to test GPUs. Note that by default many tests are nonfree.

Both Guix and Parabola's phoronix-test-suite have free tests.

The Guix version is probably more advanced as Parabola's version is old and lack games (it's limited to compilation tests), at least until volunteers fix that in Parabola.

HDDs and SSDs

Gnome disks

Gnome disks can test HDDs and SSDs to see if they are broken or not.

Website: https://apps.gnome.org/en/app/org.gnome.DiskUtility/

smartmontools

Smartmontools can test HDDs and SSD to see if they are broken or not.

Website: http://smartmontools.sourceforge.net

Flashrom

Flashrom can also be used to dump and restore some HDDs and SSDs firmwares as the flash chips holding the firmwares are often easily accessible on the hard disk PCB.

Debug interface

Sometimes there is a debug interface on HDDs and SSDs. An UART connection can be used to interact with it. Note that using that is very dangerous as you can easily loose data.

TODO: find the talk about it.

hdparm

TODO: find if there are information about repairing or repurposing hard disks with hdparm.

NAND reader

There is hardware schematics and GPLv3(+?) software for that available here: https://spritesmods.com/?art=ftdinand

Modems

simtrace and simtrace2

Simtrace and Simtrace2 can trace the communication between a SIM card and a mode. Thanks to that it is possible to gain some information on what is going on, for instance:

  • If the screen is broken we might see some acvitivy through that
  • It might be useful to debug a SIM card reported as not found: if there is some traffic, the modem sees the SIM card

Osmocom GSM stack

It might be possible to use OpenBSC and so on to emulate a GSM network to see if a phone is working well, however the hardware to do that is probably expensive.

In addition it would require special cables between the phone and the GSM network to ensure that the GSM network doesn't emit ouside of the cable (to not require a (test) license).

network manager / modem manager / oFono etc

The various GNU/linux modem stacks can obviously be used to test some modems.

The test suites of these modem stacks or network test suites like Titan_TTCN3_Testsuites might be able to be repurposed to run automatic tests.

RAM

Memtest86+

Memtest86+ is an application that can be launched in GRUB and that can test the RAM.

For that to work the computer needs to be able to boot up to GRUB so if the RAM module under test is very broken, you might have more luck with two RAM modules: one good and the one under test.

Libreboot or Coreboot on Libreboot supported devices

Libreboot supports laptops with DDR2 (I945) and DDR3 (GM45).

It also supports some desktop computers.

If one hook up a serial port (on compatible computers, through the dock) it is possible to get some diagnostics even if the RAM isn't working at all.

They also has a fork of Memtest86+ that works over an UART.

Coreboot on Libreboot supported devices

On some of these computers the RAM initialization isn't free software so it might not give much information on what is going wrong. Note that Coreboot contains nonfree software. That is why Libreboot was made in the first place. Libreboot contains script to produce deblobed versions of Coreboot. Some vendors selling RYF certified hardware have also released deblobbed Coreboot as part of their RYF certification.

Novena + u-boot

The novena laptop also has slots for RAM modules and in u-boot, the RAM intialization code for that laptop is free software. Though u-boot itself might need to be deblobbed as some of its versions contain nonfree software (like nonfree firmwares and/or binaries under nonfree licenses).

Parabola has already some packages for some computers using an I.MX6 system on a chip, so it might be possible to ask Parabola developers to add support for the novena if you accept to test the resulting package.