charge android in hboot

How to charge your Android phone battery in hboot

The situation was grim. My HTC One X was stuck at the hboot screen. The bootloader was re-locked (I was trying to flash a new RUU) so I couldn’t get to CWM Recovery. The battery was dying. Things did not look good.

I had ignored the advice on the xda forum and was messing around on a low battery charge…

At this point, I would usually just flash the Unlock_code.bin file and reopen the bootloader, except I couldn’t – the battery was too low. And the battery can’t charge in hboot, it can only charge in CWM recovery. But I couldn’t get to CWM because the bootloader was relocked. Oh, what a frustrating paradox.

Using the fastboot getvar battery-voltage command I could see that there was an ever so small change in voltage when I charged, but not enough. I needed 3680mV in order to be able to flash the unlock token.

Luckily, I found this amazing ingenious trick on the XDA forums:



@echo off
fastboot getvar battery-voltage

fastboot reboot-bootloader

ping /n 6 localhost >nul

goto start



How to run the script when in USB Fastboot mode

  1. Open a text editor and paste in the code above
  2. Save as a .bat file. I saved mine as loop.bat – make sure it is in the same folder as fastboot and adb
  3. Connect phone to computer by usb and check to that Fastboot can see it (‘fastboot devices’)
  4. Start the batch in command prompt ‘start loop.bat’
  5. Get hyponitised by the slow, steady progress
  6. Once you reach the required 3680mV type ‘stop’
  7. Flash your unlock token by executing ‘ fastboot flash unlocktoken Unlock_code.bin’
  8. Cross your fingers

What this does is reboot the bootloader repeatedly. Which each reboot, the charge moves up incrementally, maybe 1 or 2 mV; and sometimes even down.

After leaving the bat file to run for an hour, I finally made it 3680mV and flashed the Unluck token. The stretch between 3660mV and 3680mV is the most agonizing, with change happening suuuuuuper slooooooowly.

Once you can get to CWM recovery, let your phone charge for a few hours, so that you can install your ROM or RUU without fear. As and aside, the ‘Mount USB’ commend does not work for the HTC One X on the build I tried (5.8.4) of Clockword Mod Recovery Touch, but it does work in the regular version, so if you still need to copy your rom to your USB, don’t use Touch. Although, it is easier just to flash using fastboot flash rom zip

9. Breathe a sigh of relief

Published by


Hi, my name is Lester. I'm a music lover, an avid blogger and a bit of a geek. In addition to being a people person, I'm fascinated by the internet and over the last 4 years I've become very passionate about technology, especially email marketing, blogging, social media, and community management. Thanks for reading my blog ;)

24 thoughts on “How to charge your Android phone battery in hboot”

    1. I’m pretty sure that other than the form factor, the One X is the same as the One X plus, so this should work fine in theory. Good luck!

  1. What do you mean
    Once you reach the required 3680mV type ‘stop’. It doesn’t let my type anything while it is processing

    1. I’m trying to think back, but I unfortunately I can’t remember exactly how I did it. Check the source post, there’s probably more information available there.

  2. Excellent Tip. Had planned to switch the phone off repeatedly……………i’d have been doing it for hours lol


  3. I had exactly the same problem, because I was using a charger that outputs only 0,55 mA to the phone, so I took the original charger that outputs 1A and it charged it while it was in fastboot mode, obviously not connected to the PC but to its original charger. After an hour I re-unlocked the bootloader and got into recovery where I saw the battery was at 66%. I have to say that the LED didn’t turn on every time I made a reboot into the bootloader, a few times it didn’t start to charge automatically, more times it did. With the 55mA charger the LED blinked, while with the 1A charger it stood still. Problem solved just by giving much more power to the device than what it consumes. If anyone has the same problem, just take a more powerful charger and see if it works. Don’t expect to charge it from a USB port of any computer with the screen turned on, there’s simply not enough power and it will consume more than what it gains.

    PS, since I have an HTC One X+ with S-ON and messed up my ROM, now I have to find an original stock RUU for my device. If anyone knows exactly how to find the software I need I would really appreciate. In an attempt to sideload a ROM in the recovery I read that it’s not the right software, because it was ENDEAVOR and would need EVITAREUL. It was the only one ROM that I was able to sideload even if it didn’t work. All other versions got stuck with some error before even finishing sideloading completely. I’m really new to this things, only 3 days ago I started to learn how it all works, so now I’m able to unlock the bootloader, flash a TWRP Recovery and mess up things from there 😀 All I really need is to S-OFF my phone so to flash anything on it, but if I cannot get into the OS from the phone itself I read elsewhere that it’s impossible to S-OFF. That’s why I need a stock RUU/ROM, just to have my phone working for the time I get rid of the security.

    I hope to have helped with the info and also hope to find someone that would help me with some information.

    Have a nice life 🙂

  4. Hi lester i am just facing same problem, i have tried this batch script but the charge is decreasing instead of increasing which means from 3605mv to 3540mv gradually drained, i have awaited for 3 to 4 hrs but no result could you help me

  5. i am doing this right now and it takes 10 mins between each re boot. so be patient and it will eventually reach its optimum charge and then you should be able to do what ever you need to. i will leave mine on overnight and let it run

Comments are closed.