Re: DMv6 Patch

"Aaron G. Stemen" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
In addition to Nathan's patch, here is a patch adding the VX9100.  Most 
of the items worked out of the box, but I had to make a change for the 
phone book that will need to be tested well.

I had to change the getphonebook() method in the com_lgvx8550.py file so 
as it iterates through the phone entries, it stops after the Nth entry 
based on the maximum number of phone book entries for the 
protocolclass.  The error seems to be caused by an extraneous entry at 
the end of the file enclosed with <HPE></HPE> tags and contains at least 
the model name.  After making the change, I was able to read and write 
the phone book.  Unfortunately, I don't have any other LG phones to test 
the routine to make sure that the last phone book entry isn't getting 
truncated.

I was unable to get SMS reads working.  It appears that the SMS messages 
may be longer than previous models.  The first point of failure is 
retrieving the sender.  The sender name starts at a later offset in the 
index.dat file for the message.

Here is the error message:
20:06:03.341 Exception: BitPim version: trunk-bitpim-developer build
An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
  File "D:\projects\bitpim\src\gui.py", line 284, in run
    res=call()
  File "D:\projects\bitpim\src\gui.py", line 159, in __call__
    return apply(self.method, self.args+args, d)
  File "D:\projects\bitpim\src\gui.py", line 1909, in getdata
    i[1](results)
  File "D:\projects\bitpim\src\phones\com_lgvx4400.py", line 131, in getsms
    result['sms']=self._readsms()
  File "D:\projects\bitpim\src\phones\com_lgvx8800.py", line 69, in _readsms
    entry=self._getinboxmessage(sf)
  File "D:\projects\bitpim\src\phones\com_lgvx4400.py", line 197, in 
_getinboxmessage
    txt+=self._get_text_from_sms_msg_with_header(sf.msgs[i].msg, 
sf.msglengths[i].msglength)
  File "D:\projects\bitpim\src\prototypes.py", line 1486, in __getitem__
    return self._thelist[index]
IndexError: list index out of range

Variables by last 8 frames, innermost last

Frame run in D:\projects\bitpim\src\gui.py at line 277
       resultcb =  <gui.Callback instance at 0x04B28648>
            res =  None
           self =  <WorkerThread(BitPim helper, started daemon)>
           item =  (<gui.Request instance at 0x04A730A8>, <gui.Callback 
instance at 0x04B28648>)
           call =  <gui.Request instance at 0x04A730A8>
             ex =  IndexError('list index out of range',)
              e =  IndexError('list index out of range',)
          first =  0

Frame __call__ in D:\projects\bitpim\src\gui.py at line 159
           self =  <gui.Request instance at 0x04A730A8>
           args =  ()
              d =  Keys []
                   {}
         kwargs =  Keys []
                   {}

