Tutorial  Updated

Fix for Linux Battery issue

Here's a quick and easy fix for the turning off at 40% battery issue that people are seeing after running Linux. This is effectively the same fix as unplugging the battery, but does so without having to take apart the Switch.

Step 1: Download attached fusee-linux-battery-fix.rar
Step 2: Extract and load the binary with your favorite RCM Smash tool (I'm using TegraRcmSmash).
Step 3: You should see the typical fusee screen, at this point unplug the USB cable. The screen should go off.
Step 4 (optional?): Hold the power button for 10 seconds. Your switch won't turn on at this point, that's desired.
Step 5: Plug in a USB cable. Switch will turn on, and you're done.

This worked to fix my Switch, let me know if it works for you.

Edit:

Source is here:

github/crystalseedgba/BatteryFix/blob/master/fusee/src/main.c (Sorry it's not letting me post hyperlinks)

This doesn't fix the Linux bug, this is really just a crude workaround. At first I suspected that Linux is somehow mangling the battery gauge but this doesn't seem to be the case. The battery gauge reports around 40% and decent battery voltage when my Switch would turn off. I think Linux is misconfiguring some undervoltage lockout somewhere, but I don't know where.

Thanks to jjbredesen for his "How to make a custom Fusee payloads" tutorial.
 

Attachments

  • fusee-linux-battery-fix.rar
    14.2 KB · Views: 2,025
Last edited by Crystalseed,

poto

Member
Newcomer
Joined
Jun 24, 2018
Messages
5
Trophies
0
Age
33
XP
201
Country
France
Source code posting along with the binaries is actually REQUIRED since this is based on the fusee payload code base (GPLv2 licence)... don't run this until someone else has compiled it and verified the binaries are similar.

Code:
  init_i2c_controller(0);
  i2c_read_register((int)v2, 1u, 0, 0x6B, 0xA);
  if ( v2[0] != 0x2F )
  {
    printk("ERROR: charger part number mismatch got: 0x%02x want: 0x%02x\n\n   ", v2[0], 0x2F);
    while ( 1 )
      ;
  }
  i2c_read_register((int)&v2[1], 1u, 0, 0x6B, 5);
  v2[1] &= 0xCFu;
  i2c_write_register(0, 0x6B, 5, &v2[1], 1);
  i2c_read_register((int)&v2[2], 1u, 0, 0x6B, 7);
  v2[2] |= 0x20u;
  i2c_write_register(0, 107, 7, &v2[2], 1);
  printk("\n\nBATFET is now disabled, disconnect the USB cable.\n\n");

reverse engineered code, so doesnt seem too malicious.

Wooooow Is the caused by two \n missing on battery level?

But if you use linux again the bug return?
yes, so probably you'll have to relaunch the fix after each use.

Can it be integrated with lakka?

I think, the fix has to be released as open source before thinking about a compatibility with any other open source proj like SHOElf / Lakka.
 

Centergaming

Well-Known Member
Member
Joined
Apr 17, 2016
Messages
695
Trophies
0
XP
923
Country
United States
Here's a quick and easy fix for the turning off at 40% battery issue that people are seeing after running Linux. This is effectively the same fix as unplugging the battery, but does so without having to take apart the Switch.

Step 1: Download attached fusee-linux-battery-fix.rar
Step 2: Extract and load the binary with your favorite RCM Smash tool (I'm using TegraRcmSmash).
Step 3: You should see the typical fusee screen, at this point unplug the USB cable. The screen should go off.
Step 4 (optional?): Hold the power button for 10 seconds. Your switch won't turn on at this point, that's desired.
Step 5: Plug in a USB cable. Switch will turn on, and you're done.

This worked to fix my Switch, let me know if it works for you.

Can you please open-source this so other developers can possibly use this as a patch to the Linux kernel?
 

CTCaer

Developer
Developer
Joined
Mar 22, 2008
Messages
1,154
Trophies
0
XP
3,008
Country
Greece
This checks if it can find the bq24193 battery charger IC.
Then it disables the watchdog timer in reg 05
And lastly enables bit5 - BATFET_Disable in reg 07 that triggers a battery disconnect.

EDIT:
The watchdog timer, btw, is needed to be disabled so it can keep the BATFET off.
Until you connect a charging source.
 
Last edited by CTCaer,

BlastedGuy9905

where's the updated autopsy report
Member
Joined
Apr 13, 2017
Messages
2,334
Trophies
1
Age
33
Location
under your desk
XP
4,043
Country
United States
Had an issue where I never used Linux but still had my battery die at 40-50%, I'm trying this now.

If this really does work i hope it's used to fix the issue with lakkatv
It works. You just have to follow the instructions correctly.

--------------------- MERGED ---------------------------

I'm at 3% handheld mode, still running MC.

Update: Now it says "Charge the console. It will go to sleep mode soon." And it went to sleep mode.
 

lordelan

Well-Known Member
Member
Joined
Jan 4, 2015
Messages
5,803
Trophies
1
Age
44
XP
6,573
Country
Germany
It’s surprising that a newcomer with one post made a fix that no one could do it before :o
It's some Ninty guy and the payload is injecting a self destruction mod into your Switch so explodes on 31th dec to punish you for using hackz!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Veho @ Veho:
    Nah, a hit gives them mad meth powers, but makes them more difficult to control.
    +1
  • Veho @ Veho:
    Before a hit they're like zombies, persistent but slow.
    +1
  • Veho @ Veho:
    It's a tradeoff.
    +1
  • The Real Jdbye @ The Real Jdbye:
    no i mean, before a hit is after the previous hit
    +1
  • The Real Jdbye @ The Real Jdbye:
    if you keep them well enough fed, it's the same thing
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    By the power of Florida Man, I have the power!!! *Lifts up meth pipe* Meth Man!!! lol
  • BakerMan @ BakerMan:
    Guys, I just learned my little brother is in the hospital because he had a seizure last night.
  • cearp @ cearp:
    Sorry to hear that BakerMan
    +2
  • BakerMan @ BakerMan:
    Just found out he's doing alright, doing a lot of complaining too, rightfully so. Who wouldn't complain after having a seizure and being hospitalized?
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Glad he is OK and complaining is cool :)
    +1
  • K3Nv2 @ K3Nv2:
    Yeah been there had that no fun
    +1
  • K3Nv2 @ K3Nv2:
    They'll give him sleep studies eegs and possibly one week hospital stay
    +1
  • BakerMan @ BakerMan:
    I hope it's not a week.
  • K3Nv2 @ K3Nv2:
    It's standard so doctors can get a idea about what's going on
  • BakerMan @ BakerMan:
    understood
  • BakerMan @ BakerMan:
    well, i'm glad he seems to be doing fine, and ig i'm going to start spewing goofy shit again
  • BakerMan @ BakerMan:
    Update: Turns out he's epileptic
  • K3Nv2 @ K3Nv2:
    Get a 2nd opinion run mris etc they told me that also
  • Psionic Roshambo @ Psionic Roshambo:
    Also a food allergy study would be a good idea
  • K3Nv2 @ K3Nv2:
    Turns out you can't sprinkle methamphetamine on McDonald's French fries
  • ZeroT21 @ ZeroT21:
    they wouldn't be called french fries at that point
  • ZeroT21 @ ZeroT21:
    Probably just meth fries
  • K3Nv2 @ K3Nv2:
    White fries hold up
    K3Nv2 @ K3Nv2: White fries hold up