• 泽强
    了解作者
  • C/C++
    开发工具
  • 25KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2016-03-01 10:42
    上传日期
高通无线路由器开发程序高通无线路由器开发程序
link_backup.rar
  • link_backup
  • link_backup.o
    9.6KB
  • si_main.c
    64.8KB
  • Makefile
    368B
  • link_backup
    11.9KB
  • link_backup.c
    6.9KB
内容介绍
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <pthread.h> #include <fcntl.h> #include <sys/time.h> #include <unistd.h> #include <sys/ioctl.h> #include <cust.h> #include "si_linux.h" #include "si_voice.h" #include "proslic.h" #include "si3217x_constants.h" #include "autoconf.h" #ifdef CONFIG_RALINK_GPIO #include "ralink_gpio.h" #define GPIO_DEV "/dev/gpio" #else #error no defined #endif #include <signal.h> //by zhuhaiyan 20120218 #include "nvram.h" #ifdef FEATURE_SUPPORT_SMS #include "../../sms/sms.h" #endif #include "../../comop/comop.h" #ifdef SI3226X #error "Only Si3226X has been tested!" #else #define VOICE_DEVICE_TYPE SI3217X_TYPE #endif pid_t g_wan_pid = 0; char g_pin_lock = 0; char g_sysinfo = -1; char g_pinstatus = -1; char g_sim_type = SIM_UNKNOWN; char g_service_type = NONE; char g_init_modem = 0; unsigned char g_reg_stat = 0; unsigned char g_ring = 0; unsigned char g_is_ringing = 0; unsigned char g_call_ison = 0; unsigned char g_get_done = 0; unsigned char g_slic_init = 0; unsigned char g_ring_hookon = 0; unsigned char g_voice = 0; unsigned char g_answer = 0; //unsigned char count = 5; #define PCM4 #define debug printf("\nFuncton:%s,run to %d\n",__FUNCTION__,__LINE__) //printf("Functon:%s,run to %d\n",__FUNCTION__,__LINE__) typedef struct { SiVoiceChanType_ptr VoiceObj; int is_tone_on; int is_ringing; int tone_selected; /* -1 = Invalid */ int tone_needs_tmr; int is_xconn; } chanState; si_hctrl_t g_hw_ctrl; SiVoiceControlInterfaceType * g_sivoice_sys_if; chanState g_ports[NUMBER_OF_CHAN]; #ifdef FEATURE_CALL_ID char cid[40]; #endif int modem_reboot() { int fd = 0; int data = 0; fd = open(GPIO_DEV, O_RDONLY); if (fd < 0) { perror(GPIO_DEV); return -1; } if (ioctl(fd, RALINK_GPIO3924_SET_DIR_OUT, 1 << (35 -24)) < 0) goto ioctl_err; if (ioctl(fd, RALINK_GPIO3924_CLEAR, 1 << (35 -24)) < 0) goto ioctl_err; sleep(2); if (ioctl(fd, RALINK_GPIO3924_SET, 1 << (35 -24)) < 0) goto ioctl_err; close(fd); return 0; printf("<< modem_reboot >>\n"); ioctl_err: perror("ioctl"); close(fd); return -1; } int send_at_cmd(const char * cmd, int tmo_level) { char receive[AT_RECEIVE_BUFF_SIZE] = {0}; int i = 0; atoperation(cmd, receive, 0, tmo_level); printf("\n\nsend_at_cmd: at:%s,receive:%s\n",cmd,receive); if(0 != test_at_message_is_error(receive)) { printf("fail to send at cmd:%s\n", cmd); printf(receive); return -1; } return 0; } int sendate(void) { char ret = -1; char sl = 0; do { ret = send_at_cmd(ATE, WAIT_TIME_LEVEL_1); if (ret != 0) { printf("fail to init AT cmd on %s, try gain...\n", AT_PORT); sleep(1); sl++; printf("have sleep %ds\n",sleep); } else break; } while (1); #ifdef BMC_HR22_P300 do { ret = send_at_cmd(CFUN, WAIT_TIME_LEVEL_1); if (ret != 0) { printf("fail to init AT cmd on %s, try gain...\n", AT_PORT); sleep(1); sl++; printf("have sleep %ds\n",sleep); } else break; } while (1); #endif return 0; } void getcurnetmode() { char receive[AT_RECEIVE_BUFF_SIZE] = {0}; char bmmode = 0; const char * pszHeader = "+BMMODPREF: "; char * p = NULL; atoperation(BMMODPREF, receive, 0, WAIT_TIME_LEVEL_2); p = strstr(receive, pszHeader); if (!p) return write_at_message(BMRAT_SAVE_FILE, "bmmode Error"); p += strlen(pszHeader); sscanf(p, "%d", &bmmode); if (0 != bmmode) { atoperation(BMMODPREF0, receive, 0, WAIT_TIME_LEVEL_2); sleep(1); system("ralink_init clear 2860"); sleep(2); // system("killall -SIGUSR2 down"); system("reboot"); } } //get cpin status. int getcpin(void) { char receive[AT_RECEIVE_BUFF_SIZE] = {0}; atoperation(CPIN, receive, 0, WAIT_TIME_LEVEL_5); printf("\n\n\t\tgetcpin send: %s\n",CPIN); printf("receive:%s\n",receive); if (0 == test_at_message_is_error(receive)) { printf("\n\ngetcpin ------>>:receive:%s\n",receive); char *p = strstr(receive,"+CPIN:"); printf("get cpin status: %s\n", receive); if(NULL != p) { p = p + strlen("+CPIN:"); if (NULL != strstr(p, "Ready")) { system("echo 0 > /tmp/lock_pin"); system("echo 0 > /tmp/pinstatus"); g_pin_lock = 0; return write_at_message(CPIN_SAVE_FILE, "Sim Ready"); } else if(NULL != strstr(p, "READY")) { system("echo 0 > /tmp/lock_pin"); system("echo 0 > /tmp/pinstatus"); g_pin_lock = 0; return write_at_message(CPIN_SAVE_FILE, "Sim Ready"); } else if(NULL != strstr(p, "PIN")) { system("echo 1 > /tmp/lock_pin"); system("echo 1 > /tmp/pinstatus"); g_pin_lock = 1; return write_at_message(CPIN_SAVE_FILE, "Sim PIN-lock"); } else if(NULL != strstr(p, "PUK")) { system("echo 2 > /tmp/lock_pin"); system("echo 1 > /tmp/pinstatus"); g_pin_lock = 2; system("cat /tmp/lock_pin"); system("cat /tmp/pinstatus"); return write_at_message(CPIN_SAVE_FILE, "Sim PUK-lock"); } else { system("echo 5 > /tmp/lock_pin"); system("echo 1 > /tmp/pinstatus"); g_pin_lock = 5; return write_at_message(CPIN_SAVE_FILE, "Sim Error"); } } } else { if(NULL != strstr(receive, "SIM busy")) { system("echo 3 > /tmp/lock_pin"); g_pin_lock = 3; return write_at_message(CPIN_SAVE_FILE, "SIM busy"); } else if (NULL !=strstr(receive,"SIM failure")) { system("echo 4 > /tmp/lock_pin"); g_pin_lock = 4; return write_at_message(CPIN_SAVE_FILE, "SIM failure"); } else if (NULL !=strstr(receive,"SIM not inserted")) { system("echo -1 > /tmp/lock_pin"); g_pin_lock = -1; return write_at_message(CPIN_SAVE_FILE, "SIM not inserted"); } else { system("echo 5 > /tmp/lock_pin"); g_pin_lock = 5; printf("LINE %d,FUNCTION %s,%s", __LINE__,__FUNCTION__,receive); return write_at_message(CPIN_SAVE_FILE, "SIM Eorr"); } } } int getcpncnt(void) { char receive[AT_RECEIVE_BUFF_SIZE] = {0}; char message[MESSAGE_SAVE_FILE_SIZE] = {0}; int pincnt = 0, pukcnt = 0; const char * pszHeader = "+BMCPNCNT: "; char * p = NULL; atoperation(BMCPNCNT, receive, 0, WAIT_TIME_LEVEL_6); printf("\n\ngetcpncnt----------------->>>>>:send %s\n",BMCPNCNT); printf("receive:%s\n",receive); if (0 != test_at_message_is_error(receive)) { return write_at_message(BMCPNCNT_SAVE_FILE, "PIN Error\nPUK Error"); } p = strstr(receive, pszHeader); if (!p) return write_at_message(BMCPNCNT_SAVE_FILE, "PIN Error\nPUK Error"); p += strlen(pszHeader); sscanf(receive, "PIN1=%d; PUK1=%d;", &pincnt, &pukcnt); sprintf(message,"PIN %d\nPUK %d", pincnt, pukcnt); return write_at_message(BMCPNCNT_SAVE_FILE, message); } void getmeid(); //wait for pin ready, if locked, wait for unlocked, if puk ,wait for unlock puk... void waitfor_pin_ready() { char buffer[48] = {0}; int cnt = 0; FILE *fd = fopen("/tmp/pin_process_status","r+"); if(NULL != fd) { printf("<<<---------------------------------->>>\n"); //fscanf(fd,"%c",g_pinstatus); char ch; ch = fgetc(fd); printf("pin_process_status -->ch:%c\n",ch); g_pinstatus = ch - '0'; printf("<<<<*************************************>>\n"); printf("g_pinstatus:%d\n",g_pinstatus); fclose(fd); } // getmeid(); int counter = 6; do { getcpin(); printf("cpin status=%d\n", g_pin_lock); //by zhuhaiyan 20120705, for pin_process_status. sprintf(buffer, "echo %d > /tmp/pin_process_status", g_pin_lock); system(buffer); if(4 == g_pin_lock && counter > 0) { counter--; sleep(1); continue; } } while(g_pin_lock == 3); //if the status is busy status, go continue... if(1 == g_pinstatus) { char pin[8]= {0}; char AT_CMD[40] = {0}; char receive[AT_RECEIVE
评论
    相关推荐
    • 无线路由配置
      NULL 博文链接:https://zht1933.iteye.com/blog/739118
    • 无线路由 无线渗透 spoonwep2 工具
      NULL 博文链接:https://xiongjiajia.iteye.com/blog/1693716
    • 无线路由信号强度检测WirelessMon
      无线路由信号强度检测WirelessMon
    • ApWiFi无线路由软件软件
      ApWiFi无线路由软件软件下载 ApWiFi软件为您快速建立一个无线路由器,只需一键为您的手机、IPad、笔记本、等各种自带wifi无线网络设备,提供高效安全简单智能的互联网访问。中英文语言、多系统平台,更加智能、傻瓜...
    • WinAircrackP无线路由破解软件
      WinAircrackPacck 是windows下的无线路由器密码破解软件,通过此软件,可以进行网络包的抓取及暴力破解
    • 笔记本电脑当无线路由
      用你的电脑当无线路由--开启windows_7的隐藏功能,建立wifi
    • spoonwep2破解无线路由
      无线破解是指wep的破解,wpa破解现在仍是技术难题,不在本文讨论之列,如果你家无线路由需要加密,为保障安全也请采用wpa模式。如果你不知道何谓wep、wpa,请百度一下,会给你一个专业的回答。最简单的解释就是无线...
    • VirtualAP c#虚拟无线路由
      VirtualAP c#虚拟无线路由网上找的,注意此源码配置无线路由仅适用于WIN7 Vista
    • 维盟945无线路由TFTP工具
      tftp修复wayos硬路由 适用于固件错误无法进入web管理界面的维盟WQR-945无线路由器的恢复,其他型号请勿使用。
    • ApWiFi 无线路由设置工具
      apwifi软件为您快速建立一个无线路由器,只需一键为您的手机、ipad、笔记本、等各种自带wifi无线网络设备,提供高效安全简单智能的互联网访问。中英文语言、多系统平台,更加智能、傻瓜式。安全的wep加密方式,操作...