Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[submodule "mw-zcu216/project-spec/meta-mathworks"]
path = mw-zcu216/project-spec/meta-mathworks
url = https://github.com/mathworks/meta-mathworks
[submodule "project-spec/meta-mathworks"]
path = project-spec/meta-mathworks
url = https://github.com/mathworks/meta-mathworks
branch = petalinux-v2022.1
[submodule "mw_zcu216/project-spec/meta-mathworks"]
path = mw_zcu216/project-spec/meta-mathworks
url = https://github.com/mathworks/meta-mathworks
branch = petalinux-v2022.1
1 change: 1 addition & 0 deletions mw-zcu216/project-spec/meta-mathworks
Submodule meta-mathworks added at dd1406
Original file line number Diff line number Diff line change
Expand Up @@ -169,58 +169,63 @@ void acceptConnection(void)
* helper function to get "\n" terminates string from
* TCP socket
*/
int getdataString(char *buf,int len)
int getdataString(char *buf, int len)
{
int valread = 0;
int valread;
char val;
unsigned int rbytes = 0;
struct timeval tv;
fd_set fdread;
int rbytes = 0;
struct timeval tv;
fd_set fdread;
int selectStatus = 0;

tv.tv_sec = 1;
tv.tv_usec = 0;

FD_ZERO(&fdread);
FD_SET( new_data_socket, &fdread );
FD_SET(new_data_socket, &fdread);

do {
selectStatus = select(new_data_socket + 1, &fdread, NULL, NULL, &tv);
if(selectStatus == 0)
return valread;

if(FD_ISSET(new_data_socket, &fdread)) {

valread += read( new_data_socket, &val, 1);
buf[rbytes++] = val;
if(valread == 0){
selectStatus =
select(new_data_socket + 1, &fdread, NULL, NULL, &tv);
if (selectStatus == 0)
return rbytes;

if (FD_ISSET(new_data_socket, &fdread)) {
valread = read(new_data_socket, &val, 1);
if (valread <= 0) {
if (valread < 0)
perror("info -> getdataString char read < 0");
break;
}
else
buf[rbytes++] = val;
}
} while((val != '\n') && (valread < len) && (rbytes < len));
} while ((val != '\n') && (rbytes < len));

return valread;
return rbytes;
}

/*
* helper function to get "\n" terminates string from
* TCP socket
*/
int getString(char *buf,int len)
int getString(char *buf, int len)
{
int valread = 0;
int valread;
char val;
unsigned int rbytes = 0;
int rbytes = 0;

do {
valread += read(new_socket , &val, 1);
buf[rbytes++] = val;
if (valread == 0){
valread = read(new_socket, &val, 1);
if (valread <= 0) {
if (valread < 0)
perror("info -> getString char read < 0");
break;
}
} while((val != '\n') && (valread < len));
else
buf[rbytes++] = val;
} while ((val != '\n') && (rbytes < len));

return valread;
return rbytes;
}

/*
Expand Down
Loading