int COM_Init (int *fd_atcmd, int *fd_uart, int *hUsbComPort)
{
     
    *fd_atcmd = openDevice();
    if(*fd_atcmd == -1) {
		LOGE(TAG "Open ccci port fail\r\n" );
        return *fd_atcmd;
    }
    
    //ATE Tool use 115200 baud rate
    *fd_uart = open_uart_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*fd_uart == -1) {
        LOGE(TAG "Open uart port %d fail\r\n" ,UART_PORT1);
        return *fd_uart;
    }
    else
        LOGD(TAG "Open uart port %d success\r\n" ,UART_PORT1);
  	
           
	//*hUsbComPort = open("/dev/ttyGS0",O_RDWR | O_NOCTTY | /*O_NONBLOCK | */O_NDELAY);
	*hUsbComPort = open_usb_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*hUsbComPort == -1)
	{
		LOGE(TAG "Open usb fail\r\n");
		return *hUsbComPort;
	}
	else
	{
		//initTermIO(*hUsbComPort);
		LOGD(TAG "Open usb success\r\n");
	}

	return 0;
}
Beispiel #2
0
int COM_Init (int *fd_atcmd, int *fd_uart, int *hUsbComPort)
{
    char dev_node[32];
    if(is_support_modem(1))
    {
        snprintf(dev_node, 32, "%s", ccci_get_node_name(USR_FACTORY_DATA, MD_SYS1));
        fd_atcmd = openDeviceWithDeviceName(dev_node);
    }

    else if(is_support_modem(2))
    {

		snprintf(dev_node, 32, "%s", ccci_get_node_name(USR_FACTORY_DATA, MD_SYS2));
        fd_atcmd = openDeviceWithDeviceName(dev_node);

    }



    if((is_support_modem(1) || is_support_modem(2)) && (*fd_atcmd == -1)) {
		LOGE(TAG "Open ccci port fail\r\n" );
        return *fd_atcmd;
    }
    
    //ATE Tool use 115200 baud rate
    *fd_uart = open_uart_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*fd_uart == -1) {
        LOGE(TAG "Open uart port %d fail\r\n" ,UART_PORT1);
        return *fd_uart;
    }
    else
        LOGD(TAG "Open uart port %d success\r\n" ,UART_PORT1);
  	
           
	//*hUsbComPort = open("/dev/ttyGS0",O_RDWR | O_NOCTTY | /*O_NONBLOCK | */O_NDELAY);
	*hUsbComPort = open_usb_port(UART_PORT1, 115200, 8, 'N', 1);
	if(*hUsbComPort == -1)
	{
		LOGE(TAG "Open usb fail\r\n");
		return *hUsbComPort;
	}
	else
	{
		//initTermIO(*hUsbComPort);
		LOGD(TAG "Open usb success\r\n");
	}

	return 0;
}