Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r3857 - in
      trunk/src/target/OM-2007.2/applications/openmoko-dialer2: .
      src/phone-kit ([EMAIL PROTECTED])
   2. r3858 - in
      trunk/src/target/OM-2007.2/applications/openmoko-dialer2: .
      src/phone-kit ([EMAIL PROTECTED])
   3. r3859 - branches/src/target/kernel/2.6.24.x/patches
      ([EMAIL PROTECTED])
   4. r3860 - in developers/werner: . nandtilt
      ([EMAIL PROTECTED])
   5. r3861 - in trunk/src/target/gsm: include/gsmd src/gsmd
      src/util ([EMAIL PROTECTED])
--- Begin Message ---
Author: chris
Date: 2008-01-16 16:53:50 +0100 (Wed, 16 Jan 2008)
New Revision: 3857

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-control.c
Log:
        * src/phone-kit/moko-alsa-volume-control.c:
        (moko_alsa_volume_control_set_device_from_name):
        Finish implementing (didn't realise I left this unfinished): Fix
        infinite loop, get card name correctly and resolve alsa alias


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2008-01-16 15:24:27 UTC (rev 3856)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2008-01-16 15:53:50 UTC (rev 3857)
@@ -1,5 +1,12 @@
 2008-01-16  Chris Lord  <[EMAIL PROTECTED]>
 
+       * src/phone-kit/moko-alsa-volume-control.c:
+       (moko_alsa_volume_control_set_device_from_name):
+       Finish implementing (didn't realise I left this unfinished): Fix
+       infinite loop, get card name correctly and resolve alsa alias
+
+2008-01-16  Chris Lord  <[EMAIL PROTECTED]>
+
        * configure.ac:
        * src/phone-kit/Makefile.am:
        Add alsa to dependencies and compile volume control object/widget

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-control.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-control.c
   2008-01-16 15:24:27 UTC (rev 3856)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-control.c
   2008-01-16 15:53:50 UTC (rev 3857)
@@ -427,19 +427,30 @@
 
        while (snd_card_next (&i) == 0) {
                void **hints;
+               
+               if (i == -1) break;
        
                if (snd_device_name_hint (i, "pcm", &hints) == 0) {
+                       gchar *separator;
                        gchar *device = strdup (snd_device_name_get_hint (
-                               hints[0], "NAME"));
-                       snd_device_name_free_hint (hints);
-                       strchr (device, ':')[0] = '\0';
+                               hints[0], "DESC"));
                        
+                       if ((separator = strchr (device, ',')))
+                         *separator = '\0';
+                       
                        if (strcmp (device, name) == 0) {
+                               g_free (device);
+                               
+                               device = strdup (snd_device_name_get_hint (
+                                       hints[0], "NAME"));
+                               snd_device_name_free_hint (hints);
+                               strchr (device, ':')[0] = '\0';
+                               
                                moko_alsa_volume_control_set_device (
                                        control, device);
-                               g_free (device);
                                return;
                        }
+                       snd_device_name_free_hint (hints);
                        g_free (device);
                }
        }




--- End Message ---
--- Begin Message ---
Author: chris
Date: 2008-01-16 17:14:28 +0100 (Wed, 16 Jan 2008)
New Revision: 3858

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-scale.c
Log:
        * src/phone-kit/moko-alsa-volume-scale.c: (create_widgets):
        Remove rogue '.png' on the end of icon names


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2008-01-16 15:53:50 UTC (rev 3857)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog  
2008-01-16 16:14:28 UTC (rev 3858)
@@ -1,5 +1,10 @@
 2008-01-16  Chris Lord  <[EMAIL PROTECTED]>
 
