I'd like to use the Debug UART (UART2) on the AT&T IoT Starter Kit (2nd Gen) dev board to communicate with another board, and I'm using the iot_monitor demo application as a starting point for our own demo project. I can successfully do POSIX open and write to what I believe is the correct device. However I can only semi-successfully do a read, which seems to get messed up due to the login prompt presented by the system, as described in this forum link. When I use "screen" on my Mac to read from UART2, the following works fine ("12345" is printed on the Mac terminal):
#define UART2 "/dev/ttyHSL0"
int fd = open(UART2, O_RDWR);
char *str = "12345\n";
write(fd, str, strlen(str));
However, as stated above, the aforementioned login prompt conflicts with my reads. For example, if the below code is in a loop, the read call blocks, and when 2 characters are typed in the Mac terminal, read may or may not return, depending upon the state of the command prompt the deivce presents (depending upon whether the prompt is waiting for user or password or ???). Here's the read code:
memset(buffer, 0, sizeof(buffer));
int readResult = read(fd, buffer, 2);
Here's what I see in the Mac screen/terminal after restarting my application (commentary added after the fact). "apptcu" is the name of my application:
[ 151.287522] register GPIO(23) by apptcu is success.
[ 157.328090] i2c-msm-v2 78b7000.i2c: NACK: slave not responding, ensure its powered: msgs(n:2 cur:0 tx) bc(rx:1 tx:1) mode:FIFO slv_addr:0x5f MSTR_STS:0x0d1300c8 OPER:0x00000010
12345 // This is the output of my write, just after the open.
aa // I typed "aa", and my read does not read these bytes. This appears to be the prompt waiting for login/username
Password: // Typed "aa" for the second time, again my read does not read these bytes. This input appears to be treated like the password
aa // Typed "aa" the third time, and my read does indeed read these bytes, and my app proceeds thru its loop.
D54A1 login: aa
// ... etc.
I'm really hoping there's a way to disable this login prompt, but guessing there is not. Is there some way I can reliably read UART2? It seems that UART1 may not be available according to this link, which states "The WNC module firmware limits UART1 to predefined system functions for: High Speed Data Transfer "/. Any help is appreciated!