Skip to content
Snippets Groups Projects
Commit 30553f8a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Better log messages and yielding upon ReadFile(mailslot) error.

parent 715a2f16
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3082 passed
......@@ -245,29 +245,32 @@ void _cdecl interrupt_thread(void *arg)
void _cdecl input_thread(void* arg)
{
char buf[LINEAR_RX_BUFLEN];
int space;
int count;
lputs(LOG_DEBUG,"input_thread: started");
while(1) {
count=RingBufFree(&rdbuf);
if(count<1) {
space=RingBufFree(&rdbuf);
if(space<1) {
lputs(LOG_WARNING,"input_thread: input buffer full!");
YIELD();
continue;
}
if(count>sizeof(buf))
count=sizeof(buf);
if(!ReadFile(rdslot,buf,count,&count,NULL)) {
if(space>sizeof(buf))
space=sizeof(buf);
if(!ReadFile(rdslot,buf,space,&count,NULL)) {
if(GetLastError()==ERROR_HANDLE_EOF) { /* closed by VDD_CLOSE */
lputs(LOG_INFO,"input_thread: ReadFile returned EOF");
break;
}
lprintf(LOG_ERR,"!input_thread: ReadFile Error %d (size=%d)"
,GetLastError(),count);
lprintf(LOG_ERR,"!input_thread: ReadFile Error %d (space=%d, count=%d)"
,GetLastError(), space, count);
YIELD();
continue;
}
if(count==0) {
lputs(LOG_ERR,"!input_thread: ReadFile read 0");
YIELD();
continue;
}
RingBufWrite(&rdbuf,buf,count);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment