The device is a scanner. I know uart5 is setup in the dtsi file and in userspace it is listed under /dev/ttymxc4. From userspace, I understand that I can manipulate the device by
fd = open("/dev/ttymxc5", O_RDWR|O_NOCTTY|O_NONBLOCK);
if (fd < 0)
{
fprintf (stderr,"Open error on %s: %s\n", SCANNER_UART, strerror(errno));
return nullptr;
}
And use termios to set all the settings like baudrate, write data using the write call etc.
I am wanting to abstract a lot of the commands under sysfs. I've setup a "uart driver" like this:
result = uart_register_driver(&scanner_reg);
if (result)
return result;
result = uart_add_one_port(&scanner_reg, &scanner_port);
if (result)
uart_unregister_driver(&scanner_reg);
And I am using gpio lines to turn on the system and a few other things. However, in the schematic, I do not see the gpio lines for these things.
UART5_CTS_HOST_SCAN_3_3V
UART5_RTS_HOST_SCAN_3_3V
UART5_RxD_HOST_SCAN_3_3V
UART5_TxD_HOST_SCAN_3_3V
I am just not sure how to open/write/read data from the device. I know about sys_open and similar calls, however, I know they are not the "right" way to do this; I don't want to have to go through userspace.
So, in summary how do I
- "choose" the /dev/ttymxc4 device in my module and
- open, set baud rate, and read/write data to the device?
Thanks! Please help! New to everything uart, I've dealt with i2c in the past and it seemed less complicated.