找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 1418|回复: 4

VEER刷机时一直检查电池电量,不知为何?

[复制链接]
发表于 2012-7-12 18:41 | 显示全部楼层 |阅读模式
本帖最后由 phil_rem 于 2012-7-13 00:48 编辑 3 q: p# U1 c- |2 H
% }8 _+ U! c% g" H

( H* a+ l5 M# z' L  V) G5 t
8 Z1 n5 z/ X+ o1 o5 e满电的Veer刷机一路next,到最后一步,然后一直提示Battery Charging,有基友提示可能电池故障,
  y3 D2 D/ L) w2 h* O
+ O$ q3 K! R. l( E6 ]) x: m找了台可以正常刷机的小v,拆了电池换上后问题依旧,
+ r$ _$ A) j0 P: f$ M! D0 ~
! g8 Q) l  g* J& U! D5 a更杯具的是原来正常的小v刷机也这样了(手机可正常使用,只是无法刷机)' Y# c* u5 U6 Y1 `. N3 y
4 T7 q: k. |2 |" o0 y, D+ j4 Z/ Z+ g
用8%12%修复工具修复无效,4 _! X, ~5 H( ], }
. G6 p9 G; X1 h7 z: n
目前两台机器均无法安装软件,商店也不知道为什么一直在转圈圈,想下个preware也没机会了。。。。6 Y5 t9 z: `: D4 U

( [: U2 c/ q: ^$ Z$ l/ P+ O之前好好的一台被我弄坏了,悲剧啊。$ O8 F7 x* q7 g" H3 e+ l' I

- w8 n" i2 T) u6 R7 ~现在各种抓狂~    V  x* E0 H. ?2 m$ J9 P
8 t5 [  h! i4 E' R
跪求解决方案,小礼物送上~
* x. V" }% ?! L
  [1 A3 S9 R' ~

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入我们

×
回复

使用道具 举报

 楼主| 发表于 2012-7-12 22:51 | 显示全部楼层
诶,没人鸟我。。。。  看来国内不好混啊,去webosnation看看~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-7-13 00:02 | 显示全部楼层
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 2012/7/12 23:51:59; x9 D2 x  Y. h8 }; Q
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
" B* y5 Y1 u- v2 K  a// Decompiler options: packimports(3) 2 h& h+ \+ \1 T6 U) M7 g
// Source File Name:   ChargeBatteryStage.java
( H' a4 ~% P, c- r
* z' n+ ~6 u3 t; tpackage com.palm.nova.installer.core.stages;7 ^3 ^; Z9 n4 D4 x% a
3 h8 e# [. G% K7 P- g! K
import com.palm.nova.installer.core.*;0 Q% W" F, M5 j
import com.palm.novacom.*;
: Z4 k2 z, x! N2 z+ |6 uimport java.io.IOException;3 N# S) G& \" u

( |- H5 ?- C$ O! ?+ w! [$ }) c( \// Referenced classes of package com.palm.nova.installer.core.stages:$ {! t5 Z5 b% ~* T2 Q
//            BaseStage, GoIntoUpdateModeStage
/ m  S! z+ @9 l- F4 D
6 t, N5 J0 g! b. Epublic class ChargeBatteryStage extends BaseStage7 t3 x" Q, t0 z; @  W
    implements IInstallerStage+ v& I. t( b. S# ^  c) d+ \5 T
{
; V9 Z( _& e. r8 Q. ~, T0 u7 ~' u7 n4 h2 \
    public ChargeBatteryStage(INovacomDevice device)
- L2 M3 Y6 c. J  u    {. Q: O6 h( n; F) r
        jobId = null;
8 a1 M. y7 Q- o; n        progress = null;
* T: X% Q4 G7 a        currentChargeLevel = 0;
% a2 P( s- a* m5 j; m' _        this.device = device;
0 \2 c, w7 M: E7 m: G7 w0 g    }
; I2 a$ Q9 H) D& \8 T& a
% m5 @# e- q( a$ y) H  g3 f    public String toString()- m9 W  b% p- O% Y
    {
2 \1 o3 s* p; t, k7 A8 Z4 S$ P        return "Battery Charger";& F1 u  p- j' x2 Z0 V# o4 K. s
    }$ T% e2 ^* I9 H

9 g7 |9 r* _/ f) M' i    private void chargeBattery()
5 z  B: x3 K9 o" |        throws NovacomException, IOException, ]- p: M) M1 Z+ [: Z- [1 X
    {8 o/ |/ N0 h+ ?' K) Q: ~
        INovacomStream stream = device.runProgram("", null);
7 I) E( K: ^/ z! x) ]/ x        String command = (new StringBuilder()).append("charging enable ").append(REQUIRED_POWER_PERCENTAGE).toString();/ V) r" ^4 y4 v* G9 G  Y0 V
        byte bytes[] = command.getBytes("US-ASCII");, O: L) n7 f2 [5 [  J; X
        stream.write(bytes);* D3 Z7 C2 y4 I- [
        stream.closeOutput();
/ O+ \/ u- `5 @0 w( D        String streamReturn = stream.readLine();
* u; E/ r5 C3 S        do, Y, z( o* C9 o; @
        {
3 T! w1 r( C$ A            streamReturn = stream.readLine();
2 V( d9 T. D% z) b            if(streamReturn == null)
8 y( B, l* A8 i+ `  g, M3 ^            {
' L! z( C9 Z3 x% `                progress.commentOnJob(jobId, "stream interupted");, n# \& i- D' U1 B! {1 Q3 x) X2 @
                throw new NovacomException(-1, "stream interupted");: |- u4 C* Y7 S
            }
0 T9 f, y+ Z# p" a            if(streamReturn.length() == 0)
4 q5 P! D  y5 D( p3 D            {
: b$ P% \" [- W                progress.commentOnJob(jobId, "power charged up");
- @4 T0 @% d8 w- w9 H  f/ p                break;, C8 G2 f) f- u# e& W6 \
            }
7 j6 _9 }" _9 k; f9 ]7 Q7 |            int start;! D6 p7 ]$ d: [4 p$ t* K
            int end;
4 `7 n: u( h, z: e            if((start = streamReturn.indexOf("p=")) >= 0 && (end = streamReturn.indexOf(" ", start + 2)) >= 2)
6 ?2 i2 `/ z+ D! L/ _) X/ @            {. ?# U) @7 e2 I8 f* v
                start += 2;6 ~7 A/ `% n9 n$ R9 H+ R' [$ U
                String strReadBatteryPercentage = streamReturn.substring(start, end);
' Q9 w4 L8 p% I) B6 A                try
/ r  `+ \! w% s% D: [' Z  c, Y: h                {
8 ~. i7 ?- X5 ?4 x                    int readBatteryPercentage = (new Integer(strReadBatteryPercentage)).intValue();
, b0 r! z5 u1 }3 w: q: n0 c                    if(readBatteryPercentage > currentChargeLevel)
" I3 D, H0 P) P: y                    {% A/ ~2 L2 J; R. K5 t
                        currentChargeLevel = readBatteryPercentage;" h9 L+ f. w3 S4 `! m0 Y( _9 _- C1 g
                        progress.updateJob(jobId, currentChargeLevel);
& T( B! j3 c2 u1 A& G3 L. [* v9 O                        progress.commentOnJob(jobId, (new StringBuilder()).append("battery percentage changed: ").append(currentChargeLevel).toString());, E0 u9 B) i4 D( ]1 K4 ?" f- P
                    }  [, A4 Z9 b" y
                    Thread.sleep(500L);9 l4 q5 F0 `* K+ {! E5 ?
                }
0 N% N' x3 {' X) q9 R8 z                catch(NumberFormatException e)
9 _5 ~4 Y( h+ _; }( Q% c! A                {
3 m5 x+ r+ _, i, I; k, [/ [7 h1 V/ }                    progress.commentOnJob(jobId, (new StringBuilder()).append("+++++").append(streamReturn).append("-----").toString());
+ G( L3 }) Y  G! y! C) u                }
! c  G+ n8 w% L- Q' e, w- m) t0 _                catch(InterruptedException e) { }  O- X6 m- S$ b6 o) b: m2 @+ R
            } else
& `" Z5 Z- i* s( f8 F            {( k2 z: f& o) S9 W  p
                progress.commentOnJob(jobId, (new StringBuilder()).append("+++++").append(streamReturn).append("-----").toString());7 c: H) s8 X, j1 T% \
            }
) e7 D& y$ D1 d& S- J% d6 q$ ?7 ]) Z            stream.flush();* c9 O; X1 T# E' [
        } while(true);$ H( P& D6 r) @' j% m2 L
        stream.close();& ]& G+ l# n& s! @8 E
    }
  W2 I1 Y$ n. y, }9 K/ O3 e$ n/ G% _* y9 S6 _
    public void run(), @" b$ A; E& I' s
        throws NovacomException, IOException