+       * src/phone-kit/moko-alsa-volume-scale.c: (create_widgets):
+       Remove rogue '.png' on the end of icon names
+
+2008-01-16  Chris Lord  <[EMAIL PROTECTED]>
+
        * src/phone-kit/moko-alsa-volume-control.c:
        (moko_alsa_volume_control_set_device_from_name):
        Finish implementing (didn't realise I left this unfinished): Fix

Modified: 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-scale.c
===================================================================
--- 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-scale.c
     2008-01-16 15:53:50 UTC (rev 3857)
+++ 
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-alsa-volume-scale.c
     2008-01-16 16:14:28 UTC (rev 3858)
@@ -43,17 +43,17 @@
        else box = GTK_BOX (gtk_vbox_new (FALSE, 6));
        
        if (orientation == GTK_ORIENTATION_HORIZONTAL)
-               image = gtk_image_new_from_icon_name ("moko-volume-down.png",
+               image = gtk_image_new_from_icon_name ("moko-volume-down",
                        GTK_ICON_SIZE_SMALL_TOOLBAR);
-       else image = gtk_image_new_from_icon_name ("moko-volume-up.png",
+       else image = gtk_image_new_from_icon_name ("moko-volume-up",
                GTK_ICON_SIZE_SMALL_TOOLBAR);
        
        gtk_box_pack_start (box, image, FALSE, TRUE, 0);
        
        if (orientation == GTK_ORIENTATION_HORIZONTAL)
-               image = gtk_image_new_from_icon_name ("moko-volume-up.png",
+               image = gtk_image_new_from_icon_name ("moko-volume-up",
                        GTK_ICON_SIZE_SMALL_TOOLBAR);
-       else image = gtk_image_new_from_icon_name ("moko-volume-down.png",
+       else image = gtk_image_new_from_icon_name ("moko-volume-down",
                GTK_ICON_SIZE_SMALL_TOOLBAR);
        
        gtk_box_pack_end (box, image, FALSE, TRUE, 0);




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-01-17 05:34:04 +0100 (Thu, 17 Jan 2008)
New Revision: 3859

Added:
   branches/src/target/kernel/2.6.24.x/patches/fix-hwecc-2410.patch
Modified:
   branches/src/target/kernel/2.6.24.x/patches/series
Log:
NAND ECC error correction mis-calculated the bit position, thus turning a
correctable single-bit error into two errors. Fittingly, also reported
uncorrectable errors as success.

The NAND subsystem only does 512 byte reads even on large page NAND, so we can
use hardware ECC also on HXD8 and GTA02. Tests showed that this does indeed
work as expected.

series:
- added fix-hwecc-2410.patch
- commented out s3c2440-nand-disable-hwecc.patch, since this works, even
  without explicit large page support

fix-hwecc-2410.patch:
- drivers/mtd/nand/s3c2410.c (s3c2410_nand_correct_data): use Pn bits to
  calculate error position, not Pn'
- drivers/mtd/nand/s3c2410.c (s3c2410_nand_correct_data): don't report
  uncorrectable errors as "no error"



Added: branches/src/target/kernel/2.6.24.x/patches/fix-hwecc-2410.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/fix-hwecc-2410.patch    
2008-01-16 16:14:28 UTC (rev 3858)
+++ branches/src/target/kernel/2.6.24.x/patches/fix-hwecc-2410.patch    
2008-01-17 04:34:04 UTC (rev 3859)
@@ -0,0 +1,56 @@
+S3C24xx ECC mis-calculates the bit to flip:
+http://lists.infradead.org/pipermail/linux-mtd/2007-October/019586.html
+If the error couldn't be corrected, we returned "no problem" :-(
+http://lists.infradead.org/pipermail/linux-mtd/2007-October/019615.html
+
+Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
+
+Index: linux-2.6.24-rc7/drivers/mtd/nand/s3c2410.c
+===================================================================
+--- linux-2.6.24-rc7.orig/drivers/mtd/nand/s3c2410.c
++++ linux-2.6.24-rc7/drivers/mtd/nand/s3c2410.c
+@@ -364,23 +364,21 @@
+           ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
+               /* calculate the bit position of the error */
+ 
+-              bit  = (diff2 >> 2) & 1;
+-              bit |= (diff2 >> 3) & 2;
+-              bit |= (diff2 >> 4) & 4;
++              bit  = ((diff2 >> 3) & 1) |
++                     ((diff2 >> 4) & 2) |
++                     ((diff2 >> 5) & 4);
+ 
+               /* calculate the byte position of the error */
+ 
+-              byte  = (diff1 << 1) & 0x80;
+-              byte |= (diff1 << 2) & 0x40;
+-              byte |= (diff1 << 3) & 0x20;
+-              byte |= (diff1 << 4) & 0x10;
+-
+-              byte |= (diff0 >> 3) & 0x08;
+-              byte |= (diff0 >> 2) & 0x04;
+-              byte |= (diff0 >> 1) & 0x02;
+-              byte |= (diff0 >> 0) & 0x01;
+-
+-              byte |= (diff2 << 8) & 0x100;
++              byte = ((diff2 << 7) & 0x100) |
++                     ((diff1 << 0) & 0x80)  |
++                     ((diff1 << 1) & 0x40)  |
++                     ((diff1 << 2) & 0x20)  |
++                     ((diff1 << 3) & 0x10)  |
++                     ((diff0 >> 4) & 0x08)  |
++                     ((diff0 >> 3) & 0x04)  |
++                     ((diff0 >> 2) & 0x02)  |
++                     ((diff0 >> 1) & 0x01);
+ 
+               dev_dbg(info->device, "correcting error bit %d, byte %d\n",
+                       bit, byte);
+@@ -399,7 +397,7 @@
+       if ((diff0 & ~(1<<fls(diff0))) == 0)
+               return 1;
+ 
+-      return 0;
++      return -EBADMSG;
+ }
+ 
+ /* ECC functions

Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series  2008-01-16 16:14:28 UTC 
(rev 3858)
+++ branches/src/target/kernel/2.6.24.x/patches/series  2008-01-17 04:34:04 UTC 
(rev 3859)
@@ -58,7 +58,7 @@
 pm-debug_less_verbose.patch
 s3c2410_serial-nodebug.patch
 input-nots-mousedev.patch
-s3c2440-nand-disable-hwecc.patch
+#s3c2440-nand-disable-hwecc.patch
 
 # qt2410 local hacks
 qt2410-cs8900.patch
@@ -73,5 +73,8 @@
 atheros_2_0_hcd-patch
 atheros_2_0_sdio_stack.patch
 
+# bad bug
+fix-hwecc-2410.patch
+
 # Preliminary suspend/resume power saving improvements
 suspend-prelim1.patch




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-01-17 05:48:25 +0100 (Thu, 17 Jan 2008)
New Revision: 3860

Added:
   developers/werner/nandtilt/
   developers/werner/nandtilt/Makefile
   developers/werner/nandtilt/README
   developers/werner/nandtilt/mtd-abi.h
   developers/werner/nandtilt/nandtilt.c
Log:
A little utility to inflict bit errors on a NAND partition.



Added: developers/werner/nandtilt/Makefile
===================================================================
--- developers/werner/nandtilt/Makefile 2008-01-17 04:34:04 UTC (rev 3859)
+++ developers/werner/nandtilt/Makefile 2008-01-17 04:48:25 UTC (rev 3860)
@@ -0,0 +1,3 @@
+CFLAGS=-Wall -static
+
+nandtilt:      nandtilt.c

Added: developers/werner/nandtilt/README
===================================================================
--- developers/werner/nandtilt/README   2008-01-17 04:34:04 UTC (rev 3859)
+++ developers/werner/nandtilt/README   2008-01-17 04:48:25 UTC (rev 3860)
@@ -0,0 +1,19 @@
+nandtilt - Toggle some bits in NAND without updating the ECC
+============================================================
+
+usage: nandtilt device pos ...
+
+nandtilt writes one eraseblock (set to 128kB in the code) of 0xff bytes
+to the specified device. Bits at positions "pos" are cleared. The ECC
+is not updated.
+
+This can be used to simulate bit errors:
+
+flash_eraseall /dev/mtd5
+nandtilt /dev/mtd5 1 8192
+od -x </dev/mtd5
+
+This clears bit 0x02 of the first byte and bit 0x01 of the 1024th byte.
+Then we check if error correction was able to resolve the problem.
+
+mtd-abi.h is copied from mtd-utils.

Added: developers/werner/nandtilt/mtd-abi.h
===================================================================
--- developers/werner/nandtilt/mtd-abi.h        2008-01-17 04:34:04 UTC (rev 
3859)
+++ developers/werner/nandtilt/mtd-abi.h        2008-01-17 04:48:25 UTC (rev 
3860)
@@ -0,0 +1,158 @@
+/*
+ * $Id: mtd-abi.h,v 1.13 2005/11/07 11:14:56 gleixner Exp $
+ *
+ * Portions of MTD ABI definition which are shared by kernel and user space
+ */
+
+#ifndef __MTD_ABI_H__
+#define __MTD_ABI_H__
+
+#ifndef __KERNEL__ /* Urgh. The whole point of splitting this out into
+                   separate files was to avoid #ifdef __KERNEL__ */
+#define __user
+#endif
+
+struct erase_info_user {
+       uint32_t start;
+       uint32_t length;
+};
+
+struct mtd_oob_buf {
+       uint32_t start;
+       uint32_t length;
+       unsigned char __user *ptr;
+};
+
+#define MTD_ABSENT             0
+#define MTD_NORFLASH           3
+#define MTD_NANDFLASH          4
+#define MTD_DATAFLASH          6
+#define MTD_GENERIC_TYPE       7
+
+#define MTD_WRITEABLE          0x400   /* Device is writeable */
+#define MTD_BIT_WRITEABLE      0x800   /* Single bits can be flipped */
+#define MTD_NO_ERASE           0x1000  /* No erase necessary */
+
+// Some common devices / combinations of capabilities
+#define MTD_CAP_ROM            0
+#define MTD_CAP_RAM            (MTD_WRITEABLE | MTD_BIT_WRITEABLE | 
MTD_NO_ERASE)
+#define MTD_CAP_NORFLASH       (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
+#define MTD_CAP_NANDFLASH      (MTD_WRITEABLE)
+
+
+// Types of automatic ECC/Checksum available
+#define MTD_ECC_NONE           0       // No automatic ECC available
+#define MTD_ECC_RS_DiskOnChip  1       // Automatic ECC on DiskOnChip
+#define MTD_ECC_SW             2       // SW ECC for Toshiba & Samsung devices
+
+/* ECC byte placement */
+#define MTD_NANDECC_OFF                0       // Switch off ECC (Not 
recommended)
+#define MTD_NANDECC_PLACE      1       // Use the given placement in the 
structure (YAFFS1 legacy mode)
+#define MTD_NANDECC_AUTOPLACE  2       // Use the default placement scheme
+#define MTD_NANDECC_PLACEONLY  3       // Use the given placement in the 
structure (Do not store ecc result on read)
+#define MTD_NANDECC_AUTOPL_USR         4       // Use the given autoplacement 
scheme rather than using the default
+
+/* OTP mode selection */
+#define MTD_OTP_OFF            0
+#define MTD_OTP_FACTORY                1
+#define MTD_OTP_USER           2
+
+struct mtd_info_user {
+       uint8_t type;
+       uint32_t flags;
+       uint32_t size;   // Total size of the MTD
+       uint32_t erasesize;
+       uint32_t writesize;
+       uint32_t oobsize;   // Amount of OOB data per block (e.g. 16)
+       uint32_t ecctype;
+       uint32_t eccsize;
+};
+
+struct region_info_user {
+       uint32_t offset;                /* At which this region starts,
+                                        * from the beginning of the MTD */
+       uint32_t erasesize;             /* For this region */
+       uint32_t numblocks;             /* Number of blocks in this region */
+       uint32_t regionindex;
+};
+
+struct otp_info {
+       uint32_t start;
+       uint32_t length;
+       uint32_t locked;
+};
+
+#define MEMGETINFO             _IOR('M', 1, struct mtd_info_user)
+#define MEMERASE               _IOW('M', 2, struct erase_info_user)
+#define MEMWRITEOOB            _IOWR('M', 3, struct mtd_oob_buf)
+#define MEMREADOOB             _IOWR('M', 4, struct mtd_oob_buf)
+#define MEMLOCK                        _IOW('M', 5, struct erase_info_user)
+#define MEMUNLOCK              _IOW('M', 6, struct erase_info_user)
+#define MEMGETREGIONCOUNT      _IOR('M', 7, int)
+#define MEMGETREGIONINFO       _IOWR('M', 8, struct region_info_user)
+#define MEMSETOOBSEL           _IOW('M', 9, struct nand_oobinfo)
+#define MEMGETOOBSEL           _IOR('M', 10, struct nand_oobinfo)
+#define MEMGETBADBLOCK         _IOW('M', 11, loff_t)
+#define MEMSETBADBLOCK         _IOW('M', 12, loff_t)
+#define OTPSELECT              _IOR('M', 13, int)
+#define OTPGETREGIONCOUNT      _IOW('M', 14, int)
+#define OTPGETREGIONINFO       _IOW('M', 15, struct otp_info)
+#define OTPLOCK                        _IOR('M', 16, struct otp_info)
+#define ECCGETLAYOUT           _IOR('M', 17, struct nand_ecclayout)
+#define ECCGETSTATS            _IOR('M', 18, struct mtd_ecc_stats)
+#define MTDFILEMODE            _IO('M', 19)
+
+/*
+ * Obsolete legacy interface. Keep it in order not to break userspace
+ * interfaces
+ */
+struct nand_oobinfo {
+       uint32_t useecc;
+       uint32_t eccbytes;
+       uint32_t oobfree[8][2];
+       uint32_t eccpos[32];
+};
+
+struct nand_oobfree {
+       uint32_t offset;
+       uint32_t length;
+};
+
+#define MTD_MAX_OOBFREE_ENTRIES        8
+/*
+ * ECC layout control structure. Exported to userspace for
+ * diagnosis and to allow creation of raw images
+ */
+struct nand_ecclayout {
+       uint32_t eccbytes;
+       uint32_t eccpos[64];
+       uint32_t oobavail;
+       struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
+};
+
+/**
+ * struct mtd_ecc_stats - error correction status
+ *
+ * @corrected: number of corrected bits
+ * @failed:    number of uncorrectable errors
+ * @badblocks: number of bad blocks in this partition
+ * @bbtblocks: number of blocks reserved for bad block tables
+ */
+struct mtd_ecc_stats {
+       uint32_t corrected;
+       uint32_t failed;
+       uint32_t badblocks;
+       uint32_t bbtblocks;
+};
+
+/*
+ * Read/write file modes for access to MTD
+ */
+enum mtd_file_modes {
+       MTD_MODE_NORMAL = MTD_OTP_OFF,
+       MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
+       MTD_MODE_OTP_USER = MTD_OTP_USER,
+       MTD_MODE_RAW,
+};
+
+#endif /* __MTD_ABI_H__ */

Added: developers/werner/nandtilt/nandtilt.c
===================================================================
--- developers/werner/nandtilt/nandtilt.c       2008-01-17 04:34:04 UTC (rev 
3859)
+++ developers/werner/nandtilt/nandtilt.c       2008-01-17 04:48:25 UTC (rev 
3860)
@@ -0,0 +1,78 @@
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+#include "mtd-abi.h"
+
+#define ERASE_PAGE     (128*1024)
+
+
+static uint8_t buf[ERASE_PAGE];
+
+
+static void usage(const char *name)
+{
+       fprintf(stderr, "usage; %s device pos ...\n", name);
+       exit(1);
+}
+
+
+int main(int argc, char **argv)
+{
+       struct nand_oobinfo none_oobinfo = {
+               .useecc = MTD_NANDECC_OFF,
+       };
+       int i, pos, fd;
+       ssize_t wrote;
+       char *end;
+
+       memset(buf, 0xff, ERASE_PAGE);
+
+       if (argc < 2)
+               usage(*argv);
+       for (i = 2; i != argc; i++) {
+               pos = strtoul(argv[i], &end, 0);
+               if (*end)
+                       usage(*argv);
+               buf[pos >> 3] ^= 1 << (pos & 7);
+       }
+
+       fd = open(argv[1], O_WRONLY);
+       if (fd < 0) {
+               perror(argv[1]);
+               exit(1);
+       }
+       switch (ioctl(fd, MTDFILEMODE, (void *) MTD_MODE_RAW)) {
+       case -ENOTTY:
+               if (ioctl(fd, MEMSETOOBSEL, &none_oobinfo) != 0) {
+                       perror("MEMSETOOBSEL");
+                       close(fd);
+                       exit(1);
+               }
+               break;
+       case 0:
+               break;
+       default:
+               perror("MTDFILEMODE");
+               exit(1);
+       }
+
+       wrote = write(fd, buf, ERASE_PAGE);
+       if (wrote < 0) {
+               perror(argv[1]);
+               exit(1);
+       }
+       if (wrote != ERASE_PAGE) {
+               fprintf(stderr, "%s: short write: %d < %d\n", argv[1],
+                   (int) wrote, ERASE_PAGE);
+               exit(1);
+       }
+
+       return 0;
+}




--- End Message ---
--- Begin Message ---
Author: erin_yueh
Date: 2008-01-17 09:35:53 +0100 (Thu, 17 Jan 2008)
New Revision: 3861

Modified:
   trunk/src/target/gsm/include/gsmd/usock.h
   trunk/src/target/gsm/src/gsmd/sms_cb.c
   trunk/src/target/gsm/src/util/event.c
Log:
gsmd: fix CMT_parse comma error (Sean Chiang)


Modified: trunk/src/target/gsm/include/gsmd/usock.h
===================================================================
--- trunk/src/target/gsm/include/gsmd/usock.h   2008-01-17 04:48:25 UTC (rev 
3860)
+++ trunk/src/target/gsm/include/gsmd/usock.h   2008-01-17 08:35:53 UTC (rev 
3861)
@@ -386,6 +386,8 @@
        struct gsmd_addr addr;
 } __attribute__ ((packed));
 
+#define GSMD_ALPHA_MAXLEN      20
+
 /* call status from 3GPP TS 07.07 clause 07.17 */
 struct gsmd_call_status {
        int8_t idx;
@@ -395,7 +397,7 @@
        u_int8_t mpty;
        char number[GSMD_ADDR_MAXLEN+1];        
        u_int8_t type;
-       char alpha[8+1];
+       char alpha[GSMD_ALPHA_MAXLEN+1];
        int is_last;    
 } __attribute__ ((packed));
 
@@ -441,6 +443,7 @@
                        struct gsmd_addr addr;
                } colp;
                struct {
+                       char alpha[GSMD_ALPHA_MAXLEN+1];
                        int inlined;
                        u_int8_t memtype;
                        int index;
@@ -490,7 +493,7 @@
                struct {
                        struct gsmd_addr addr;
                        u_int8_t classx;
-                       char    alpha[16];
+                       char    alpha[GSMD_ALPHA_MAXLEN+1];
                        u_int8_t cli; 
                } ccwa;
        } u;

