M
M
Michael.2013-08-01 11:09:42
linux
Michael., 2013-08-01 11:09:42

Unable to open COM port on linux

I'm trying to open a COM port using the following code:

hComDevice = open(portName.toAscii().data(), O_RDWR | O_NOCTTY | O_NDELAY);
    if (hComDevice < 0)
        return false;

portName.toAscii().data() is a regular array of characters => "/dev/ttyS0"
The open() function returns "-1".
I tried to run the same code on another machine - everything opens fine.

dmesg output:
dmesg | grep tty
[    0.000000] console [tty0] enabled
[    0.826790] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.847317] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    0.867827] serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A
[    0.888346] serial8250: ttyS3 at I/O 0x2e8 (irq = 3) is a 16550A
[    0.909101] 00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.940506] 00:07: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    0.972505] 00:08: ttyS2 at I/O 0x3e8 (irq = 10) is a 16550A
[    1.004516] 00:09: ttyS3 at I/O 0x2e8 (irq = 11) is a 16550A


Tell me what you need to check / install so that you can work with the com-port.

OS - debian wheezy, 32-bit; DE - KDE

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kenny_opennix, 2013-08-01
@kulinich

Command output please.

ls -l /dev/ttyS*

echo works correctly?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question