找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 1445|回复: 4

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

[复制链接]
发表于 2012-7-12 18:41 | 显示全部楼层 |阅读模式
本帖最后由 phil_rem 于 2012-7-13 00:48 编辑 8 C5 w' d7 f/ \  D
) n1 B7 i- y5 N/ E

% [* _" P# z  q4 A" E2 M* l! n5 u! P  q& Y
满电的Veer刷机一路next,到最后一步,然后一直提示Battery Charging,有基友提示可能电池故障,
  X& W# i* C6 h) T& k: S7 j% z) n  b3 t* ?% X% L. Z
找了台可以正常刷机的小v,拆了电池换上后问题依旧,  y9 j  ~1 M; n& u; H6 x- ~, x

+ P6 J! Q4 @9 i1 {/ [$ I# {1 `更杯具的是原来正常的小v刷机也这样了(手机可正常使用,只是无法刷机)  {( _7 X9 h; o1 _+ c! O

& E* n& T5 R. l3 r8 n用8%12%修复工具修复无效,
5 {% i% \5 h) \' w4 ?# g8 b
4 K# N8 e* Z$ V7 I8 ~3 A7 p目前两台机器均无法安装软件,商店也不知道为什么一直在转圈圈,想下个preware也没机会了。。。。! K  w& H( r: y9 n8 i* ]

: H  h" K% M" b之前好好的一台被我弄坏了,悲剧啊。
9 D# z6 s# c5 A, m6 q
" Y8 O2 n6 ?& ~5 j2 ?现在各种抓狂~  . F$ O" i; G8 U9 T  Z

* @! ^: D$ S+ O  i) Z* C3 b跪求解决方案,小礼物送上~! S, \! f/ c1 G# H3 N* x8 p) w

% ?/ t( R; W6 w) w

本帖子中包含更多资源

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

×
回复

使用道具 举报

 楼主| 发表于 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:595 u4 ?5 C% G2 `+ Y$ d% u4 _6 D
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
0 H& ~) S( c+ K// Decompiler options: packimports(3)
0 t" n  u& C$ f// Source File Name:   ChargeBatteryStage.java
) Z6 v9 L& G( U+ i( p
  Y$ d0 a( D4 x( c( L3 d* ?package com.palm.nova.installer.core.stages;
. r( Z8 N" |- f1 Z
1 P  i+ {# e; L! K- r% D1 gimport com.palm.nova.installer.core.*;
0 ?* w9 M/ w5 ]( |/ C4 yimport com.palm.novacom.*;6 ~9 J: x2 r/ y  \  U
import java.io.IOException;; N0 Q0 C1 s1 O
- ~4 P& C% m3 u; @( w8 U
// Referenced classes of package com.palm.nova.installer.core.stages:' E( K. }# z4 D6 u" ~( O8 u
//            BaseStage, GoIntoUpdateModeStage
6 j0 ]4 w& a! ~% ]3 k8 Q1 W7 `  o# F6 E9 Z
public class ChargeBatteryStage extends BaseStage( d) e4 c' v6 I0 m5 j& J  Q
    implements IInstallerStage* R* L9 X9 M7 c
{
: ^, W5 m' L- w2 C+ f: P
0 j, X3 g& [$ U2 W    public ChargeBatteryStage(INovacomDevice device)7 Q6 ^5 u% d% N7 m% q% U/ Z; s, d
    {
2 w3 Y' H% a9 M5 Q% Q2 b        jobId = null;
3 S& M, A/ `# w        progress = null;$ D& O+ o# F( v7 A% j
        currentChargeLevel = 0;) a* \/ l; t5 Z/ F2 \6 m
        this.device = device;; ]: A, U% W6 V) T
    }
7 g; S+ F8 [2 T- w; |! N, ~/ S- W; g. b
4 f* w; k, f$ C6 J. O" R    public String toString()3 o5 R& U; S) c4 Z0 B8 m% y
    {
; y! ?; L' c6 f( u4 [        return "Battery Charger";
2 a! p8 ?- @) L8 m) E    }
5 {' W' n% z! {8 v! M: B& s9 z% F+ y1 x( j% A' f
    private void chargeBattery()1 a- |- @) f  d
        throws NovacomException, IOException' D+ R: o" k& K6 [+ G
    {
: C! b+ r' J: B! A' M3 Q        INovacomStream stream = device.runProgram("", null);  V7 `0 _$ s* i# Y, o9 `( i- t
        String command = (new StringBuilder()).append("charging enable ").append(REQUIRED_POWER_PERCENTAGE).toString();
( w: O  H5 U) R2 s1 W9 G% w        byte bytes[] = command.getBytes("US-ASCII");
7 o  `% c0 h; I( K+ n, T        stream.write(bytes);5 F! l- ]3 J* K7 C& @; W  P
        stream.closeOutput();! v; L& X% O9 A8 L$ @) d6 v" K9 X
        String streamReturn = stream.readLine();& ]  ?6 J- E- E; _. U7 k
        do
5 Y5 I% E/ l: H, t1 m5 E' s        {
! n$ b& P4 s" @3 z# M, X) a            streamReturn = stream.readLine();
: x6 |# q' [- F            if(streamReturn == null)
  ^3 Q0 G/ P4 Q, v$ g1 J% Z" g  S# d            {
$ X. [  L! p1 V  y+ m! S# T" [                progress.commentOnJob(jobId, "stream interupted");7 i/ U4 V; ~! p2 k% j
                throw new NovacomException(-1, "stream interupted");: v+ _; g4 Q. @" M
            }
( }# u: Y' X2 U- K            if(streamReturn.length() == 0)
+ }) i* P1 `" ?0 r" H            {
( E' \$ e0 w' h( R/ e+ p! U: y                progress.commentOnJob(jobId, "power charged up");$ f) E7 R" L" a" f$ z4 j$ G
                break;
) J9 y7 n/ B1 A            }, p4 J: q( f) {3 F6 b! ]
            int start;
  A3 c3 U3 T. E: }5 _, Z* o5 y            int end;0 @6 A9 M" v& h1 b; M+ f  W
            if((start = streamReturn.indexOf("p=")) >= 0 && (end = streamReturn.indexOf(" ", start + 2)) >= 2)
8 |8 j6 l$ ^* R: j- b            {7 w% @" y" c& d
                start += 2;
$ t( i9 g1 x6 U6 K9 }$ v( a                String strReadBatteryPercentage = streamReturn.substring(start, end);
/ z6 b* Y$ Y/ P7 S3 I9 `                try5 i0 p3 M7 K1 `/ _) x9 D
                {
9 B( {: f( D4 B  H                    int readBatteryPercentage = (new Integer(strReadBatteryPercentage)).intValue();- M5 {' p0 }" }" u  c4 E; X
                    if(readBatteryPercentage > currentChargeLevel)' I8 V% s& g1 M
                    {5 d9 D7 N$ U9 o& _- `$ x8 E
                        currentChargeLevel = readBatteryPercentage;- ~! M6 N% A1 f8 k
                        progress.updateJob(jobId, currentChargeLevel);: K8 W3 c, j2 [6 m
                        progress.commentOnJob(jobId, (new StringBuilder()).append("battery percentage changed: ").append(currentChargeLevel).toString());9 r& g" }# w1 e+ P, H5 ?
                    }
6 V) f' N( p2 H1 k2 E5 ?- V9 h                    Thread.sleep(500L);
) G# Y; C: r" M: J* y3 {) }8 I                }2 R( [; j* c5 r* ^2 _
                catch(NumberFormatException e)
' @5 O  x' q+ e; B/ l                {" e6 ?$ ~) Z" |
                    progress.commentOnJob(jobId, (new StringBuilder()).append("+++++").append(streamReturn).append("-----").toString());1 h$ ]) i4 {' P3 C( v
                }
2 g1 A; a+ M( x1 [5 N' m                catch(InterruptedException e) { }
) g1 c1 @4 Y2 w& K  S% ]# h            } else
6 u5 E' Q& m/ _/ y1 Z6 R( l            {& b7 ?) L4 }- c7 _: |4 {1 ~
                progress.commentOnJob(jobId, (new StringBuilder()).append("+++++").append(streamReturn).append("-----").toString());
- V, y4 g) u: f            }4 u! F3 S; c8 `# ~* K; Q+ y$ t4 m5 o
            stream.flush();. r9 W/ G& V* G  U- |) R
        } while(true);
5 z7 t8 ]8 X8 h  r/ c        stream.close();
- h+ o& n6 Y9 I) ~8 h! v) y- A    }/ d6 \8 v8 c) J9 j1 O

! v5 D0 ^* p, a: b$ n$ E1 D    public void run()% H8 V  n( I: N) T8 B
        throws NovacomException, IOException
# ?" k- a9 n) q2 v0 u7 _% Q4 Y9 l4 e2 i    {: L% }5 U2 [) F
        progress = getProgressHandler();
+ P4 T: d) C2 w' Q4 i3 Q% K        jobId = progress.startJob("Battery Charger Stage", 100);  X: K3 f; x2 F$ c7 g
        if(device.getState() != com.palm.novacom.Novacom.DeviceState.BOOTLOADER)
. J1 @! H1 ]. E        {! V( T! M1 e* H8 J. A5 V* @# W
            GoIntoUpdateModeStage intoUpdateMode = new GoIntoUpdateModeStage(device);
+ u9 s' f0 \$ f            intoUpdateMode.run();
1 p) F- \( c: t/ ~        }9 F; J0 [( ~  }5 \- V6 `7 `
        BootieUtilities bootie = new BootieUtilities(device);9 H- D! f- ~" T
        int currentPercentage = bootie.checkPowerStatus().intValue();# U) T/ Y) L6 ^) K
        if(REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage)" H3 H+ r* ^- x
        {
5 d4 l+ {  r1 I* K/ m" L* c            progress.commentOnJob(jobId, (new StringBuilder()).append("Battery at ").append(currentPercentage).append("%").toString());
; O6 k3 e! _5 Q6 d( M            int count = 0;
; B, Y6 q7 `3 ?7 C# b4 q            do2 Q, |7 M- N1 H2 s' S
            {
: U: ], _1 X7 \                progress.commentOnJob(jobId, "Battery Charging Started");" B' [; a/ y1 m5 Z
                progress.commentOnJob(jobId, (new StringBuilder()).append("Charging to Sufficient Power (").append(REQUIRED_POWER_PERCENTAGE).append("%), this may take a couple of minutes").toString());
* P7 ^5 q: I+ b! A. `3 q                chargeBattery();/ ^# ]4 ?4 T; z$ ~
                if(++count > RECHARGE_RETRY_COUNT.intValue())
( a8 `5 M& k& L' R  k' n5 w                    throw new NovacomException(-1, "failed to charge batttery");3 f+ @3 i; {6 b& Y
            } while(REQUIRED_POWER_PERCENTAGE.intValue() > currentChargeLevel);
' t! m- a  |6 v6 T; E. E        }: }/ A. T- @6 K+ Q  u# |
        progress.endJob(jobId);
, U2 z1 T! I" e$ U3 U( O    }
: x; J" ]- ]% k' q) ]( h0 H
1 p& M1 v! W5 ]/ r4 F! U    private static final Integer REQUIRED_POWER_PERCENTAGE = Integer.valueOf(25);. s4 S& f+ j3 N; F9 I( V
    private static final Integer RECHARGE_RETRY_COUNT = Integer.valueOf(5);
2 ~; j1 I8 t4 o$ \+ q0 o2 ]/ l    private final INovacomDevice device;  f, H9 ]6 }  e3 c
    private Object jobId;
5 `1 j9 j1 W2 D* t' O4 J; T    private IStageProgressReporter progress;
: \, d  W/ n* ?" q  X* i; o( b    private int currentChargeLevel;1 S$ h# }& S$ m9 R7 f
1 d7 R* \" X5 i7 C2 z, e1 F, c: B& o
}' [# M# _" S' P

( E( L& z9 v3 x/ l2 i6 _7 P" J
, q  ^# L! L, u% l0 w1 Y求编译~~~~~~~~~~~~~~~~~
回复 支持 反对

使用道具 举报

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

本帖子中包含更多资源

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

×
回复 支持 反对

使用道具 举报

发表于 2012-7-13 01:04 | 显示全部楼层
phil_rem 发表于 2012-7-13 00:42
7 i) e% U* r; n# @4 H! `! J" T
如果目的是为了不让充电,那么把下面的代码注释掉就可以了。0 T# b* S* t& J- V0 o( y5 {
7 ~' ?) ]: y$ w) k: F
原来是这样:# ~$ [6 C  \6 v6 t! y2 e* l5 g/ q
BootieUtilities bootie = new BootieUtilities(this.device);
+ T+ m) E( n% p5 }* D% s# N    int currentPercentage = bootie.checkPowerStatus().intValue();- |# U: v0 a% G- l3 `+ P2 K3 U
    if (REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage) {- E+ M, b. b, a$ E3 z8 v% {
      this.progress.commentOnJob(this.jobId, "Battery at " + currentPercentage + "%");5 U1 ^5 U+ }' _' M" s1 `0 X
      int count = 0;
/ o0 f5 ^  D& n* w4 |8 i7 x2 B      do {7 a- W2 w, I) M& o+ |. D+ _# i5 _
        this.progress.commentOnJob(this.jobId, "Battery Charging Started");6 L- x( B- P9 H+ ^# f' U$ d* y+ s
        this.progress.commentOnJob(this.jobId, "Charging to Sufficient Power (" + REQUIRED_POWER_PERCENTAGE + "%), this may take a couple of minutes");# ^6 j1 J1 ~! X" @- A8 V
        chargeBattery();0 c, c" q( W, n& u) Y
# Y) ]/ z0 K/ l- B
        count++;
6 J! A8 x6 H( i: z( N+ ?, B        if (count > RECHARGE_RETRY_COUNT.intValue())
8 w+ a# h! P5 k          throw new NovacomException(-1, "failed to charge batttery");% _& H; L* t/ ~3 j3 ?; r
      }' @* C0 w: U6 Q$ C( }- q
      while (REQUIRED_POWER_PERCENTAGE.intValue() > this.currentChargeLevel);0 {# A1 i) w& t# g
    }
$ Y8 L4 q/ A, E* y2 {4 Z. F9 H5 M  u9 W/ U3 N3 I- V' q! c" V
    this.progress.endJob(this.jobId);
; {: f& i- G9 U: X+ z, P
% _9 V2 W. q% P. }+ W; T" {0 j注释掉变这样:$ j+ T; f$ k  L1 B) j3 l( {
BootieUtilities bootie = new BootieUtilities(this.device);  P. G1 e8 a8 i( ^& c
    int currentPercentage = bootie.checkPowerStatus().intValue();, h6 C% e8 n! V( @( Q
    /*if (REQUIRED_POWER_PERCENTAGE.intValue() > currentPercentage) {9 d! c) ]! c$ u8 O
      this.progress.commentOnJob(this.jobId, "Battery at " + currentPercentage + "%");
! o* ]8 c) H" ]2 K1 L* K      int count = 0;0 Y' W! x% b8 S6 D  i5 F# j
      do {7 S9 M" _  `9 _
        this.progress.commentOnJob(this.jobId, "Battery Charging Started");
2 s; z8 q+ a- h( T        this.progress.commentOnJob(this.jobId, "Charging to Sufficient Power (" + REQUIRED_POWER_PERCENTAGE + "%), this may take a couple of minutes");9 j, O! g; V) W5 B5 w4 t& s3 ~
        chargeBattery();
3 S4 f: h2 M6 H% [5 m/ o! k! j7 k/ Q. \0 f+ ]
        count++;
+ i7 Y9 n. G, t, O1 Q5 D$ V        if (count > RECHARGE_RETRY_COUNT.intValue())) {7 ?& Y0 e1 r, a) ~( I
          throw new NovacomException(-1, "failed to charge batttery");
: R: ~7 ^: ^( j; |. `      }
, E4 r- ~+ Q9 D3 X6 v      while (REQUIRED_POWER_PERCENTAGE.intValue() > this.currentChargeLevel);
; G; T) G1 U; H    }*/
" g/ o4 N0 Z3 A3 [+ W
5 \' w! ?+ @+ S  S" C    this.progress.endJob(this.jobId);
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-20 14:11 , Processed in 0.491632 second(s), 17 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

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