reference-ril/atchannel.c: Fix time conversion

setTimespecRelative() converts a relative time to an absolute time, by
adding the relative time to current system time. However, it fails to
handle the case where the nanosecond component (tv_nsec) of the
conversion result exceeds 10^9, which can cause a subsequent call to
pthread_cond_timedwait() to return EINVAL.

This bug is the root cause of the "no SIM card" error seen occasionally
on x86_64 Android emulator. In fact, all 64-bit targets use
setTimespecRelative() in conjunction with pthread_cond_timedwait()
during AT handshake, but an EINVAL return value from the latter will
lead to an infinite loop and hang the communication. With this fix,
x86_64 emulator can boot with functional 3G networking every time.

Signed-off-by: Jinhui Li <jinhui.li@intel.com>
[Revised code and commit message]
Signed-off-by: Yu Ning <yu.ning@intel.com>

Change-Id: If04ba560e350bc4e13b22c51f8d215a673230667
1 file changed
tree: 0bb9c99e68ff7f85ebb319779919cb35ea3e4d73
  1. include/
  2. libril/
  3. librilutils/
  4. reference-ril/
  5. rild/
  6. CleanSpec.mk