Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Function openSerial() changes the portname parameter #8

Closed
johnvermaas opened this issue Sep 12, 2018 · 0 comments
Closed

Function openSerial() changes the portname parameter #8

johnvermaas opened this issue Sep 12, 2018 · 0 comments

Comments

@johnvermaas
Copy link

The function openSerial() changes the portname parameter at the end were fd is established:

if (com.hComm == INVALID_HANDLE_VALUE) return -1;
strncpy(portname, portname + 3, 1);
com.fd = atoi(portname); //COMx
SerialParams.DCBlength = sizeof(SerialParams);
return com.fd;

This can easily be fixed as follows:

if (com.hComm == INVALID_HANDLE_VALUE) return -1;
com.fd = atoi(portname + 3);							// COMx and COMxx
SerialParams.DCBlength = sizeof(SerialParams);
return com.fd;

There is a type at the beginning as well:

//COMx
else {
	com.port = calloc(1, sizeof(char) * 5));
}

There is one bracket to many on right side. It should be:

//COMx
else {
	com.port = calloc(1, sizeof(char) * 5);

Sending appears to be working correctly, but I have trouble receiving data.
Is there something where i can define a receive buffer size?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants