Changes to add Samsung m520 detection (and little else)

"Vallevand, Mark K" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <CE091CB077F4A74A9CBA33A4E4A8A3BF0F3E8B68@USEA-EXCH4.na.uis.unisys.com>
Here are the diffs to add support for the Samsung m520.  Two new files,
two updated files.  The code does little more than detect the phone.
But, it's a start...  I hope I didn't break anything.

 

Next, I'm going to try to figure out what commands the m520 understands.

 

 

Regards. 
Mark K Vallevand

We old folks have to find our cushions and pillows in our tankards.
Strong beer is the milk of the old.
- Martin Luther


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-------------------------------------------------------------------------
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
diff.txt (text/plain, 5.4 KB)
Index: src/helpids.py
===================================================================
--- src/helpids.py	(revision 4614)
+++ src/helpids.py	(working copy)
@@ -76,6 +76,7 @@
 ID_PHONE_SAMSUNGSCHU470="phone-samsungschu470.htm"
 ID_PHONE_SAMSUNGSCHU740="phone-samsungschu740.htm"
 ID_PHONE_SAMSUNGSPHM300="phone-samsungsphm300.htm"
+ID_PHONE_SAMSUNGSPHM520="phone-samsungsphm520.htm"
 ID_PHONE_SANYOOTHERS="phones-sanyo.htm"
 ID_PHONE_SANYOSCP6600="phones-sanyo-scp6600.htm"
 ID_PHONE_TOSHIBAVM4050="phone-toshiba_vm4050.htm"
Index: src/phones/__init__.py
===================================================================
--- src/phones/__init__.py	(revision 4614)
+++ src/phones/__init__.py	(working copy)
@@ -381,6 +381,11 @@
                                  'brand': b_samsung,
                                  'helpid': helpids.ID_PHONE_SAMSUNGSPHM300,
                                },
+              'SPH-M520': { 'module': 'com_samsungsphm520',
+                            'carrier': [c_sprint],
+                            'brand': b_samsung,
+                            'helpid': helpids.ID_PHONE_SAMSUNGSPHM520,
+                            },
               'SPH-N200': { 'module': 'com_samsungsphn200',
                             'carrier': [c_sprint],
                             'brand': b_samsung,
Index: src/phones/com_samsungsphm520.py
===================================================================
--- src/phones/com_samsungsphm520.py	(revision 0)
+++ src/phones/com_samsungsphm520.py	(revision 0)
@@ -0,0 +1,92 @@
+### BITPIM
+###
+### Copyright (C) 2007 Joe Pham <[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.
+###
+### $Id: com_samsungsphm520pim.py 4473 2007-11-29 22:36:56Z djpham $
+
+"""Communicate with the Samsung SPH-M520 through the modem port"""
+
+import sha
+
+import com_samsung
+import commport
+import com_samsung_packet
+import helpids
+import p_samsungsphm520
+
+parentphone=com_samsung_packet.Phone
+class Phone(parentphone):
+    "Talk to a Samsung SPH-M520 phone"
+
+    desc="SPH-M520"
+    helpid=helpids.ID_PHONE_SAMSUNGSPHM520
+    protocolclass=p_samsungsphm520
+    serialsname='sphm520'
+
+    def __init__(self, logtarget, commport):
+        parentphone.__init__(self, logtarget, commport)
+        self.mode=self.MODENONE
+
+    @classmethod
+    def detectphone(_, coms, likely_ports, res, _module, _log):
+        for port in likely_ports:
+            res[port]['model']=''
+            res[port]['manufacturer']=''
+            res[port]['firmware_version']=''
+            res[port]['esn']=''
+            try:
+                _comm=commport.CommConnection(_log, port)
+                _comm.sendatcommand('Z')
+                _comm.sendatcommand('')
+                _model=_comm.sendatcommand('+GMM')[0]
+                _manuf=_comm.sendatcommand('+GMI')[0]
+                _fwver=_comm.sendatcommand('+GMR')[0]
+                _esn=_comm.sendatcommand('+GSN')[0]
+                _comm.close()
+                if _model==_module.Profile.phone_model:
+                    res[port]['model']=_model
+                    res[port]['manufacturer']=_manuf.split(': ')[1:]
+                    res[port]['firmware_version']=_fwver.split(': ')[1:]
+                    res[port]['esn']=_esn
+                    return port
+            except:
+                _comm.close()
+
+    def _setmodephonebooktobrew(self):
+        raise NotImplementedError('BREW mode not available')
+
+    def _setmodemodemtobrew(self):
+        raise NotImplementedError('BREW mode not available')
+ 
+    def getfundamentals(self, results):
+        """Gets information fundamental to interopating with the phone and UI."""
+
+        # use a hash of ESN and other stuff (being paranoid)
+        self.log("Retrieving fundamental phone information")
+        self.log("Phone serial number")
+        self.setmode(self.MODEMODEM)
+        results['uniqueserial']=sha.new(self.get_esn()).hexdigest()
+        self.log("Fundamentals retrieved")
+        return results
+
+    getwallpapers=NotImplemented
+    getringtones=NotImplemented
+    getcallhistory=NotImplemented
+    getplaylist=NotImplemented
+    gett9db=NotImplemented
+
+parentprofile=com_samsung_packet.Profile
+class Profile(parentprofile):
+    protocolclass=Phone.protocolclass
+    serialsname=Phone.serialsname
+
+    usbids=( ( 0x04E8, 0x6640, 0),
+             ( 0x04E8, 0x6640, 2))
+    deviceclasses=("modem","serial")
+    
+    phone_manufacturer='SAMSUNG'
+    phone_model='SPH-M520/154'
+
Index: src/phones/p_samsungsphm520.p
===================================================================
--- src/phones/p_samsungsphm520.p	(revision 0)
+++ src/phones/p_samsungsphm520.p	(revision 0)
@@ -0,0 +1,21 @@
+### BITPIM
+###
+### Copyright (C) 2007 Joe Pham <[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.
+###
+### $Id: p_samsungsphm520.p 4473 2007-11-29 22:36:56Z djpham $
+
+%{
+# Text in this block is placed in the output file
+
+from prototypes import *
+from prototypes_samsung import *
+from p_samsung_packet import *
+
+%}
+
+# Packets describe single line AT responses or commands with no carriage
+# returns or line feeds.
+
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.