This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GSM modem interfacing in android

Other Parts Discussed in Thread: AM1808

Hi all,

I am running android on TI AM1808 Controller and it is working fine, now i want to interface a quectel gsm modem to it via a usb to serial cable.
I have added the usb-to serial driver to the kernel and i can communicate with modem.

I have added following to build.prop
rild.libpath=/system/lib/libreference-ril.so

rild.libargs=-d /dev/ttyUSB0


Also i have changed
external/am1808evm/BoardConfig.mk
TARGET_NO_RADIOIMAGE=false

My init entry for RILD is as follows.
loglevel 4

service ril-daemon /system/bin/rild
    socket rild stream 666 root radio
    socket rild-debug stream 666 radio system
    user root                 
    group radio cache inet misc audio

the log i am getting is as follows
/ # logcat -b radio
D/RILD    (  720): overriding with -d /dev/ttyUSB0
I/RIL     (  720): Opening tty device /dev/ttyUSB0
D/AT      (  720): AT> ATE0Q0V1
D/AT      (  720): AT< OK
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> ATE0Q0V1
D/AT      (  720): AT> ATS0=0
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CSQ
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CMEE=1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CREG=2
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CREG=1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CGREG=1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CCWA=1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CMOD=0
D/AT      (  720): AT< OK
D/AT      (  720): AT> AT+CMUT=0
D/AT      (  720): AT< OK
D/AT      (  720): AT> AT+CSSN=0,1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+COLP=0
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CSCS="HEX"
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CUSD=1
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CGEREP=1,0
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CMGF=0
D/AT      (  720): AT< ERROR
D/AT      (  720): AT> AT+CFUN?
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR
D/AT      (  720): AT< ERROR

