Exemple #1
0
fm_code_t parse_xml_msg(char * sdata, int len)
{
    fm_code_t result = FM_OK;

    if(sdata == NULL)
        return FM_ERR;

    char * pdata = NULL;
    pdata = strstr_cb(sdata+0x22b0, len-0x22b0);

    unsigned long int ltime =  atoll(pdata);
    Time  time = {};
    msecond_to_time(ltime, 0, &time);
    printf("beijing time: %s\n",time.str_tm);
    char cmd[64] = {0};
    sprintf(cmd, "date -s \"%s\"",time.str_tm);

    if( 0 != pox_system(cmd) )
    {
        LogFile(FMPROCLOG,"设置系统时间出错");
        return -4;
    }

    return result;

}
Exemple #2
0
int exec_shell_compile_code()
{
    if( 0 != pox_system("/mnt/hgfs/share/git/cber/shell/login_svn.sh") )
    {
        //LogFile(FMPROCLOG,"调用shell脚本出错");
        return -4;
    }
    return 0;
}
Exemple #3
0
void *hotPlugThread(void *param)
{
    int i = 0;
    int ret = 0;
    char buf[1024] = {0};
    char devName[128] = {0};
    char devPath[124] = {0};
    char mountPath[128] = {0};
    char cmd[128] = {0};

    int hotplug_sock;
    int sum,size;
    char *str;

#if 0
    unsigned char uuid[16] = {0};

    setDiskVolumeName("/dev/sda1", "abcd");

    getDiskPartitionInfo("/dev/sda1", uuid, NULL, NULL);

    checkFallocateFile("/disk/disk0000", 1024*1024*1024);
#endif

    hotplug_sock = init_hotplug_sock();

    while(1)
    {
        sum = 0;
        memset(buf, 0, sizeof(buf));
        size = recv(hotplug_sock, buf, sizeof(buf), 0);
        	//	fprintf(stderr,"size=%d, buf=[%s], strlen(buf)=%d\n", size, buf, strlen(buf));
        while(sum < size)
        {
            str = buf + sum;
            sum += strlen(str);
            buf[sum] = '\n';
        }
        buf[sum] = 0;

      //  fprintf(stderr,"buf=[%s]\n\n", buf);

        if(((strstr(buf, "ACTION=add") != NULL) && (strstr(buf, "DEVTYPE=disk") != NULL))||((strstr(buf, "ACTION=add") != NULL) && (strstr(buf, "DEVTYPE=partition") != NULL)))
        {
            if((strstr(buf, "NPARTS=0") != NULL) || (strstr(buf, "PARTN=") != NULL))
            {
                memset(devName, 0, sizeof(devName));
                if(getDevName(buf, devName) == 0)
                {
                    fprintf(stderr,"add devName = [%s]\r\n", devName);
                    if(strstr(buf, "DEVPATH=/devices/platform/hiusb-ehci") != NULL)
                    {//u盘
                        for(i = 0; i < 8; i++)
                        {
                            sprintf(devPath, "/dev/%s", devName);
                            sprintf(mountPath, "/usb/usb%04d", i);
                            ret = checkDiskPartitionIsMount(devPath, mountPath);
                            if(ret == 0x00)
                            {
                                sprintf(cmd, "mount %s %s", devPath, mountPath);
                                ret=pox_system(cmd);
                                ret=iCheckSystemReturnValue(ret);
                                if(0!=ret)
                                    continue;
                            }
                            else if(ret == 0x03)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }

        if(((strstr(buf,"ACTION=remove")!=NULL) && (strstr(buf, "DEVTYPE=disk") != NULL))||((strstr(buf, "ACTION=remove") != NULL) && (strstr(buf, "DEVTYPE=partition") != NULL)))
        {
            if((strstr(buf, "NPARTS=0") != NULL) || (strstr(buf, "PARTN=") != NULL))
            {
                if(getDevName(buf, devName) == 0)
                {
                    printf("remove devName = [%s]\r\n", devName);
                    if(strstr(buf, "DEVPATH=/devices/platform/hiusb-ehci") != NULL)
                    {//u
                        sprintf(devPath, "/dev/%s", devName);
                        sprintf(cmd, "umount %s", devPath);
                        int i ;
                        for(i=0;i!=4;++i)
                        {
                            ret=pox_system(cmd);
                            ret=iCheckSystemReturnValue(ret);
                            if(0==ret)
                            {
                                break;
                            }
                            fprintf(stderr,"remove devName = [%s] fail \r\n", devName);
                            sleep(1);
                        }
                        umount(devPath);
                        umount(devPath);
                    }

                    else if(strstr(buf, "DEVPATH=/devices/platform/ahci") != NULL)
                    {//sata硬盘

                        fprintf(stderr , "\n===============%s \n", buf);

                        sprintf(devPath, "/dev/%s", devName);
                        sprintf(cmd, "umount -f %s", devPath);

                        fprintf(stderr, "================cmd %s \n", cmd);
                        system(cmd);
                        system(cmd);
                    }
		else
		{
			umount("/usb/usb0000");
			umount("/usb/usb0001");
			umount("/usb/usb0002");
			umount("/usb/usb0003");
		}
                }
            }
        }
        usleep(400*1000);
    }

    return NULL;
}
Exemple #4
0
int main(int argc,char * argv[])
{
//    test();
//    return 0;
	printf("test start\n");
	char input_file[256] = {0};

	printf("input param : argc = %d \n", argc);
	if( argc == 2)
	{
	    strcpy(input_file, argv[1]);
	}
	else
	{
	    strcpy(input_file, "lte.pcap");//FILE_PATH);
	}

#ifdef FIND_FTEID
	pcap_search_fteid(input_file);
#else

#ifdef ADD_PCAP
    #ifdef add_ori
	/* 解决分帧 */
	pcap_add_merge("lte_pkt.log");//pcap_add的头格式这个函数已经不能再用
	pcap_add("merge_pkt.tmp");
    #else
	    pcap_add("core.pkt");
    #endif
#else

#ifdef DEL_CRC
//    pcap_delete_crc4("lte.pcap");

    int i = 0;
    for( i = 1 ; i < 11; i++)
    {
        sprintf(input_file, "st%d.pcap",i);
        pcap_delete_crc4(input_file);
        pox_system("mv gtpc_output.pcap crc_src/crc_op%d.pcap", i);
    }
#else
    #ifdef PILIAN
        int i = 0;
        for( i = 1 ; i < 11; i++)
        {
            sprintf(input_file, "crc_src/crc_op%d.pcap",i);
            pcap_search(input_file);
            pox_system("mv gtpc_output.pcap crc_src/gtpc%d.pcap", i);
        }

    #else
        pcap_search(input_file);
    #endif


        #endif
    #endif
#endif

    return 0;
}