Modified: trunk/src/target/gsm/src/gsmd/sms_cb.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/sms_cb.c      2008-01-17 04:48:25 UTC (rev 
3860)
+++ trunk/src/target/gsm/src/gsmd/sms_cb.c      2008-01-17 08:35:53 UTC (rev 
3861)
@@ -39,6 +39,7 @@
 #include <gsmd/unsolicited.h>
 #include <gsmd/sms.h>
 #include <gsmd/talloc.h>
+#include <gsmd/extrsp.h>
 
 static const char *ts0705_memtype_name[] = {
        [GSM0705_MEMTYPE_NONE]          = "NONE",
@@ -431,9 +432,10 @@
 {
        /* TODO: TEXT mode */
        u_int8_t pdu[SMS_MAX_PDU_SIZE];
-       const char *comma = strchr(param, ',');
-       char *cr;
+       const char *cr = NULL;
        int i;
+       char tmp[64];
+       struct gsm_extrsp *er;
        struct gsmd_evt_auxdata *aux;
        struct gsmd_sms_list *msg;
        struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT,
@@ -446,16 +448,45 @@
        aux = (struct gsmd_evt_auxdata *) ucmd->buf;
        msg = (struct gsmd_sms_list *) aux->data;
 
-       if (!comma) {
+       cr = strchr(param, '\n');
+
+       if (!cr) {
                talloc_free(ucmd);
-               return -EINVAL;
+               return -EAGAIN;
        }
-       len = strtoul(comma + 1, &cr, 10);
-       if (cr[0] != '\n') {
+
+       strncpy(tmp, param, (cr-param));
+       tmp[(cr-param)] = '\0';
+
+       er = extrsp_parse(gsmd_tallocs, tmp);
+
+       if ( !er ) {
                talloc_free(ucmd);
-               return -EAGAIN;
+               return -ENOMEM;
        }
 
+       //extrsp_dump(er);      
+
+       if ( er->num_tokens == 2 && 
+                       er->tokens[0].type == GSMD_ECMD_RTT_EMPTY &&
+                       er->tokens[1].type == GSMD_ECMD_RTT_NUMERIC ) {
+
+               aux->u.sms.alpha[0] = '\0';
+               len = er->tokens[1].u.numeric; 
+       }
+       else if ( er->num_tokens == 2 && 
+                       er->tokens[0].type == GSMD_ECMD_RTT_STRING &&
+                       er->tokens[1].type == GSMD_ECMD_RTT_NUMERIC ) {
+
+               strcpy(aux->u.sms.alpha, er->tokens[0].u.string);
+               len = er->tokens[1].u.numeric; 
+       }
+       else {
+               talloc_free(ucmd);
+               talloc_free(er);
+               return -EINVAL;
+       }
+
        cr ++;
        for (i = 0; cr[0] >= '0' && cr[1] >= '0' && i < SMS_MAX_PDU_SIZE;
                        i ++) {

Modified: trunk/src/target/gsm/src/util/event.c
===================================================================
--- trunk/src/target/gsm/src/util/event.c       2008-01-17 04:48:25 UTC (rev 
3860)
+++ trunk/src/target/gsm/src/util/event.c       2008-01-17 08:35:53 UTC (rev 
3861)
@@ -64,6 +64,8 @@
                                (sms->time_stamp[6] & 8) ? '-' : '+',
                                (((sms->time_stamp[6] << 4) |
                                  (sms->time_stamp[6] >> 4)) & 0x3f) >> 2);
+               if ( strlen(aux->u.sms.alpha) )           
+                       printf("From %s\n", aux->u.sms.alpha);
                if (sms->payload.coding_scheme == ALPHABET_DEFAULT) {
                        unpacking_7bit_character(&sms->payload, payload);
                        printf("\"%s\"\n", payload);




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to