Exemple #1
0
 public void dumpProperties() throws IOException, X10FlashException {
   TextFile tazone = new TextFile("./tazone.ta", "ISO8859-1");
   tazone.open(false);
   TextFile tazoneS = new TextFile("./tazoneString.ta", "ISO8859-1");
   tazoneS.open(false);
   try {
     MyLogger.getLogger().info("Start Dumping properties");
     MyLogger.initProgress(4920);
     for (int i = 0; i < 4920; i++) {
       MyLogger.getLogger()
           .debug((new StringBuilder("%%% read property id=")).append(i).toString());
       cmd.send(Command.CMD12, BytesUtil.getBytesWord(i, 4), false);
       String reply = cmd.getLastReplyHex();
       String replyS = cmd.getLastReplyString();
       reply = reply.replace("[", "");
       reply = reply.replace("]", "");
       reply = reply.replace(",", "");
       if (cmd.getLastReplyLength() > 0) {
         tazone.writeln(
             HexDump.toHex(i)
                 + " "
                 + HexDump.toHex(cmd.getLastReplyLength())
                 + " "
                 + reply.trim());
         tazoneS.writeln(
             HexDump.toHex(i)
                 + " "
                 + HexDump.toHex(cmd.getLastReplyLength())
                 + " "
                 + replyS.trim());
       }
     }
     MyLogger.initProgress(0);
     tazone.close();
     tazoneS.close();
     MyLogger.getLogger().info("Dumping properties finished.");
     DeviceChangedListener.pause(false);
     closeDevice();
   } catch (Exception ioe) {
     tazone.close();
     tazoneS.close();
     MyLogger.initProgress(0);
     MyLogger.getLogger().error(ioe.getMessage());
     MyLogger.getLogger().error("Error dumping properties. Aborted");
     DeviceChangedListener.pause(false);
     closeDevice();
   }
 }
 public static void exit() {
   DeviceChangedListener.stop();
   if (phoneWatchdog != null) {
     phoneWatchdog.done();
     try {
       phoneWatchdog.join();
     } catch (Exception e) {
     }
   }
   MyLogger.writeFile();
   System.exit(0);
 }
Exemple #3
0
  public void flashDevice() {
    try {
      MyLogger.getLogger().info("Start Flashing");
      MyLogger.initProgress(getNumberPasses());

      init();

      sendImages();
      sendSystemAndUserData();

      if (_bundle.hasTA()) {
        setFlashState(true);
        if (_bundle.hasPreset()) sendTA(_bundle.getPreset().getInputStream(), "preset");
        // if (_bundle.hasSimlock()) sendTA(_bundle.getSimlock().getInputStream(),"simlock");
        setFlashState(false);
      }

      cmd.send(Command.CMD10, Command.VALNULL, false);
      cmd.send(Command.CMD04, Command.VALNULL, false);

      closeDevice();

      MyLogger.getLogger().info("Flashing finished.");
      MyLogger.getLogger().info("Please wait. Phone will reboot");
      MyLogger.getLogger()
          .info("For flashtool, Unknown Sources and Debugging must be checked in phone settings");
      MyLogger.initProgress(0);
      DeviceChangedListener.pause(false);
    } catch (Exception ioe) {
      closeDevice();
      MyLogger.getLogger().error(ioe.getMessage());
      MyLogger.getLogger().error("Error flashing. Aborted");
      MyLogger.initProgress(0);
      DeviceChangedListener.pause(false);
    }
  }
 public static void init(boolean withadb) {
   MyLogger.disableTextArea();
   MyLogger.setLevel("info");
   MyLogger.getLogger().info("Flashtool " + About.getVersion());
   FlasherGUI.guimode = false;
   if (withadb) {
     StatusListener phoneStatus =
         new StatusListener() {
           public void statusChanged(StatusEvent e) {
             if (!e.isDriverOk()) {
               MyLogger.getLogger().error("Drivers need to be installed for connected device.");
               MyLogger.getLogger().error("You can find them in the drivers folder of Flashtool.");
             } else {
               if (e.getNew().equals("adb")) {
                 MyLogger.getLogger().info("Device connected with USB debugging on");
                 MyLogger.getLogger().debug("Device connected, continuing with identification");
                 doIdent();
               }
               if (e.getNew().equals("none")) {
                 MyLogger.getLogger().info("Device disconnected");
               }
               if (e.getNew().equals("flash")) {
                 MyLogger.getLogger().info("Device connected in flash mode");
               }
               if (e.getNew().equals("fastboot")) {
                 MyLogger.getLogger().info("Device connected in fastboot mode");
               }
               if (e.getNew().equals("normal")) {
                 MyLogger.getLogger().info("Device connected with USB debugging off");
                 MyLogger.getLogger()
                     .info("For 2011 devices line, be sure you are not in MTP mode");
               }
             }
           }
         };
     phoneWatchdog = new AdbPhoneThread();
     phoneWatchdog.start();
     phoneWatchdog.addStatusListener(phoneStatus);
   } else DeviceChangedListener.start();
 }