2 |, d! ?/ a; M, x- Q    {/ j4 t4 L7 p! K: F& }
        progress = getProgressHandler();! {- V. J+ m2 \/ C! r
        jobId = progress.startJob("Battery Charger Stage", 100);
$ I" J, [" t& |6 O( F0 v: W; g        if(device.getState() != com.palm.novacom.Novacom.DeviceState.BOOTLOADER)* c6 u6 p) o, s$ ]- ]3 \1 F
        {
' _! O' j) i. A& H            GoIntoUpdateModeStage intoUpdateMode = new GoIntoUpdateModeStage(device);* i! V) t  @$ Z1 M4 g+ _
            intoUpdateMode.run();
3 [6 ~  {$ |, ~) m9 ^8 W        }1 I( m3 ^9 X7 U6 g) _8 K. K
        BootieUtilities bootie = new BootieUtilities(device);
( C9 T; p: M. v        int currentPercentage = bootie.checkPowerStatus().intValue();
7 `( ^; ^3 B3 B0 s  M) r        if(REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage)
$ H5 a1 F  j1 H        {& t  M! }* S" x8 h. Y- [; W& [
            progress.commentOnJob(jobId, (new StringBuilder()).append("Battery at ").append(currentPercentage).append("%").toString());
' A" N: m% q. y$ ]            int count = 0;
/ O5 \8 N4 D5 e3 ~            do0 z5 {/ [; B) J  d
            {% y& X  _6 R, ]; l
                progress.commentOnJob(jobId, "Battery Charging Started");2 q% j. g: E( j- ~! V5 y! E& v' l
                progress.commentOnJob(jobId, (new StringBuilder()).append("Charging to Sufficient Power (").append(REQUIRED_POWER_PERCENTAGE).append("%), this may take a couple of minutes").toString());% d5 P( w7 W# v# {5 A- x( B
                chargeBattery();2 Y4 J' \0 w7 T. H$ s7 h& d3 g
                if(++count > RECHARGE_RETRY_COUNT.intValue())
; [# i# K1 g- N                    throw new NovacomException(-1, "failed to charge batttery");3 [  g4 Q8 I! v/ ^
            } while(REQUIRED_POWER_PERCENTAGE.intValue() > currentChargeLevel);+ F/ B7 ^) N! a
        }  |1 r" c: b1 s0 |1 i7 G: w
        progress.endJob(jobId);  b7 F( S. j& P! Z/ q6 m# y
    }: h3 y8 G7 P; h. J6 S5 a7 O

$ M# Y; E( v$ t    private static final Integer REQUIRED_POWER_PERCENTAGE = Integer.valueOf(25);" `$ K2 q& ]3 E% ]1 _, u8 ]% N
    private static final Integer RECHARGE_RETRY_COUNT = Integer.valueOf(5);
