AnsweredAssumed Answered

NxpNfcRdLib Linux timespec bugs (and proposed patch)

Question asked by Christian Hack on Sep 13, 2018
Latest reply on May 23, 2019 by Alexander Baar

We have just attempted to upgrade to v05.19.00 of the reader library (using SW369319). We had been using v05.02.00.


There are a number of simple bugs we have discovered in the Linux abstraction layer, some of which have been introduced since previous versions by the someone just blindly changing all the uses of timespec and not testing them. In some cases the timespec needs to be an absolute time and in others it needs to be a relative time. They have all been changed to assume a relative time.


phOsal_EventPend() has had a bug introduced by removing the code adding the wait time required and supplying the timespec structure as just the time. This means pthread_cond_timewait returns immediately. This was fine in v05.02.00 but was introduced somewhere along the way to v05.19.00. Without a public repo I'm unable to pinpoint where or why or do a pull request or similar. What is the best process to submit bug fixes and improvements?


Similarly phOsal_SemPend() needs an absolute time rather than a relative time as does phOsal_MutexLock


With these bugs, the library would hang almost immediately in phacDiscLoop_Run and was very unreliable. Is the library ever tested because it appears it couldn't have been with such glaring issues?


Patch attached.