Frame getdata in D:\projects\bitpim\src\gui.py at line 1909
          count =  1
        results =  Keys ['canned_msg', 'groups', 'ringtone-index', 
'sync', 'uniqueserial', 'wallpaper-index']
                   {'uniqueserial': 
'e7335acee96c9db865b06bd06e4840a026fe4cd2', 'sync': {'sms': 'ME
              i =  (<bound method GetPhoneDialog.GetSMSSetting of 
<guiwidgets.GetPhoneDialog; proxy
           self =  <WorkerThread(BitPim helper, started daemon)>
            req =  <guiwidgets.GetPhoneDialog; proxy of <Swig Object of 
type 'wxDialog *' at 0x45a6
       willcall =  [(<bound method GetPhoneDialog.GetSMSSetting of 
<guiwidgets.GetPhoneDialog; prox
           sync =  Keys ['sms']
                   {'sms': 'MERGE'}
             st =  0
           todo =  [(<bound method WorkerThread.rebootcheck of 
<WorkerThread(BitPim helper, started

Frame getsms in D:\projects\bitpim\src\phones\com_lgvx4400.py at line 131
           self =  <phones.com_lgvx9100.Phone object at 0x06CDEF90>
         result =  Keys ['canned_msg', 'groups', 'ringtone-index', 
'sync', 'uniqueserial', 'wallpaper-index']
                   {'uniqueserial': 
'e7335acee96c9db865b06bd06e4840a026fe4cd2', 'sync': {'sms': 'ME

Frame _readsms in D:\projects\bitpim\src\phones\com_lgvx8800.py at line 69
            res =  Keys []
                   {}
           self =  <phones.com_lgvx9100.Phone object at 0x06CDEF90>
            buf =  <prototypes.buffer object at 0x06C02FD0>
             sf =  <phones.p_lgvx8500.sms_in object at 0x06C02D70>
           item =  <phones.p_lgvx8800.indexentry object at 0x06BF16D0>

Frame _getinboxmessage in D:\projects\bitpim\src\phones\com_lgvx4400.py 
at line 197
              i =  10
          entry =  <sms.SMSEntry object at 0x04CD0A90>
           self =  <phones.com_lgvx9100.Phone object at 0x06CDEF90>
            txt =  
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0
             sf =  <phones.p_lgvx8500.sms_in object at 0x06C02D70>

Frame __getitem__ in D:\projects\bitpim\src\prototypes.py at line 1486
          index =  10
           self =  <prototypes.LIST object at 0x06C136F0>


Also, I was unable to get BitPim to read the items from Notepad.  I 
think these are the "Memo" items, but I'm not sure.  There was no error, 
it just didn't retrieve anything.

Here is the list of items that I tested and the results:

read file system - ok
write file system - ok
read phone book - ok
write phone book - OK? (the phone resets after writing the phone book 
every time)
read calendar - ok
write calendar - ok (the phone seemed to reset randomly.  I wasn't able 
to reproduce it every time)
read wallpaper - ok
write wallpaper - ok
read ringers - ok
write ringers - ok
read memo - FAILED (I think that this is supposed to read the items from 
the Notepad tool, but nothing was displayed.)
write memo - did not test (this may not be an available option for this 
phone)
read SMS - FAILED (get sender fails, then an error message follows on the )
write SMS - did not test
read call history - ok
read T9 editor - ok
write T9 editor - ok

Thanks for doing the hard work on this Nathan!

-Aaron


Nathan Hjelm wrote:
> After spending some time looking at challenges/responses and assembly 
> code I can say I have DMv6 about 95% figured out. DMv6 phones respond 
> to the 0xfe 0x00 command with a 0xfe 0x02 response (as opposed to 0xfe 
> 0x01). The response is then a 0xfe 0x03 command containing an XOR of 
> the DMv5 response mixed in with random numbers. The random numbers 
> appear to have an effect on the locations of the key bytes (something 
> I haven't had a chance to fully investigate) so for now I have 
> hard-coded some "random" values for which the locations of the XOR 
> bytes are known.
>
> Attached is the patch to enables DMv6 (which used on the VX-9100 and 
> newer Verizon LG phones). I have verified that the changes do no 
> interfere with the DMv5 code and that the code does indeed appear to 
> work with the VX-9100.
>
>
>
> -Nathan
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ------------------------------------------------------------------------
>
> _______________________________________________
> BitPim-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bitpim-devel

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
BitPim-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
VX9100.patch (text/plain, 6.4 KB)
Index: src/phones/__init__.py
===================================================================
--- src/phones/__init__.py	(revision 4618)
+++ src/phones/__init__.py	(working copy)
@@ -174,6 +174,11 @@
                              'brand': b_lg,
                              'helpid': helpids.ID_PHONE_LGVX8800,
                              },
+              'LG-VX9100': { 'module': 'com_lgvx9100',
+                             'carrier': [c_vzw],
+                             'brand': b_lg,
+                             'helpid': None,
+                             },
               'LG-VX9400': { 'module': 'com_lgvx9400',
                              'carrier': [c_vzw],
                              'brand': b_lg,
Index: src/phones/com_lgvx8550.py
===================================================================
--- src/phones/com_lgvx8550.py	(revision 4618)
+++ src/phones/com_lgvx8550.py	(working copy)
@@ -268,13 +268,15 @@
         picid_pathf=self._get_path_index(self.protocolclass.WPPathIndexFile)
 
         numentries = 0
-
+        currententrynum = 0
+        
         pbook={}
         for pb_entry in pb_entries.items:
-            # skip blank entries
-            if pb_entry.entry_number1 == 0xffffffffL:
+            # skip blank entries and keep track of the number of entries
+            # going beyond the limit causes errors (start with 1 
+            currententrynum += 1
+            if pb_entry.entry_number1 == 0xffffffffL or currententrynum > self.protocolclass.NUMPHONEBOOKENTRIES:
                 continue
-
             try:
                 self.log("Parse entry "+`numentries`+" - " + pb_entry.name)
                 entry=self.extractphonebookentry(pb_entry, pb_numbers, speeds, result,
Index: src/phones/com_lgvx9100.py
===================================================================
--- src/phones/com_lgvx9100.py	(revision 0)
+++ src/phones/com_lgvx9100.py	(revision 0)
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+### BITPIM
+###
+### Copyright (C) 2008 Nathan Hjelm <[email protected]>
+###
+### This program is free software; you can redistribute it and/or modify
+### it under the terms of the BitPim license as detailed in the LICENSE file.
+
+
+"""
+Communicate with the LG VX9100 cell phone.
+"""
+
+# BitPim modules
+import common
+import com_brew
+import prototypes
+import com_lgvx10000
+import p_lgvx9100
+import helpids
+
+#-------------------------------------------------------------------------------
+parentphone=com_lgvx10000.Phone
+class Phone(parentphone):
+    desc="LG-VX9100"
+    protocolclass=p_lgvx9100
+    serialsname='lgvx9100'
+
+    my_model='VX9100'
+
+    def setDMversion(self):
+        self._DMv5=True
+        self._timeout=5
+
+    # Fundamentals:
+    #  - get_esn             - same as LG VX-8300
+    #  - getgroups           - same as LG VX-8700
+    #  - getwallpaperindices - LGUncountedIndexedMedia
+    #  - getringtoneindices  - LGUncountedIndexedMedia
+    #  - DM Version          - 6
+    #  - phonebook           - same as LG VX-8550
+
+#-------------------------------------------------------------------------------
+parentprofile=com_lgvx10000.Profile
+class Profile(parentprofile):
+    protocolclass=Phone.protocolclass
+    serialsname=Phone.serialsname
+
+    BP_Calendar_Version=3
+    phone_manufacturer='LG Electronics Inc'
+    phone_model='VX9100'
+    # inside screen resoluation
+    WALLPAPER_WIDTH  = 400
+    WALLPAPER_HEIGHT = 240
+
+    imageorigins={}
+    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
+    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))
+    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images(sd)"))
+    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video(sd)"))
+
+    # our targets are the same for all origins
+    imagetargets={}
+    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "outsidelcd",
+                                      {'width': 240, 'height': 400, 'format': "JPEG"}))
+    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
+                                      {'width': 400, 'height': 240, 'format': "JPEG"}))
+    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid",
+                                      {'width': 120, 'height': 100, 'format': "JPEG"}))
+
+    _supportedsyncs=(
+        ('phonebook', 'read', None),  # all phonebook reading
+        ('calendar', 'read', None),   # all calendar reading
+        ('wallpaper', 'read', None),  # all wallpaper reading
+        ('ringtone', 'read', None),   # all ringtone reading
+        ('call_history', 'read', None),# all call history list reading
+        ('sms', 'read', None),         # all SMS list reading
+        ('memo', 'read', None),        # all memo list reading
+        ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
+        ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
+        ('wallpaper', 'write', 'MERGE'),      # merge and overwrite wallpaper
+        ('wallpaper', 'write', 'OVERWRITE'),
+        ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
+        ('ringtone', 'write', 'OVERWRITE'),
+        ('sms', 'write', 'OVERWRITE'),        # all SMS list writing
+        ('memo', 'write', 'OVERWRITE'),       # all memo list writing
+##        ('playlist', 'read', 'OVERWRITE'),
+##        ('playlist', 'write', 'OVERWRITE'),
+        ('t9_udb', 'write', 'OVERWRITE'),
+        )
+    if __debug__:
+        _supportedsyncs+=(
+        ('t9_udb', 'read', 'OVERWRITE'),
+        )
Index: src/phones/p_lgvx9100.p
===================================================================
--- src/phones/p_lgvx9100.p	(revision 0)
+++ src/phones/p_lgvx9100.p	(revision 0)
@@ -0,0 +1,30 @@
+### BITPIM
+###
+### Copyright (C) 2008 Nathan Hjelm <[email protected]>
+###
+### This program is free software; you can redistribute it and/or modify
+### it under the terms of the BitPim license as detailed in the LICENSE file.
+###
+
+%{
+
+"""Various descriptions of data specific to LG VX9100"""
+
+from p_lgvx10000 import *
+
+NUMPHONEBOOKENTRIES=1000
+NUMPHONENUMBERENTRIES=5000
+
+# sizes of pbfileentry and pnfileentry
+PHONEBOOKENTRYSIZE=256
+PHONENUMBERENTRYSIZE=64
+
+NUM_EMAILS=2
+NUMPHONENUMBERS=5
+
+pb_file_name    = 'pim/pbentry.dat'
+pn_file_name    = 'pim/pbnumber.dat'
+speed_file_name = 'pim/pbspeed.dat'
+ice_file_name   = 'pim/pbiceentry.dat'
+
+%}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.