% Y; c3 f4 u, M    private final INovacomDevice device;% T; Z6 g  O  i3 C% j; V
    private Object jobId;
. z8 M6 U2 s. y- W5 v6 O: C    private IStageProgressReporter progress;8 l/ J% D" A, }& ?! n$ d+ Y; }* l
    private int currentChargeLevel;
/ u8 q+ b7 p. m# ~6 f. v2 `* }3 T" `9 r* ^& z
}7 T, @9 a+ N6 v
$ q, A+ U+ ~2 O) z

' I6 x6 L. n! O- [& X1 j; o" N* t求编译~~~~~~~~~~~~~~~~~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-7-13 00:42 | 显示全部楼层

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入我们

×
回复 支持 反对

使用道具 举报

发表于 2012-7-13 01:04 | 显示全部楼层
phil_rem 发表于 2012-7-13 00:42

' u. A4 s5 r7 q& k' h2 g如果目的是为了不让充电,那么把下面的代码注释掉就可以了。
% t3 K* @5 y# x2 v% P+ A1 C& i& y6 U, l0 M8 D5 I
原来是这样:
% N% m. C! m( b( \5 B; h+ [$ w BootieUtilities bootie = new BootieUtilities(this.device);1 R6 R; ]- f# v- }' R
    int currentPercentage = bootie.checkPowerStatus().intValue();
9 F1 \+ C) s, R" M, ^7 N+ R' r    if (REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage) {
# ~% s0 j3 J0 T# H      this.progress.commentOnJob(this.jobId, "Battery at " + currentPercentage + "%");- h# }! ^! T# [. v4 x6 Z1 X  }
      int count = 0;
2 \) {  y/ `( F+ K' N% j      do {# k& I8 F6 A/ W# D4 d0 v
        this.progress.commentOnJob(this.jobId, "Battery Charging Started");
( I7 ^% x2 y0 d7 S        this.progress.commentOnJob(this.jobId, "Charging to Sufficient Power (" + REQUIRED_POWER_PERCENTAGE + "%), this may take a couple of minutes");
( C2 n/ A2 n- X0 R* }        chargeBattery();
5 |7 j$ r2 A6 e2 D2 @2 X- b1 l7 e' g% T% _
        count++;
: F7 {0 `8 |% f        if (count > RECHARGE_RETRY_COUNT.intValue())
% X1 ^0 L7 m: d4 U8 L* x# c2 R          throw new NovacomException(-1, "failed to charge batttery");& s5 j! ^# r& I/ F8 K
      }+ V: r7 u# [  l" |2 B0 R/ a$ G
      while (REQUIRED_POWER_PERCENTAGE.intValue() > this.currentChargeLevel);
