Example #1
0
static COMMAND_FUNC( do_open )
{
	const char *s;

	s=NAMEOF("device file");

	if( open_serial_device(s) < 0 )
		warn("Error opening serial device");
}
Example #2
0
/*
* Purpose:  The main program loop
* Input:      argc - number of input arguments
*                argv - array of strings (input arguments)
* Return:    0
*/
int main(int argc,char *argv[]) {
    int rc=-1;
    int i = 0;

    LOGATCI(LOG_INFO, "atcid-daemon start!!!");

    //Initial the parameter for serial dervice
    initSerialDevice(&serial);
    strcpy(serial.devicename[0],TTY_GS0);
    strcpy(serial.devicename[1],TTY_GS1);
    
    for(i = 0; i < MAX_DEVICE_NUM; i++) {
        if ((serial.fd[i] = open_serial_device(&serial, serial.devicename[i])) == INVALIDE_SOCKET_FD) {
            LOGATCI(LOG_ERR, "Could not open serial device [%d] and start atci service", i);
            return ATCID_OPEN_SERIAL_DEV_ERR;
        }
    }
    
    create_thread(); 
    readerLoop((void*) &serial);
    pthread_join(s_tid_atcid, NULL);

    return 0;
}