Could you please guid me to debug this error.


  • Are you able to communicate with the modem directly over the serial interface?

    i.e using busybox microcom or equivalent terminal client can you send AT commands to the modem and get correct responses?

    EDIT: I am sorry, you seem to have already performed this test.

  • You will also need to verify if the modem initilization AT commands that the reference RIL sends matches the ones required by your modem.

  • Well I fergot to metion in my post that

    if i try to call from the prompt with

    at > /dev/ttyUSB0 or ATDxxxxxxxxxx;> /dev/ttyUSB0 it works fine.

    but one thins i could not understand though my android after boot shows baseband version as UNKNOWN ?

    why is so? do i need to set it manually ?

    and where do i need to modify the modem's initial commands? (referances-ril.c)

  • You can find  some information related to RIL in the Android PDK porting guide. Unfortunately  the web source at source.android.com is not available anymore. However you can view the javadoc version shipped with AOSP at development/pdk/docs/porting/telephony.jd

    rowboat link : http://gitorious.org/rowboat/development/blobs/rowboat-gingerbread/pdk/docs/porting/telephony.jd

    I have not worked with RIL. I hope someone else might be able to help you with your particular issue.

  • Hi

    Can anyboady tell me how to change/check Airplane mode setting for android from source code?

  • Just to updated i got it working 2-3 days back.
    communication between rild and socket was not proper and telephony
    needed default network show flag.

  • Hi Mahesh,

    Could you elaborate  your steps., how did you succeed? what is the "default network show flag"?  I am trying over beagleboard c3 with android gingerbread 2.3.4 2_1 sources available at the same site.

    I have connected the modem to beagleboard via USB HUB to which I have connected keyboard and mouse. 

    Best regards,

    Rakesh.M

  • Hi,

    1 make sure you have assigned right device to your modem from

      /system/core/init/devices.c

    { "/dev/ttyUSB0",        0666,   AID_RADIO,     AID_RADIO,  0 },

    also after boot check this using ls -l you should see radio radio or radio system type for modem device.

     

    2. make sure that the modem commands are proper for your modem

    check with

    hardware/ril/reference-ril/reference-ril.c

    Also make sure that you are opening proper device from this file i.e. mainloop() in my case it is "/dev/ttyUSB"

     

    3.  change the init.rc as

    /init.rc

    loglevel 4 instead of 3

    service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
    -- -d /dev/ttyUSB0

    ----- OR -------

    add these to build.prop

    rild.libpath=/system/lib/libreference-ril.so

    rild.libargs=-d /dev/ttyUSB0

     

    4. at the compile time compile the image for actual device( specify radio = yes)  instade  of emulator.

    5. add following to build. prop

    ro.radio.noril=yes

    ro.telephony.default_network=1   #( 1= gsm n/w only )

    6. i used following command-line argument at boot time

    "android.ril=ttyUSB0"

     

    just for understanding we are using here reference-ril lib as our radio lib it will be replaced with the vendor specific radio lib as per the base band chip used.

     

    after doing these changes and cross-checking the logcat (logcat -b radio) you should get your modem working.

    also if you are working with the device slower than 400 MHz then wait for some time around 2-3 min (i suppose) so that the android ui shos the range stk and telephony manager in that case needs more time.

    also i would suggest try to communicate with modem from the command line.

     

    Hope this helps you

     

    cheers

    Mahesh

  • Mahesh,

    Thanks for the details. I'm sure this information would be helpful to many users.

    -Vishveshwar

  • Hi Mahesh,

                           We have ported android Froyo on AM1808 processor successfully from sdcard. But my problem is i cant access serial port (read, write) using com port.

    I have downloaded android serial port API (.apk file) from link  http://code.google.com/p/android-serialport-api/downloads/list  . After i installed this .apk file on my android device iam getting force close error.

     i have set permissions too.

    Can you please help me out in this issue. Thanks in advance.

    Regards

    Pooja.

  • Hi Pooja,

    Did you made the chages i have mention in my earlier post, please cross check it. try communicating with DBGU port 1st. Also are you able to see any prints on terminal with prints i mean boot prints? what all entries you see(related to uart) on your android device when you do ls -l /dev?  Did you enabled your uart from kernel?

    I am trying to understand your exact problem.

    Regards

    Mahesh

  • Hi Mahesh,

    I hav done changes as per your reply.

    But the following output on my device after command along with other listed items

    # ls -l /dev

    crwxrwxrwx     system     system   4,   ttyS1

    crw---------      root         root        4,    ttyS0

    crw---------      root         root        4,    ttyS2

    Iam totally confused with this serial port access from android application.

    Regards

    Pooja.

  • Hi Pooja,

    please check your uart status in  /system/core/init/devices.c file.

    It should show you proper user permissions please refer to my earlier post for reference.

    Also try to make a call from the shell prompt if it succeed then try to run ur apk.

    proceed in stepwise manner.

    Regards

    Mahesh.

  • Hi Team ,

    i am porting ICS to DM37xx ,

    in my /system/core/init/devices.c file the structure  perms_devperms[] is not present , can any one point me how to do the

    { "/dev/ttyUSB0",        0666,   AID_RADIO,     AID_RADIO,  0 },

    device permission in ICS  or can i add the structure to the device.c file

    my device.c file ....

    * Copyright (C) 2007 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */

    #include <errno.h>
    #include <stddef.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <sys/stat.h>
    #include <sys/types.h>

    #include <fcntl.h>
    #include <dirent.h>
    #include <unistd.h>
    #include <string.h>

    #include <sys/socket.h>
    #include <sys/un.h>
    #include <linux/netlink.h>
    #include <private/android_filesystem_config.h>
    #include <sys/time.h>
    #include <asm/page.h>
    #include <sys/wait.h>

    #include <cutils/list.h>
    #include <cutils/uevent.h>

    #include "devices.h"
    #include "util.h"
    #include "log.h"

    #define SYSFS_PREFIX    "/sys"
    #define FIRMWARE_DIR1   "/etc/firmware"
    #define FIRMWARE_DIR2   "/vendor/firmware"

    static int device_fd = -1;

    struct uevent {
        const char *action;
        const char *path;
        const char *subsystem;
        const char *firmware;
        const char *partition_name;
        const char *country;
        int partition_num;
        int major;
        int minor;
    };

    struct perms_ {
        char *name;
        char *attr;
        mode_t perm;
        unsigned int uid;
        unsigned int gid;
        unsigned short prefix;
    };

    struct perm_node {
        struct perms_ dp;
        struct listnode plist;
    };

    struct platform_node {
        char *name;
        int name_len;
        struct listnode list;
    };

    static list_declare(sys_perms);
    static list_declare(dev_perms);
    static list_declare(platform_names);

    int add_dev_perms(const char *name, const char *attr,
                      mode_t perm, unsigned int uid, unsigned int gid,
                      unsigned short prefix) {
        struct perm_node *node = calloc(1, sizeof(*node));
        if (!node)
            return -ENOMEM;

        node->dp.name = strdup(name);
        if (!node->dp.name)
            return -ENOMEM;

        if (attr) {
            node->dp.attr = strdup(attr);
            if (!node->dp.attr)
                return -ENOMEM;
        }

        node->dp.perm = perm;
        node->dp.uid = uid;
        node->dp.gid = gid;
        node->dp.prefix = prefix;

        if (attr)
            list_add_tail(&sys_perms, &node->plist);
        else
            list_add_tail(&dev_perms, &node->plist);

        return 0;
    }

    void fixup_sys_perms(const char *upath)
    {
        char buf[512];
        struct listnode *node;
        struct perms_ *dp;

            /* upaths omit the "/sys" that paths in this list
             * contain, so we add 4 when comparing...
             */
        list_for_each(node, &sys_perms) {
            dp = &(node_to_item(node, struct perm_node, plist))->dp;
            if (dp->prefix) {
                if (strncmp(upath, dp->name + 4, strlen(dp->name + 4)))
                    continue;
            } else {
                if (strcmp(upath, dp->name + 4))
                    continue;
            }

            if ((strlen(upath) + strlen(dp->attr) + 6) > sizeof(buf))
                return;

            sprintf(buf,"/sys%s/%s", upath, dp->attr);
            INFO("fixup %s %d %d 0%o\n", buf, dp->uid, dp->gid, dp->perm);
            chown(buf, dp->uid, dp->gid);
            chmod(buf, dp->perm);
        }
    }

    static mode_t get_device_perm(const char *path, unsigned *uid, unsigned *gid)
    {
        mode_t perm;
        struct listnode *node;
        struct perm_node *perm_node;
        struct perms_ *dp;

        /* search the perms list in reverse so that ueventd.$hardware can
         * override ueventd.rc
         */
        list_for_each_reverse(node, &dev_perms) {
            perm_node = node_to_item(node, struct perm_node, plist);
            dp = &perm_node->dp;

            if (dp->prefix) {
                if (strncmp(path, dp->name, strlen(dp->name)))
                    continue;
            } else {
                if (strcmp(path, dp->name))
                    continue;
            }
            *uid = dp->uid;
            *gid = dp->gid;
            return dp->perm;
        }
        /* Default if nothing found. */
        *uid = 0;
        *gid = 0;
        return 0600;
    }

    static void make_device(const char *path,
                            const char *upath,
                            int block, int major, int minor)
    {
        unsigned uid;
        unsigned gid;
        mode_t mode;
        dev_t dev;

        mode = get_device_perm(path, &uid, &gid) | (block ? S_IFBLK : S_IFCHR);
        dev = makedev(major, minor);
        /* Temporarily change egid to avoid race condition setting the gid of the
         * device node. Unforunately changing the euid would prevent creation of
         * some device nodes, so the uid has to be set with chown() and is still
         * racy. Fixing the gid race at least fixed the issue with system_server
         * opening dynamic input devices under the AID_INPUT gid. */
        setegid(gid);
        mknod(path, mode, dev);
        chown(path, uid, -1);
        setegid(AID_ROOT);
    }

    static void add_platform_device(const char *name)
    {
        int name_len = strlen(name);
        struct listnode *node;
        struct platform_node *bus;

        list_for_each_reverse(node, &platform_names) {
            bus = node_to_item(node, struct platform_node, list);
            if ((bus->name_len < name_len) &&
                    (name[bus->name_len] == '/') &&
                    !strncmp(name, bus->name, bus->name_len))
                /* subdevice of an existing platform, ignore it */
                return;
        }

        INFO("adding platform device %s\n", name);

        bus = calloc(1, sizeof(struct platform_node));
        bus->name = strdup(name);
        bus->name_len = name_len;
        list_add_tail(&platform_names, &bus->list);
    }

    /*
     * given a name that may start with a platform device, find the length of the
     * platform device prefix.  If it doesn't start with a platform device, return
     * 0.
     */
    static const char *find_platform_device(const char *name)
    {
        int name_len = strlen(name);
        struct listnode *node;
        struct platform_node *bus;

        list_for_each_reverse(node, &platform_names) {
            bus = node_to_item(node, struct platform_node, list);
            if ((bus->name_len < name_len) &&
                    (name[bus->name_len] == '/') &&
                    !strncmp(name, bus->name, bus->name_len))
                return bus->name;
        }

        return NULL;
    }

    static void remove_platform_device(const char *name)
    {
        struct listnode *node;
        struct platform_node *bus;

        list_for_each_reverse(node, &platform_names) {
            bus = node_to_item(node, struct platform_node, list);
            if (!strcmp(name, bus->name)) {
                INFO("removing platform device %s\n", name);
                free(bus->name);
                list_remove(node);
                free(bus);
                return;
            }
        }
    }

    #if LOG_UEVENTS

    static inline suseconds_t get_usecs(void)
    {
        struct timeval tv;
        gettimeofday(&tv, 0);
        return tv.tv_sec * (suseconds_t) 1000000 + tv.tv_usec;
    }

    #define log_event_print(x...) INFO(x)

    #else

    #define log_event_print(fmt, args...)   do { } while (0)
    #define get_usecs()                     0

    #endif

    static void parse_event(const char *msg, struct uevent *uevent)
    {
        uevent->action = "";
        uevent->path = "";
        uevent->subsystem = "";
        uevent->firmware = "";
        uevent->country = "";
        uevent->major = -1;
        uevent->minor = -1;
        uevent->partition_name = NULL;
        uevent->partition_num = -1;

            /* currently ignoring SEQNUM */
        while(*msg) {
            if(!strncmp(msg, "ACTION=", 7)) {
                msg += 7;
                uevent->action = msg;
            } else if(!strncmp(msg, "DEVPATH=", 8)) {
                msg += 8;
                uevent->path = msg;
            } else if(!strncmp(msg, "SUBSYSTEM=", 10)) {
                msg += 10;
                uevent->subsystem = msg;
            } else if(!strncmp(msg, "FIRMWARE=", 9)) {
                msg += 9;
                uevent->firmware = msg;
            } else if(!strncmp(msg, "MAJOR=", 6)) {
                msg += 6;
                uevent->major = atoi(msg);
            } else if(!strncmp(msg, "MINOR=", 6)) {
                msg += 6;
                uevent->minor = atoi(msg);
            } else if(!strncmp(msg, "PARTN=", 6)) {
                msg += 6;
                uevent->partition_num = atoi(msg);
            } else if(!strncmp(msg, "PARTNAME=", 9)) {
                msg += 9;
                uevent->partition_name = msg;
            } else if (!strncmp(msg, "COUNTRY=", 8)) {
                msg += 8;
                uevent->country = msg;
            }

                /* advance to after the next \0 */
            while(*msg++)
                ;
        }

        log_event_print("event { '%s', '%s', '%s', '%s', %d, %d, '%s' }\n",
                        uevent->action, uevent->path, uevent->subsystem,
                        uevent->firmware, uevent->major, uevent->minor,
                        uevent->country);
    }

    static char **get_character_device_symlinks(struct uevent *uevent)
    {
        const char *parent;
        char *slash;
        char **links;
        int link_num = 0;
        int width;

        if (strncmp(uevent->path, "/devices/platform/", 18))
            return NULL;

        links = malloc(sizeof(char *) * 2);
        if (!links)
            return NULL;
        memset(links, 0, sizeof(char *) * 2);

        /* skip "/devices/platform/<driver>" */
        parent = strchr(uevent->path + 18, '/');
        if (!*parent)
            goto err;

        if (!strncmp(parent, "/usb", 4)) {
            /* skip root hub name and device. use device interface */
            while (*++parent && *parent != '/');
            if (*parent)
                while (*++parent && *parent != '/');
            if (!*parent)
                goto err;
            slash = strchr(++parent, '/');
            if (!slash)
                goto err;
            width = slash - parent;
            if (width <= 0)
                goto err;

            if (asprintf(&links[link_num], "/dev/usb/%s%.*s", uevent->subsystem, width, parent) > 0)
                link_num++;
            else
                links[link_num] = NULL;
            mkdir("/dev/usb", 0755);
        }
        else {
            goto err;
        }

        return links;
    err:
        free(links);
        return NULL;
    }

    static char **parse_platform_block_device(struct uevent *uevent)
    {
        const char *device;
        const char *path;
        char *slash;
        int width;
        char buf[256];
        char link_path[256];
        int fd;
        int link_num = 0;
        int ret;
        char *p;
        unsigned int size;
        struct stat info;

        char **links = malloc(sizeof(char *) * 4);
        if (!links)
            return NULL;
        memset(links, 0, sizeof(char *) * 4);

        /* Drop "/devices/platform/" */
        path = uevent->path;
        device = path + 18;
        device = find_platform_device(device);
        if (!device)
            goto err;

        INFO("found platform device %s\n", device);

        snprintf(link_path, sizeof(link_path), "/dev/block/platform/%s", device);

        if (uevent->partition_name) {
            p = strdup(uevent->partition_name);
            sanitize(p);
            if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0)
                link_num++;
            else
                links[link_num] = NULL;
            free(p);
        }

        if (uevent->partition_num >= 0) {
            if (asprintf(&links[link_num], "%s/by-num/p%d", link_path, uevent->partition_num) > 0)
                link_num++;
            else
                links[link_num] = NULL;
        }

        slash = strrchr(path, '/');
        if (asprintf(&links[link_num], "%s/%s", link_path, slash + 1) > 0)
            link_num++;
        else
            links[link_num] = NULL;

        return links;

    err:
        free(links);
        return NULL;
    }

    static void handle_device(const char *action, const char *devpath,
            const char *path, int block, int major, int minor, char **links)
    {
        int i;

        if(!strcmp(action, "add")) {
            make_device(devpath, path, block, major, minor);
            if (links) {
                for (i = 0; links[i]; i++)
                    make_link(devpath, links[i]);
            }
        }

        if(!strcmp(action, "remove")) {
            if (links) {
                for (i = 0; links[i]; i++)
                    remove_link(devpath, links[i]);
            }
            unlink(devpath);
        }

        if (links) {
            for (i = 0; links[i]; i++)
                free(links[i]);
            free(links);
        }
    }

    static void handle_platform_device_event(struct uevent *uevent)
    {
        const char *name = uevent->path + 18; /* length of /devices/platform/ */

        if (!strcmp(uevent->action, "add"))
            add_platform_device(name);
        else if (!strcmp(uevent->action, "remove"))
            remove_platform_device(name);
    }

    static const char *parse_device_name(struct uevent *uevent, unsigned int len)
    {
        const char *name;

        /* if it's not a /dev device, nothing else to do */
        if((uevent->major < 0) || (uevent->minor < 0))
            return NULL;

        /* do we have a name? */
        name = strrchr(uevent->path, '/');
        if(!name)
            return NULL;
        name++;

        /* too-long names would overrun our buffer */
        if(strlen(name) > len)
            return NULL;

        return name;
    }

    static void handle_block_device_event(struct uevent *uevent)
    {
        const char *base = "/dev/block/";
        const char *name;
        char devpath[96];
        char **links = NULL;

        name = parse_device_name(uevent, 64);
        if (!name)
            return;

        snprintf(devpath, sizeof(devpath), "%s%s", base, name);
        mkdir(base, 0755);

        if (!strncmp(uevent->path, "/devices/platform/", 18))
            links = parse_platform_block_device(uevent);

        handle_device(uevent->action, devpath, uevent->path, 1,
                uevent->major, uevent->minor, links);
    }

    static void handle_generic_device_event(struct uevent *uevent)
    {
        char *base;
        const char *name;
        char devpath[96] = {0};
        char **links = NULL;

        name = parse_device_name(uevent, 64);
        if (!name)
            return;

        if (!strncmp(uevent->subsystem, "usb", 3)) {
             if (!strcmp(uevent->subsystem, "usb")) {
                 /* This imitates the file system that would be created
                  * if we were using devfs instead.
                  * Minors are broken up into groups of 128, starting at "001"
                  */
                 int bus_id = uevent->minor / 128 + 1;
                 int device_id = uevent->minor % 128 + 1;
                 /* build directories */
                 mkdir("/dev/bus", 0755);
                 mkdir("/dev/bus/usb", 0755);
                 snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d", bus_id);
                 mkdir(devpath, 0755);
                 snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", bus_id, device_id);
             } else {
                 /* ignore other USB events */
                 return;
             }
         } else if (!strncmp(uevent->subsystem, "graphics", 8)) {
             base = "/dev/graphics/";
             mkdir(base, 0755);
         } else if (!strncmp(uevent->subsystem, "oncrpc", 6)) {
             base = "/dev/oncrpc/";
             mkdir(base, 0755);
         } else if (!strncmp(uevent->subsystem, "adsp", 4)) {
             base = "/dev/adsp/";
             mkdir(base, 0755);
         } else if (!strncmp(uevent->subsystem, "msm_camera", 10)) {
             base = "/dev/msm_camera/";
             mkdir(base, 0755);
         } else if(!strncmp(uevent->subsystem, "input", 5)) {
             base = "/dev/input/";
             mkdir(base, 0755);
         } else if(!strncmp(uevent->subsystem, "mtd", 3)) {
             base = "/dev/mtd/";
             mkdir(base, 0755);
         } else if(!strncmp(uevent->subsystem, "sound", 5)) {
             base = "/dev/snd/";
             mkdir(base, 0755);
    #ifdef AM389xEVM_SYSLINK
           } else if(!strncmp(uevent->subsystem, "syslinkipc", 10)) {
               base = "/dev/syslinkipc/";
               mkdir(base, 0755);
    #endif
         } else if(!strncmp(uevent->subsystem, "misc", 4) &&
                     !strncmp(name, "log_", 4)) {
             base = "/dev/log/";
             mkdir(base, 0755);
             name += 4;
         } else
             base = "/dev/";
         links = get_character_device_symlinks(uevent);

         if (!devpath[0])
             snprintf(devpath, sizeof(devpath), "%s%s", base, name);

         handle_device(uevent->action, devpath, uevent->path, 0,
                 uevent->major, uevent->minor, links);
    }

    static void handle_device_event(struct uevent *uevent)
    {
        if (!strcmp(uevent->action,"add"))
            fixup_sys_perms(uevent->path);

        if (!strncmp(uevent->subsystem, "block", 5)) {
            handle_block_device_event(uevent);
        } else if (!strncmp(uevent->subsystem, "platform", 8)) {
            handle_platform_device_event(uevent);
        } else {
            handle_generic_device_event(uevent);
        }
    }

    static int load_firmware(int fw_fd, int loading_fd, int data_fd)
    {
        struct stat st;
        long len_to_copy;
        int ret = 0;

        if(fstat(fw_fd, &st) < 0)
            return -1;
        len_to_copy = st.st_size;

        write(loading_fd, "1", 1);  /* start transfer */

        while (len_to_copy > 0) {
            char buf[PAGE_SIZE];
            ssize_t nr;

            nr = read(fw_fd, buf, sizeof(buf));
            if(!nr)
                break;
            if(nr < 0) {
                ret = -1;
                break;
            }

            len_to_copy -= nr;
            while (nr > 0) {
                ssize_t nw = 0;

                nw = write(data_fd, buf + nw, nr);
                if(nw <= 0) {
                    ret = -1;
                    goto out;
                }
                nr -= nw;
            }
        }

    out:
        if(!ret)
            write(loading_fd, "0", 1);  /* successful end of transfer */
        else
            write(loading_fd, "-1", 2); /* abort transfer */

        return ret;
    }

    static int is_booting(void)
    {
        return access("/dev/.booting", F_OK) == 0;
    }

    static void process_firmware_event(struct uevent *uevent)
    {
        char *root, *loading, *data, *file1 = NULL, *file2 = NULL;
        int l, loading_fd, data_fd, fw_fd;
        int booting = is_booting();

        INFO("firmware: loading '%s' for '%s'\n",
             uevent->firmware, uevent->path);

        l = asprintf(&root, SYSFS_PREFIX"%s/", uevent->path);
        if (l == -1)
            return;

        l = asprintf(&loading, "%sloading", root);
        if (l == -1)
            goto root_free_out;

        l = asprintf(&data, "%sdata", root);
        if (l == -1)
            goto loading_free_out;

        l = asprintf(&file1, FIRMWARE_DIR1"/%s", uevent->firmware);
        if (l == -1)
            goto data_free_out;

        l = asprintf(&file2, FIRMWARE_DIR2"/%s", uevent->firmware);
        if (l == -1)
            goto data_free_out;

        loading_fd = open(loading, O_WRONLY);
        if(loading_fd < 0)
            goto file_free_out;

        data_fd = open(data, O_WRONLY);
        if(data_fd < 0)
            goto loading_close_out;

    try_loading_again:
        fw_fd = open(file1, O_RDONLY);
        if(fw_fd < 0) {
            fw_fd = open(file2, O_RDONLY);
            if (fw_fd < 0) {
                if (booting) {
                        /* If we're not fully booted, we may be missing
                         * filesystems needed for firmware, wait and retry.
                         */
                    usleep(100000);
                    booting = is_booting();
                    goto try_loading_again;
                }
                INFO("firmware: could not open '%s' %d\n", uevent->firmware, errno);
                write(loading_fd, "-1", 2);
                goto data_close_out;
            }
        }

        if(!load_firmware(fw_fd, loading_fd, data_fd))
            INFO("firmware: copy success { '%s', '%s' }\n", root, uevent->firmware);
        else
            INFO("firmware: copy failure { '%s', '%s' }\n", root, uevent->firmware);

        close(fw_fd);
    data_close_out:
        close(data_fd);
    loading_close_out:
        close(loading_fd);
    file_free_out:
        free(file1);
        free(file2);
    data_free_out:
        free(data);
    loading_free_out:
        free(loading);
    root_free_out:
        free(root);
    }

    static void handle_crda_event(struct uevent *uevent)
    {
        int status;
        int ret;
        pid_t pid;
        char country_env[128];
        char *argv[] = { "/system/bin/crda", NULL };
        char *envp[] = { country_env, NULL };

        if(strcmp(uevent->subsystem, "platform"))
            return;

        if(strcmp(uevent->action, "change"))
            return;

        log_event_print("executing CRDA country=%s\n", uevent->country);
        sprintf(country_env, "COUNTRY=%s", uevent->country);

        pid = fork();
        if (!pid) {
            if (-1 == execve(argv[0], argv, envp))
                exit(1);
        } else if (pid != -1) {
            do {
                ret = waitpid(pid, &status, 0);
            } while (ret == -1 && errno == EINTR);
        }
    }

    static void handle_firmware_event(struct uevent *uevent)
    {
        pid_t pid;
        int ret;

        if(strcmp(uevent->subsystem, "firmware"))
            return;

        if(strcmp(uevent->action, "add"))
            return;

        /* we fork, to avoid making large memory allocations in init proper */
        pid = fork();
        if (!pid) {
            process_firmware_event(uevent);
            exit(EXIT_SUCCESS);
        }
    }

    #define UEVENT_MSG_LEN  1024
    void handle_device_fd()
    {
        char msg[UEVENT_MSG_LEN+2];
        int n;
        while ((n = uevent_kernel_multicast_recv(device_fd, msg, UEVENT_MSG_LEN)) > 0) {
            if(n >= UEVENT_MSG_LEN)   /* overflow -- discard */
                continue;

            msg[n] = '\0';
            msg[n+1] = '\0';

            struct uevent uevent;
            parse_event(msg, &uevent);

            handle_device_event(&uevent);
            handle_firmware_event(&uevent);
            handle_crda_event(&uevent);
        }
    }

    /* Coldboot walks parts of the /sys tree and pokes the uevent files
    ** to cause the kernel to regenerate device add events that happened
    ** before init's device manager was started
    **
    ** We drain any pending events from the netlink socket every time
    ** we poke another uevent file to make sure we don't overrun the
    ** socket's buffer.  
    */

    static void do_coldboot(DIR *d)
    {
        struct dirent *de;
        int dfd, fd;

        dfd = dirfd(d);

        fd = openat(dfd, "uevent", O_WRONLY);
        if(fd >= 0) {
            write(fd, "add\n", 4);
            close(fd);
            handle_device_fd();
        }

        while((de = readdir(d))) {
            DIR *d2;

            if(de->d_type != DT_DIR || de->d_name[0] == '.')
                continue;

            fd = openat(dfd, de->d_name, O_RDONLY | O_DIRECTORY);
            if(fd < 0)
                continue;

            d2 = fdopendir(fd);
            if(d2 == 0)
                close(fd);
            else {
                do_coldboot(d2);
                closedir(d2);
            }
        }
    }

    static void coldboot(const char *path)
    {
        DIR *d = opendir(path);
        if(d) {
            do_coldboot(d);
            closedir(d);
        }
    }

    void device_init(void)
    {
        suseconds_t t0, t1;
        struct stat info;
        int fd;

        /* is 64K enough? udev uses 16MB! */
        device_fd = uevent_open_socket(64*1024, true);
        if(device_fd < 0)
            return;

        fcntl(device_fd, F_SETFD, FD_CLOEXEC);
        fcntl(device_fd, F_SETFL, O_NONBLOCK);

        if (stat(coldboot_done, &info) < 0) {
            t0 = get_usecs();
            coldboot("/sys/class");
            coldboot("/sys/block");
            coldboot("/sys/devices");
            t1 = get_usecs();
            fd = open(coldboot_done, O_WRONLY|O_CREAT, 0000);
            close(fd);
            log_event_print("coldboot %ld uS\n", ((long) (t1 - t0)));
        } else {
            log_event_print("skipping coldboot, already done\n");
        }
    }

    int get_device_fd()
    {
        return device_fd;

    Regards,

    Dibin

  • dibin moolakadan1 said:

    i am porting ICS to DM37xx ,

    in my /system/core/init/devices.c file the structure  perms_devperms[] is not present , can any one point me how to do the

    { "/dev/ttyUSB0",        0666,   AID_RADIO,     AID_RADIO,  0 },

    device permission in ICS

    You can create ueventd.<ro.hardware>.rc file with the above entriy. See the following for example:

    http://gitorious.org/rowboat/vendor-ti-am335xevm/blobs/rowboat-ics/ueventd.am335xevm.rc

    <ro.hardware> normally corresponds to the machine name defined in the kernel. You can get this by running 'getprop' command on the android console.

  • Hi Vishveshwar

     Thanks for your quick response , i wil try this with my gps module , and post the results

    Regards,

    Dibin

  • Hi All,

    i have integrated the gsm mode but am getting atchannel errors

    logcat -b radio shows 

    D/AT ( 1171): atchannel: read error Try again

    I/RIL ( 1171): AT channel closed

    I/RIL ( 1171): Re-opening after close

    D/AT ( 1171): AT> AT+CREG=2

    and when i cat /dev/ttyO0 it seems to be work correctly

    OK

    AT+CMEE=1

    OK

    AT+CREG=2

    OK

    AT+CREG=1

    OK

    AT+CCWA=1

    +CME ERROR: 10

    AT+CMOD=0

    Regards,

    Dibin

  • HI Mahesh,

    Good Morning, 

    We are using the arm cortex Samsung Processor S5PV210 , we had interfaced Quectal M95 GSM/GPRS Modem via Serial Port (i.e, UART). We are able to communicate the modem via AT commands using the reference-ril.c file.

    But actually as per the modem , i need to modify the reference-ril.c to get communicated completely.

    I pleased to provide your reference-ril.c because the modem used by u is also the quectal modem.

    To work i did following changes.

    1.In the init.rc file i had added the following 

    setprop ro.radio.use-ppp no
    setprop ro.radio.noril no


    setprop rild.libpath /system/lib/libreference-ril.so
    setprop rild.libargs "-d /dev/s3c2410_serial2"

    service ril-daemon /system/bin/rild -l libreference-ril.so -- -d /dev/s3c2410_serial2
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    user root
    group radio cache inet misc audio sdcard_rw

    2.   /system/core/init/devices.c

    I don't have the below AIR_RADIO to make changes to /dev/s3c2410_serial2 , so where do i need to modify? Please help.

    { "/dev/ttyUSB0",        0666,   AID_RADIO,     AID_RADIO,  0 },

    3. I am unable to understand your statement, provided in the previous mail "at the compile time compile the image for actual device( specify radio = yes)  instade  of emulator."

    where do i need to do the above 3 point?

    4. how do i need to do this as per your previous mail "

    i used following command-line argument at boot time

    "android.ril=s3c2410_serial2".

    5. My Log file : logcat  -b radio shows as

    I/RIL ( 1366): Opening tty device /dev/s3c2410_serial2
    D/RIL ( 1366): hqf:mainLoop:s_device_path=/dev/s3c2410_serial2
    D/AT ( 1366): AT> AT
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> ATE0Q0V1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> ATS0=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMEE=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CREG=2
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CGREG=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CCWA=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMOD=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMUT=1
    D/AT ( 1366): AT< +CME ERROR: 3
    D/AT ( 1366): AT> AT+CSSN=0,1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+COLP=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CSCS="HEX"
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CUSD=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CGEREP=1,0
    D/AT ( 1366): AT< ERROR
    D/AT ( 1366): AT> AT+CMGF=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CFUN?
    D/AT ( 1366): AT< +CFUN: 1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CPIN?
    D/AT ( 1366): AT< +CPIN: READY
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CSMS=1
    D/AT ( 1366): AT< +CMS ERROR: 604
    D/AT ( 1366): AT> AT+CNMI=1,2,2,1,1
    D/AT ( 1366): AT< OK
    I/RIL ( 1377): Opening tty device /dev/s3c2410_serial2
    D/RIL ( 1377): hqf:mainLoop:s_device_path=/dev/s3c2410_serial2
    D/AT ( 1377): AT> AT
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> ATE0Q0V1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> ATS0=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMEE=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CREG=2
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CGREG=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CCWA=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMOD=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMUT=1
    D/AT ( 1377): AT< +CME ERROR: 3
    D/AT ( 1377): AT> AT+CSSN=0,1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+COLP=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CSCS="HEX"
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CUSD=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CGEREP=1,0
    D/AT ( 1377): AT< ERROR
    D/AT ( 1377): AT> AT+CMGF=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CFUN?
    D/AT ( 1377): AT< +CFUN: 1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CPIN?
    D/AT ( 1377): AT< +CPIN: READY
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CSMS=1
    D/AT ( 1377): AT< +CMS ERROR: 604
    D/AT ( 1377): AT> AT+CNMI=1,2,2,1,1
    D/AT ( 1377): AT< OK

    like so the loop is continously happening in the mainLoop. 

    Queries:

    1. how can i get to know where socket is created?

    2. shall i need to modify any more in the HAL Layer to get invoked from application layer.

    3. Where does we can provide the device node information and socket information to application layer.

    I hope please help me.

    I request to please provide the quectal GSM Modem related reference-ril .c file (which you had changed for).

    Regards,

    Srikanth.

  • HI Mahesh,

    Good Morning, 

    We are using the arm cortex  Processor S5PV210 , we had interfaced Quectal M95 GSM/GPRS Modem via Serial Port (i.e, UART). We are able to communicate the modem via AT commands using the reference-ril.c file.

    I requested to please provide the reference-ril.c file because the modem which i am using is also quectal modem.

    But actually as per the modem , i need to modify the reference-ril.c to get communicated completely.

    To work i did following changes.

    1.In the init.rc file i had added the following 

    setprop ro.radio.use-ppp no
    setprop ro.radio.noril no


    setprop rild.libpath /system/lib/libreference-ril.so
    setprop rild.libargs "-d /dev/s3c2410_serial2"

    service ril-daemon /system/bin/rild -l libreference-ril.so -- -d /dev/s3c2410_serial2
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    user root
    group radio cache inet misc audio sdcard_rw

    2.   /system/core/init/devices.c

    I don't have the below AIR_RADIO to make changes to /dev/s3c2410_serial2 , so where do i need to modify? Please help.

    { "/dev/ttyUSB0",        0666,   AID_RADIO,     AID_RADIO,  0 },

    3. I am unable to understand your statement, provided in the previous mail "at the compile time compile the image for actual device( specify radio = yes)  instade  of emulator."

    where do i need to do the above 3 point?

    4. how do i need to do this as per your previous mail "

    i used following command-line argument at boot time

    "android.ril=s3c2410_serial2".

    5. My Log file : logcat  -b radio shows as

    I/RIL ( 1366): Opening tty device /dev/s3c2410_serial2
    D/RIL ( 1366): hqf:mainLoop:s_device_path=/dev/s3c2410_serial2
    D/AT ( 1366): AT> AT
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> ATE0Q0V1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> ATS0=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMEE=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CREG=2
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CGREG=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CCWA=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMOD=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CMUT=1
    D/AT ( 1366): AT< +CME ERROR: 3
    D/AT ( 1366): AT> AT+CSSN=0,1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+COLP=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CSCS="HEX"
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CUSD=1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CGEREP=1,0
    D/AT ( 1366): AT< ERROR
    D/AT ( 1366): AT> AT+CMGF=0
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CFUN?
    D/AT ( 1366): AT< +CFUN: 1
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CPIN?
    D/AT ( 1366): AT< +CPIN: READY
    D/AT ( 1366): AT< OK
    D/AT ( 1366): AT> AT+CSMS=1
    D/AT ( 1366): AT< +CMS ERROR: 604
    D/AT ( 1366): AT> AT+CNMI=1,2,2,1,1
    D/AT ( 1366): AT< OK
    I/RIL ( 1377): Opening tty device /dev/s3c2410_serial2
    D/RIL ( 1377): hqf:mainLoop:s_device_path=/dev/s3c2410_serial2
    D/AT ( 1377): AT> AT
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> ATE0Q0V1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> ATS0=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMEE=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CREG=2
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CGREG=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CCWA=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMOD=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CMUT=1
    D/AT ( 1377): AT< +CME ERROR: 3
    D/AT ( 1377): AT> AT+CSSN=0,1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+COLP=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CSCS="HEX"
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CUSD=1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CGEREP=1,0
    D/AT ( 1377): AT< ERROR
    D/AT ( 1377): AT> AT+CMGF=0
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CFUN?
    D/AT ( 1377): AT< +CFUN: 1
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CPIN?
    D/AT ( 1377): AT< +CPIN: READY
    D/AT ( 1377): AT< OK
    D/AT ( 1377): AT> AT+CSMS=1
    D/AT ( 1377): AT< +CMS ERROR: 604
    D/AT ( 1377): AT> AT+CNMI=1,2,2,1,1
    D/AT ( 1377): AT< OK

    like so the loop is continously happening in the mainLoop. 

    Queries:

    1. how can i get to know where socket is created?

    2. shall i need to modify any more in the HAL Layer to get invoked from application layer.

    3. Where does we can provide the device node information and socket information to application layer.

    I hope please help me.

    I request to please provide the quectal GSM Modem related reference-ril .c file (which you had changed for).

    Regards,

    Srikanth.

  • Hello Shrikanth,

    I am sorry for the delayed reply, and I am afraid i have bad news for you. I would not be able to provide refrence-ril.c source or the changes I made to it, as I no longer work on that project nor the company, I would only be of logical help to you.

    One thing i can see from the log o/p you shared is your system is able to communicate with modem only thing is one of the command is not getting proper responce, try and debug the command sequence which AT command is causing the process to loop, study little bit about the command and you should be able to solve your problem.

    I would not be able to give you exact answers as I have not worked on android since last 2yrs, so unfortunate to keep track of latest android ril stack changes.

    Anyways happy debugging!!

    Thanks & Regards

    Mahesh

  • Hi mahesh,

    Thanks for reply......Please help me logically for quectal gsm modem interface to  android gingerbread 2.3...

    when i changed AT commands, the AT responses showns "OK" , without any ERROR. But the mainloop thread is running continously.

    Doubt:

    1. Is without any android sms applications. if i send sms from my mobile, does the unsolicated cmd will execute.

    2. will the mainloop thread runs continuosly or not?

    3. shall i know, the first request from application layer is "'ONREQUEST" command or someother.

    Regards,

    Srikanth.

  • HI Srikanth,

    I am also working on Android ICS with Quectel M95 GSM modem, its working as I am getting notification of in comming calls and sms but I am unable to receive calls and even I can't make calls because my telephony app pop ups with "network not available " as there is no indication of network signals on my android screen but my radio logcat showing activities, I just want to get help from you because I am receive the same radio log as yours shown below

    I/RIL ( 2140): Opening tty device /dev/chn/1
    E/RILC ( 2140): RIL_register: RIL version 6
    E/RILC ( 2140): ril.cpp check 6
    D/RILB ( 2378): /proc/cmdline=console=ttySAC2,115200
    D/RILB ( 2378): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
    D/RILB ( 2378): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
    I/PHONE ( 2378): Network Mode set to 1
    D/RILB ( 2378): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
    I/PHONE ( 2378): lteOnCdma is 0 use SUBSCRIPTION_FROM_NV
    I/PHONE ( 2378): Cdma Subscription set to 1
    D/RILJ ( 2378): RIL(context, preferredNetworkType=1 cdmaSubscription=1)
    D/RILJ ( 2378): Not starting RILReceiver: wifi-only
    I/PHONE ( 2378): Creating GSMPhone
    D/PHONE ( 2378): mDoesRilSendMultipleCallRing=true
    D/PHONE ( 2378): mCallRingDelay=3000
    D/RILJ ( 2378): setPhoneType=1 old value=0
    D/SMS ( 2378): SMSDispatcher: ctor mSmsCapable=true format=3gpp mSmsReceiveDisabled=false mSmsSendDisabled=false
    W/GSM ( 2378): Can't open /system/etc/voicemail-conf.xml
    W/GSM ( 2378): Can't open /system/etc/spn-conf.xml
    D/RILJ ( 2378): [0000]> GET_CURRENT_CALLS
    D/RILJ ( 2378): [0000]< GET_CURRENT_CALLS error: com.android.internal.telephony.CommandException: RADIO_NOT_AVAILABLE
    D/GSM ( 2378): [GsmSST] Poll ServiceState done: oldSS=[1 home null null null Unknown:0 CSS not supported 0 0 RoamInd=0 DefRoamInd=0 EmergOnly=false] newSS=[1 home null null null Unknown:0 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false] oldGprs=1 newData=1 oldMaxDataCalls=1 mNewMaxDataCalls=1 oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=Unknown:0 newType=Unknown:0
    D/GSM ( 2378): [GsmSST] updateSpnDisplay: changed sending intent rule=2 showPlmn='false' plmn='null' showSpn='false' spn='null'
    D/GSM ( 2378): [GsmDCT] onReceive: action=android.net.wifi.WIFI_STATE_CHANGED
    D/GSM ( 2378): [GsmDCT] handleMessage msg={ what=270342 when=-406ms obj=android.os.AsyncResult@411d3b48 }
    D/GSM ( 2378): [GsmDCT] onRadioOffOrNotAvailable: is off and clean up all connections
    D/GSM ( 2378): [GsmDCT] cleanUpAllConnections: tearDown=false reason=radioTurnedOff
    D/GSM ( 2378): [GsmDCT] stopNetStatPoll
    D/GSM ( 2378): [GsmDCT] handleMessage msg={ what=270345 when=-415ms obj=android.os.AsyncResult@411d3ea0 }
    D/GSM ( 2378): [GsmDCT] onDataConnectionDetached: stop polling and notify detached
    D/GSM ( 2378): [GsmDCT] stopNetStatPoll
    D/GSM ( 2378): [GsmDCT] notifyDataConnection: reason=dataDetached
    D/GSM ( 2378): [GsmDCT] handleMessage msg={ what=270348 when=-415ms obj=android.os.AsyncResult@411d3ff8 }
    D/GSM ( 2378): [GsmDCT] onRoamingOff
    D/GSM ( 2378): [IccCard] Broadcasting intent ACTION_SIM_STATE_CHANGED NOT_READY reason null
    D/GSM ( 2378): [GsmDCT] onReceive: action=android.net.wifi.WIFI_STATE_CHANGED
    D/AT ( 2140): AT> ATE0Q0V1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> ATE0Q0V1
    D/AT ( 2140): AT> ATS0=0
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CMEE=1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CREG=2
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CGREG=1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CCWA=1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CMOD=0
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CMUT=0
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CSSN=0,1
    D/AT ( 2140): AT< +CME ERROR: 3
    D/AT ( 2140): AT> AT+COLP=0
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CSCS="HEX"
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CUSD=1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CGEREP=1,0
    D/AT ( 2140): AT< ERROR
    D/AT ( 2140): AT> AT+CMGF=0
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CFUN?
    D/AT ( 2140): AT< +CFUN: 1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CPIN?
    D/AT ( 2140): AT< +CPIN: READY
    D/AT ( 2140): AT< OK
    D/AT ( 2140): AT> AT+CSMS=1
    D/AT ( 2140): AT< +CMS ERROR: 604
    D/AT ( 2140): AT> AT+CNMI=1,2,2,1,1
    D/AT ( 2140): AT< OK
    D/AT ( 2140): atchannel: read error I/O error
    I/RIL ( 2140): AT channel closed

    Please help me out and kindly tell me that how you get rid out of this problem and also tell how do I enable my network status on android screen.

    Your quick response will be highly appreciated.

    Thanks

    Regards,
    Adeel
  • Hi Mahesh,

    This original post has been answered. If you have a question, please start a new thread in the appropriate forum e2e.ti.com/.../42

  • Hi Adeel,

                    check process id with "ps" command you will get process id of rild...........

    kill that process id and then type logcat and check it. send me logs.

    Regards

    Pooja

                   

  • Hi Pooja,

    Thanks for your quick response fortunately I fixed that issue myself by changing this condition if (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false) in RIL.java to if (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == true) because my radio hardware was not getting on and there are no socket connection so that after doing this change I get my system works, but I know its not a proper way to do this now my next question is why this function ever returns false...? is there any proper way to turn my table mode off and phone mode on so that my radio harware my turn on and this condition if (cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE) == false) gets true.

    Pooja I am looking forward for solution for this issue hope you will have a solution..
    Thanks,

    Regards,
    Adeel