6 t- z3 s/ ^0 M. D. l" c    }
, {0 k, f1 T% e. Y: `2 ?4 J" u, H# M. U- d6 m% H+ w
    this.progress.endJob(this.jobId);* M+ N8 V3 h1 ?: H% @4 p' e
0 H5 X  a3 |8 I* {) K& {
注释掉变这样:+ [$ p6 R, V: i% P" u) Y# f3 V
BootieUtilities bootie = new BootieUtilities(this.device);
9 T  E( b  a8 J    int currentPercentage = bootie.checkPowerStatus().intValue();: {& e  x# f/ G' o
    /*if (REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage) {' B6 G$ c* a, U& w
      this.progress.commentOnJob(this.jobId, "Battery at " + currentPercentage + "%");  @: C1 \8 |- H3 Q
      int count = 0;$ R" ?& N* I4 @; b4 ]3 {7 I; D4 A
      do {
0 n/ t2 K5 y7 A: u0 a        this.progress.commentOnJob(this.jobId, "Battery Charging Started");
4 i$ c; F' z$ ~' a- ~+ q) C        this.progress.commentOnJob(this.jobId, "Charging to Sufficient Power (" + REQUIRED_POWER_PERCENTAGE + "%), this may take a couple of minutes");' u- L; Q( L  \# ^; _
        chargeBattery();0 p% d/ G0 `3 A. b
! G+ s! {4 _& P8 ~# t1 _3 l& e* L
        count++;5 M) u! P( d& }7 F$ {+ ?2 B1 n
        if (count > RECHARGE_RETRY_COUNT.intValue()); r% {& I4 }" O- ?7 J0 ]5 X
          throw new NovacomException(-1, "failed to charge batttery");1 S3 l2 `) a+ t
      }
. h" `7 I/ E3 W% L: j      while (REQUIRED_POWER_PERCENTAGE.intValue() > this.currentChargeLevel);
$ X; |) u  @( b+ u1 E    }*/1 q6 f3 u4 R) S! W& @# U
" |2 ~" u7 m' i/ F5 {
    this.progress.endJob(this.jobId);
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

QQ|Archiver|手机版|小黑屋|吹友吧 ( 京ICP备05078561号 )

GMT+8, 2025-3-31 10:51 , Processed in 0.468628 second(s), 17 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表