Fehler 11 Lesen aus Com Port: Ressource vorübergehend nicht verfügbar

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Fehler 11 Lesen aus Com Port: Ressource vorübergehend nicht verfügbar

by Anonymous » 02 Apr 2025, 15:36

Ich studiere die Interaktion mit COM -Ports in C ++ auf einer virtuellen Maschine mit Ubuntu 24.04.2. Ich sehe also, dass ich in den COM-Port schreiben kann.#include
#include
#include
#include
#include

void configurePort(int fd)
{
struct termios options;

// Get current port parameters
tcgetattr(fd, &options);

// Set data rate
cfsetispeed(&options, B115200);
cfsetospeed(&options, B115200);

// Set 8 data bits, no parity, 1 stop bit
options.c_cflag &= ~PARENB; // No parity
options.c_cflag &= ~CSTOPB; // 1 stop bit
options.c_cflag &= ~CSIZE; // Reset data size
options.c_cflag |= CS8; // 8 bits of data

// Set non-canonical input mode and disable flow control
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
options.c_iflag &= ~(IXON | IXOFF | IXANY);

// Apply settings
tcsetattr(fd, TCSANOW, &options);
}

void sendData(int fd, const char* message)
{
ssize_t bytesWritten = write(fd, message, strlen(message));

if (bytesWritten < 0)
{
std::cerr

Top