Here is my source, so far just early stages:
[code]
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>

/**
 * Function:
 *     openDevice
 *
 * Parameters:
 *     strDevice, the device to open
 *     tBaudRate, the baud rate to use
 *     intRx, non 0 to open the device for RX
 *
 * Returns:
 *     A handle to the open device or less than 0 if failure
 */
int openDevice(const char* strDevice, speed_t tBaudRate, int intRx) {
    int intFD = open(strDevice, O_RDWR | O_NOCTTY | O_NDELAY);

    if ( intFD >= 0 ) {
        struct termios options;
// Get the current options for the port...
        tcgetattr(intFD, &options);
// Set the baud rates to 115200...
        cfsetispeed(&options, tBaudRate);
        cfsetospeed(&options, tBaudRate);
//        options.c_cflag |= (CLOCAL | CREAD);
        options.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | 
IGNCR | ICRNL | IXON);
        options.c_oflag &= ~OPOST;
        options.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
        options.c_cflag &= ~(CSIZE | PARENB);
        options.c_cflag |= CS8;

        if ( intRx ) {
            options.c_cc[VMIN]  = 0;
            options.c_cc[VTIME] = 2;
        } else {
// non-blocking, we aren't reading
            options.c_cc[VMIN] = options.c_cc[VTIME] = 0;
        }
        tcsetattr(intFD, TCSANOW, &options);

        if ( intRx ) {
            tcflush(intFD, TCIFLUSH);
        }
        fcntl(intFD, F_SETFL, FNDELAY);
        printf("%s opened and ready for use\n", strDevice);
    } else {
        printf("%s, port not ready\n", strDevice);
    }
    return intFD;
}


int main(void) {
    static const char *pstrDevice    = "/dev/ttyUSB0";

    struct timespec tsStartTime;
// Try to open the port
    int intFD = openDevice(pstrDevice, B115200, 1);

    if ( intFD >= 0 ) {
// Get the start reference time
        clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tsStartTime);

        printf("intFD: %d\n", intFD);

        close(intFD);
    }
    return EXIT_SUCCESS;
}
[/code]

When I run this in eclipse it terminates without any warning or 
explanation, simply showing Quit in the console.  When I try to execute the 
application on the Beaglebone Black I get:

[code]
root@beaglebone:/home/debian# ./helloWorldC
./helloWorldC: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.17' not 
found (required by ./helloWorldC)
[/code]

Any suggestions?

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to