Solved my problem using memory card on mobile (Pantech Burst)

Micro SD
I had an 8Gb micro SD card which I was using with my old mobile phone to keep all my personal data. It was working without any problem and was good.
However when I tried to use this micro SD card with my new Pantech Burst mobile phone, it started giving message that SD card is damaged. Then I checked it with my PC, old mobile and it was working. Now I am little confused an checked again with Pantech Burst and it showed again SD card damaged and asked me to try formatting the card.
So I took the backup of the card, and then choose format from the phone. However after formatting also, it gave the same error. Now I thought it is because of the card incompatibility with phone. But when I put the  card back to PC, I found it formatted.

Now how does the card got formatted, if it is not compatible to my phone? I did some research and found the problem.

  • SD cards are not like ordinary flash drive.
  • They have options to encrypt and many other stuff compared to flash drive.
  • In-order to properly format a [micro] SD card special utility "SD Formatter" is necessary.
  • Some times the cheap SD cards will be corrupted and causes problem while read/write.
"The SD Formatter was created specifically for memory cards using the SD/SDHC/SDXC standards. It is strongly recommended to use the SD Formatter instead of formatting utilities provided with operating systems that format various types of storage media. Using generic formatting utilities may result in less than optimal performance for your memory cards."
 From https://www.sdcard.org


Now these are the magic steps which made my micro SD card working with my mobile phone.
  1. Used this utility to check whether SD card contains any error and fix it.
  2. Formatted SD card with "SD Formatter".
And now my phone has no complaint :-)

SD card test in progerss (flash drive can be tested too)
SD Card formatter







Removed AT&T bloatwars from my Pantech burst android mobile after rooting


I recently received my new Pantech Burst P9070 mobile ordered from ebay. I was very much impressed with its performance, but later found the built in AT&T apps very annoying. Though there is an option to hide the apps, it still remained in the ROM. Some cases those apps will be running in the background and consuming some of the precious energy from battery.

So I decided to remove those apps from my Pantech Burst. Since the applications were in ROM, first necessary this is to get the phone rooted. I followed the instructions in this forum.

After rooting, Sysetm ROM Toolbox(which did not show all apps) can be used to remove the system apps(AT&T apps present in ROM) or use ES File Explorer to manually remove.

  1. Open ES File explorer and select settings
    •  
  2. Open menu Root settings
    •  
  3. Check all the options
  4. Now come back to the explorer, if the options are selected on a rooted phone, then press up till root folder
    •  
  5. Now go to /sysem/app folder where all system(ROM) apps are seen
  6. Long press the apps to be deleted and select the delete option to remove the app. Some apps has odex files also, which can also be deleted
If you are familiar with linux, then it is also possible to use adb. adb files can be download from this forum, which is actually for rooting. But using shell, it is possible to list the /system/bin directory and delete(before that /system has to be remounted as read-write).





Solved Xperia U battery drain issue after ICS upgrage


After updating my SONY Xperia U to ICS, battery drain was a very big problem. I tried lot of applications for fixing this but nothing worked and many things made it worse.
While checking the battery usage, I could see android is in the top list consuming almost 60 to 70% of the battery. For getting more information about battery, I tried the better battery stats app and found kworker threads are main contributors.
After searching a lot, I read in some forum that the problem is caused due to some incompatible settings present which is carried over from gingerbread.
So I did a factory reset and found the problem still exists. Again I am disappointed.
After checking in the settings, I found option to backup app settings to Google account and restore it when app is installed again. So what was happening is after the factory reset, since I have selected the restore option, settings were restored from gingerbread version.
Now that I have found the real problem, I did the following steps to fix the issue.
  1. Deselected the backup option, which erased the gingerbread settings stored with Google.
  2. Did a factory reset and found battery life of my xperia u improved :-) and lasted for almost two days





Open file dialog exe for vbScript

I searched a lot in google to find a good method to show a file open dialog using vbScript. Eventhough there was some method already available, those were have limitations which makes the method not useful in many cases.
So I created this exe which will take some information as command line parameter and writes the file name to iostream. This information can be now read using the script and be used.

Example for Open File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim objWshShell, objExec
Dim strExecCmd
Dim tmp

strExecCmd = """" & strScriptPath & "OpnFile.exe"""
strExecCmd = strExecCmd & " ""1""""Hex File (*.hex)""""*.hex""""Hex""""Open Hex File"""


Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strExecCmd)

Do While objExec.Status = 0
     WScript.Sleep 100
Loop

If objExec.ExitCode = 0 Then
    tmp = Split(objExec.StdOut.ReadLine(), "~")
    strHexFile = tmp(0)
    MsgBox "Save file " & strHexFile
Else
    WScript.Quit
End If 

Example for Save File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
Dim objWshShell, objExec
Dim strExecCmd
Dim tmp

strExecCmd = """" & strScriptPath & "OpnFile.exe"""
strExecCmd = strExecCmd & " ""0""""Hex File (*.hex)""""*.hex""""Hex""""Save Hex File"""


Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec(strExecCmd)

Do While objExec.Status = 0
     WScript.Sleep 100
Loop

