freetdm: ftmod_libpri + ftmod_zt: some DAHDI drivers return an error of ELAST (500) on read()/write() to indicate there are events pending.

Fixup zt_read() to handle this case correctly and rework ftmod_libpri's read wrapper function to not fail when the read function returns zero bytes.

NOTE: zt_write() has not been changed (some better way to handle these events is needed then)

This should fix these log messages:

   [WARNING] ftdm_io.c:3561 [s1c16][1:16] raw I/O read filed
   [CRIT] lpwrap_pri.c:125 span 1 D-READ FAIL! []
   [CRIT] lpwrap_pri.c:157 span 1 D-WRITE FAIL! []
   [ERR] ftmod_libpri.c:131 Short write: -1/6 (Unknown error 500)

Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de>
This commit is contained in:
Stefan Knoblich committed 2010-12-07 20:06:48 +01:00
1 parent 6a36b8f33f
commit 60cb91b042
2 files changed
+28 -14

No files matched your search

@@ -134,17 +134,18 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen)
spri->errs = 0;
res = (int)len;
memset(&((unsigned char*)buf)[res], 0, 2);
res += 2;
if (res > 0) {
memset(&((unsigned char*)buf)[res], 0, 2);
res += 2;
#ifdef IODEBUG
{
char bb[2048] = { 0 };
{
char bb[2048] = { 0 };
print_hex_bytes(buf, res - 2, bb, sizeof(bb));
ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2);
}
print_hex_bytes(buf, res - 2, bb, sizeof(bb));
ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2);
}
#endif
}
return res;
}