Ticket #588 (new enhancement)

Opened 6 years ago

Last modified 5 years ago

support extended addresses on (newer?) Motorola Phones

Reported by: felixmoeller Owned by: andrewb
Priority: normal Milestone:
Component: Plugin: moto Version: 0.38
Severity: normal Keywords:
Cc:

Description

I have a Razr V3i which kind of works with opensync. But the addresses (i.e. street and co) get lost during sync.

The extended attributes are retrieved with the AT*MPBRE AT-command

at+mode=2
OK
AT+CPBS="AD"
OK
at+mpbre=106
+MPBRE:
106,1,"017000000",129,"FirstnameLastname",3,0,255,0,1,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

Looking at the details of each record I found out the following meanings of the elements:

field - meaning:
1 - entry-id in the telephone
2 - is the entry count within one contact. 1-7 are telephone-numbers.
8+9 are e-mail addresses. 10+11 are internet-addresses, 12+13 are
personal-addresses (e.g. street and city)
3 - telephone number / email / www-address/ address
4 - 129, 145 and 128 as with at+mpbr
5 - the full name in concatenated form.
6 - type of number: 0->Office, 1->Private, 3->Mobile, 4->Fax, 5-> Pager,
11->Misc, 12->email, 18->www-address, 15->Home-address,
16->Work-address, 17->other-address
7 - "0"
8 - "255"
9 - "0"
10 - the first number is "1" all others are "0" (maybe preferred number?)
11 - category. 1->miscalanious, 2->friends, 3->family, 4->business,
12 - "255"
13 - "0"
14 - Numbers of letters in the first name to divide the string in field 5
15 - filepath to contact photo. seem to be at "/e/mobile/picture/"
16 - "0"
17 - "0"
18 - ""
19 - ""
20 - ""
21 - ""
22 - ""
23 - ""
24 - nickname
25 - the birthday
26 - file path to ring tone. seem to be saved at "/a/mobile/audio/"
27 - notes for an addressbook entry.

One complete phone entry looks like the following:

at+mpbre=106
+MPBRE: 106,1,"017000000",129,"FirstnameLastname",3,0,255,0,1,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE:	 106,2,"0251000001",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,3,"0251110110",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,4,"555588862423",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,5,"556556456",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,6,"5665623",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,7,"555555886",129,"FirstnameLastname",3,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,8,"mail@mail.de",128,"FirstnameLastname",12,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,9,"mail2@mail.de",128,"FirstnameLastname",12,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,10,"www.www.de",128,"FirstnameLastname",18,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,11,"www.www2.de",128,"FirstnameLastname",18,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","","notes"

+MPBRE: 106,12,"Street;|;Misc;|;City;|;State;|;48100;|;Country",128,"FirstnameLastname",15,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","N"

+MPBRE: 106,13,";|;Address;|;;|;;|;;|;",128,"FirstnameLastname",15,0,255,0,0,1,255,0,9,"",0,0,"","","","","","","Nickname","09-25-1999","""

Change History

comment:1 Changed 6 years ago by felixmoeller

Because of my need to backup the phone I hacked up the following patch which might be of interest for somebody. Therefore I add it here:

--- svn/branch-0.2X/plugins/moto-sync/motosync.py	2007-09-08 00:48:41.000000000 +0200
+++ eclipse/motosync/src/motosync.py	2007-09-13 13:11:00.000000000 +0200
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 """
  opensync plugin for syncing to a Motorola mobile phone
  HIGHLY EXPERIMENTAL, USE AT YOUR OWN RISK!
@@ -606,24 +607,42 @@
         pos = self.min_contact_pos
         while pos <= self.max_contact_pos and len(ret) < inuse:
             end = min(pos + ENTRIES_PER_READ - 1, self.max_contact_pos)
-            data = self.__do_cmd('AT+MPBR=%d,%d' % (pos, end))
-            ret.extend(self.__parse_results('MPBR', data))
+            data = self.__do_cmd('AT+MPBRE=%d,%d' % (pos, end))
+            ret.extend(self.__parse_results('MPBRE', data))
             pos += ENTRIES_PER_READ
         return ret
 
     def write_contact(self, data):
         """write a single contact to the position specified in the data list"""
         self.close_calendar()
+        currentId = data[0];
+        # lastIdWritten is the place on the phone where the last entry got saved to
+        # lastIdGotten is the last id that came in. It is used to decide whether to make a new entry.
+        global lastIdWritten, lastIdGotten
+        try:
+            lastIdWritten
+        except:
+            lastIdWritten=None;
+            lastIdGotten=None;
         # HACK: the email/number and birthday (index 1&23) must not be unicode 
-        for n in [1, 23]: 
-            if len(data) > n and type(data[n]) == types.UnicodeType: 
-                data[n] = data[n].encode('ascii') 
-        self.__do_cmd('AT+MPBW=' + self.__to_cmd_str(data)) 
+        for n in [2,4,23,24]: 
+            if len(data) > n and type(data[n]) == types.UnicodeType:
+                data[n] = data[n].encode('utf8')
+        if currentId == lastIdGotten:
+            # addition to the last entry
+            self.__do_cmd('AT+MPBWE='+str(lastIdWritten)+','+ self.__to_cmd_str(data[1:]))
+        else:
+            # new entry
+            lastIdGotten = currentId
+            self.__do_cmd('AT+CSCS="UTF8"')
+            data = self.__do_cmd('AT+MPBWE=,' + self.__to_cmd_str(data[1:]))
+            # to complete this entry, one has to know the id on the phone, therefore saving it
+            lastIdWritten = self.__parse_results('MPBWE', data)[0][0]
 
     def delete_contact(self, pos):
         """delete the contact at a given position"""
         self.close_calendar()
-        self.__do_cmd('AT+MPBW=%d' % pos, WRITE_ENABLED)
+        self.__do_cmd('AT+MPBWE=%d' % pos, WRITE_ENABLED)
 
     def __readchar(self):
         """read a single character from the phone device"""

which makes mototool --restore, --delete, --backup work but breaks OpenSync?. ;)

comment:2 Changed 6 years ago by andrewb

  • Type changed from defect to enhancement

comment:3 Changed 6 years ago by felixmoeller

Somehow I wrote in the description of this bug that I have a V3i but it is a RAZRV3xv. To really identify this phone here is the output of lsusb -v.

Bus 002 Device 008: ID 22b8:3002 Motorola PCS A835 GSM Phone
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x22b8 Motorola PCS
  idProduct          0x3002 A835 GSM Phone
  bcdDevice            0.01
  iManufacturer           1 Motorola Inc.
  iProduct                2 Motorola Phone (RAZRV3xv)
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           67
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 Motorola Communication Class
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              5 Motorola Communication Interface
      CDC Header:
        bcdCDC               1.01
      CDC Call Management:
        bmCapabilities       0x03
          call management
          use DataInterface
        bDataInterface          1
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x8b  EP 11 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface             16 Motorola Data Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

comment:4 Changed 6 years ago by felixmoeller

  • Version changed from 0.33 to 0.34

To keep the tickets clean update to current. Sorry for the second mail. ;)

comment:5 Changed 5 years ago by tuju

  • Version changed from 0.34 to 0.38
Note: See TracTickets for help on using tickets.