If objExec.ExitCode = 0 Then
    tmp = Split(objExec.StdOut.ReadLine(), "~")
    strHexFile = tmp(0)
    MsgBox "Save file " & strHexFile
Else
    WScript.Quit
End If 


Screenshots



You can download the example scripts here. I have also published a post about another script which uses this technique.






vbscript for detecting usb serial com port number (can be used with avrdude for programming avr)

I was using the adruino bootloader on a ATmega32 and for uploading the new firmware is done using avrdude. Initially I was using a windows batch file to upload the content. Since the development board contains an FTDI chip for USB to serial conversion(same in arduino boards), the driver will assign different com port number for  different PC/board combination for which it was necessary to update the com port number manually. So I thought of writing a vbscript to automatically detect the correct com port and run the avrdude.
I started searching in google for the help. There was scripts to list the serial ports(Win32_SerialPort), but that does not list the USB serial devices. Then I found that using wmi services it is possible to parse through the Plug and Play(PnP) devices in windows(Win32_PnPEntity). Another thing I found is the name string for each device will contain the comport number also.

PnP device information for the FTDI chip in my development board
Class GUID: {4D36E978-E325-11CE-BFC1-08002BE10318} 
Description: USB Serial Port 
Device ID: FTDIBUS\VID_0403+PID_6001+A700DZAFA\0000
Manufacturer: FTDI 
Name: USB Serial Port (COM4) 
PNP Device ID: FTDIBUS\VID_0403+PID_6001+A700DZAFA\0000
Service: FTSER2K 

Same name string is also showed as the name of the device if we open the windows device manager.
The  script I have listed below will use the Name string to find the com port and then uses it.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
' +----------------------------------------------------------------------------+
' |                                 Arun                                       |
' |                           frmkla@gmail.com                                 |
' |                     http://collectns.blogspot.com                          |
' |----------------------------------------------------------------------------|
' |            Copyright (c) 1998-2011 Arun. All rights reserved.              |
' +----------------------------------------------------------------------------+

Option Explicit

Const BAUDRATE = "19200" 'Set "" if baud rate setting is not necessary
Const AVR_PARTNO = "m32"

Dim strPortName' As String
Dim objArgs
Dim strHexFile
Dim strScriptPath
    
strScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "") 

Set objArgs = WScript.Arguments

strPortName = GetComPort

If strPortName = "" Then
    MsgBox "Cannot find the USB COM Port" & vbCrLf & "Please verify the USB conncetion"
Else
    If objArgs.Count <> 1 Then
        'MsgBox "Usage " & WScript.ScriptName &" <Hex File>"
        Dim objWshShell, objExec
        Dim strExecCmd
        Dim tmp
        
        strExecCmd = """" & strScriptPath & "OpnFile.exe"""
        strExecCmd = strExecCmd & " ""1""""Hex File (*.hex)""""*.hex""""Hex""""Open Hex File"""
        

        Set objWshShell = CreateObject("WScript.Shell")
        Set objExec = objWshShell.Exec(strExecCmd)

        Do While objExec.Status = 0
             WScript.Sleep 100
        Loop

        If objExec.ExitCode = 0 Then
            tmp = Split(objExec.StdOut.ReadLine(), "~")
            strHexFile = tmp(0)
        Else
            WScript.Quit
        End If 
    Else
        strHexFile = objArgs.Item(0)
    End If
    
    Dim oShell
    Dim strRunCMD
    

    'Generate command string
    strRunCMD = """" & strScriptPath & "avrdude"" "
    strRunCMD = strRunCMD & "-C " & """" & strScriptPath & "avrdude.conf"" "
    strRunCMD = strRunCMD & "-p" & AVR_PARTNO & " -cstk500v1 -P\\.\" & strPortName
    If (BAUDRATE <> "") Then strRunCMD = strRunCMD & " -b" & BAUDRATE
    strRunCMD = strRunCMD & " -D -Uflash:w:""" & strHexFile & """:i"

    'Execute the upload command
    Set oShell = WScript.CreateObject ("WScript.Shell")
    oShell.run strRunCMD
    'Wscript.Echo strRunCMD
    Set oShell = Nothing
End If

'
Function GetComPort()
    Dim strComputer
    Dim objWMIService
    Dim colItems
    Dim objItem
    Dim objRgx 'As RegExp
    Dim objRegMatches 'As MatchCollection
    Dim strDevName
    

    GetComPort = ""
    
    strComputer = "."
    Set objWMIService = GetObject( _
        "winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * from Win32_PnPEntity")
    For Each objItem In colItems
        If ("FTSER2K" = objItem.Service) And ("FTDI" = objItem.Manufacturer) Then
             
            set objRgx = CreateObject("vbScript.RegExp")
            

            strDevName = objItem.Name
            objRgx.Pattern = "COM[0-9]+"
            Set objRegMatches = objRgx.Execute(strDevName)
            If objRegMatches.Count = 1 Then
                GetComPort = objRegMatches.Item(0).Value
            Else
            End If
        End If
    Next
End Function

In the script listed above, the function GetComPort returns retruns the comport number if the port is detected, else it will return empty string "". This script also uses an exe file OpenFile.exe to show the open file dialog box.

Click here to download a copy of the script with avrdude and other support files.







Popular Posts