Another small patch (VX-8700)

Nathan Hjelm <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
Sorry for all of the little patches but I keep running across stuff that needs adjustment.

This patch is a few tweaks for the VX-8700:
- Enters DM mode when listing files to ensure read/write access.
- T-9 stuff now works as it does on the VX-8500 (was getting an error due to a missing class and variable).

-Nathan Hjelm

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
BitPim-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
vx8700_tweaks.diff (application/octet-stream, 4.7 KB)
Index: src/phones/p_lgvx8700.p
===================================================================
--- src/phones/p_lgvx8700.p	(revision 4221)
+++ src/phones/p_lgvx8700.p	(working copy)
@@ -15,6 +15,7 @@
 
 # we are the same as lgvx9900 except as noted below
 from p_lgvx9900 import *
+from p_lgvx8500 import t9udbfile
 
 # We use LSB for all integer like fields
 UINT=UINTlsb
@@ -22,15 +23,13 @@
 
 BREW_FILE_SYSTEM=2
 
+T9USERDBFILENAME='t9udb/t9udb_eng.dat'
+ 
 %}
 
 PACKET pbgroup:
     36 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False } name
 
-PACKET pbgroups:
-    "Phonebook groups"
-    * LIST {'elementclass': pbgroup} +groups
-
 PACKET ULReq:
     ""
     1 UINT { 'default': 0xFE } +cmd
Index: src/phones/com_lgvx8700.py
===================================================================
--- src/phones/com_lgvx8700.py	(revision 4221)
+++ src/phones/com_lgvx8700.py	(working copy)
@@ -97,6 +97,10 @@
         return com_brew.RealBrewProtocol2.getfilesystem(self, dir, recurse, directories, files)
 
     def listfiles(self, dir=''):
+        if self._in_DM==False:
+            # Assume the user will want to read/write some of the listed files. Enter DM mode to
+            # enable file read/write access.
+            self.enter_DM()
         return com_brew.RealBrewProtocol2.listfiles(self, dir)
 
     def enter_DM (self):
Index: src/phones/p_lgvx8700.py
===================================================================
--- src/phones/p_lgvx8700.py	(revision 4221)
+++ src/phones/p_lgvx8700.py	(working copy)
@@ -7,6 +7,7 @@
 
 # we are the same as lgvx9900 except as noted below
 from p_lgvx9900 import *
+from p_lgvx8500 import t9udbfile
 
 # We use LSB for all integer like fields
 UINT=UINTlsb
@@ -14,6 +15,8 @@
 
 BREW_FILE_SYSTEM=2
 
+T9USERDBFILENAME='t9udb/t9udb_eng.dat'
+ 
 class pbgroup(BaseProtogenClass):
     __fields=['name']
 
@@ -88,87 +91,6 @@
 
 
 
-class pbgroups(BaseProtogenClass):
-    "Phonebook groups"
-    __fields=['groups']
-
-    def __init__(self, *args, **kwargs):
-        dict={}
-        # What was supplied to this function
-        dict.update(kwargs)
-        # Parent constructor
-        super(pbgroups,self).__init__(**dict)
-        if self.__class__ is pbgroups:
-            self._update(args,dict)
-
-
-    def getfields(self):
-        return self.__fields
-
-
-    def _update(self, args, kwargs):
-        super(pbgroups,self)._update(args,kwargs)
-        keys=kwargs.keys()
-        for key in keys:
-            if key in self.__fields:
-                setattr(self, key, kwargs[key])
-                del kwargs[key]
-        # Were any unrecognized kwargs passed in?
-        if __debug__:
-            self._complainaboutunusedargs(pbgroups,kwargs)
-        if len(args):
-            dict2={'elementclass': pbgroup}
-            dict2.update(kwargs)
-            kwargs=dict2
-            self.__field_groups=LIST(*args,**dict2)
-        # Make all P fields that haven't already been constructed
-
-
-    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
-        'Writes this packet to the supplied buffer'
-        self._bufferstartoffset=buf.getcurrentoffset()
-        try: self.__field_groups
-        except:
-            self.__field_groups=LIST(**{'elementclass': pbgroup})
-        self.__field_groups.writetobuffer(buf)
-        self._bufferendoffset=buf.getcurrentoffset()
-        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)
-
-
-    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
-        'Reads this packet from the supplied buffer'
-        self._bufferstartoffset=buf.getcurrentoffset()
-        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
-        self.__field_groups=LIST(**{'elementclass': pbgroup})
-        self.__field_groups.readfrombuffer(buf)
-        self._bufferendoffset=buf.getcurrentoffset()
-
-
-    def __getfield_groups(self):
-        try: self.__field_groups
-        except:
-            self.__field_groups=LIST(**{'elementclass': pbgroup})
-        return self.__field_groups.getvalue()
-
-    def __setfield_groups(self, value):
-        if isinstance(value,LIST):
-            self.__field_groups=value
-        else:
-            self.__field_groups=LIST(value,**{'elementclass': pbgroup})
-
-    def __delfield_groups(self): del self.__field_groups
-
-    groups=property(__getfield_groups, __setfield_groups, __delfield_groups, None)
-
-    def iscontainer(self):
-        return True
-
-    def containerelements(self):
-        yield ('groups', self.__field_groups, None)
-
-
-
-
 class ULReq(BaseProtogenClass):
     ""
     __fields=['cmd', 'unlock_code', 'unlock_key', 'zero']
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.