aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_usbradio.c
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-25 03:49:30 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-25 03:49:30 +0000
commit279d77a2827bea35143f1774e67f092bd7e98511 (patch)
treeaeea6b1d1df6a6e023c5187ac31816e06795ee2b /channels/chan_usbradio.c
parent3ce5f8f4ee27228b26f6d39d9e1cf75f439995a7 (diff)
Make chan_usbradio compile under dev mode
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@158992 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_usbradio.c')
-rw-r--r--channels/chan_usbradio.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
index df5bad541..52bb8dffe 100644
--- a/channels/chan_usbradio.c
+++ b/channels/chan_usbradio.c
@@ -1107,7 +1107,9 @@ static void kickptt(struct chan_usbradio_pvt *o)
//printf("kickptt %i %i %i\n",o->txkeyed,o->txchankey,o->txtestkey);
if (!o) return;
if (!o->pttkick) return;
- write(o->pttkick[1],&c,1);
+ if (write(o->pttkick[1],&c,1) < 0) {
+ ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
+ }
}
/*
*/
@@ -1174,7 +1176,9 @@ static void *hidthread(void *arg)
{
char c;
- read(o->pttkick[0],&c,1);
+ if (read(o->pttkick[0],&c,1) < 0) {
+ ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno));
+ }
}
if(o->wanteeprom)
{
@@ -1779,7 +1783,9 @@ static int usbradio_write(struct ast_channel *c, struct ast_frame *f)
tbuff[i]= ((i16*)(f->data.ptr))[i/2];
tbuff[i+1]= o->txkeyed*M_Q13;
}
- fwrite(tbuff,2,f->datalen,ftxcapraw);
+ if (fwrite(tbuff,2,f->datalen,ftxcapraw) != f->datalen) {
+ ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
+ }
//fwrite(f->data,1,f->datalen,ftxcapraw);
}
#endif
@@ -1842,7 +1848,9 @@ static struct ast_frame *usbradio_read(struct ast_channel *c)
return f;
#if DEBUG_CAPTURES == 1
- if (o->b.rxcapraw && frxcapraw) fwrite((o->usbradio_read_buf + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2 * 2 * 6,frxcapraw);
+ if ((o->b.rxcapraw && frxcapraw) && (fwrite((o->usbradio_read_buf + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2 * 2 * 6,frxcapraw) != FRAME_SIZE * 2 * 2 * 6)) {
+ ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
+ }
#endif
#if 1
@@ -1878,7 +1886,9 @@ static struct ast_frame *usbradio_read(struct ast_channel *c)
#endif
#if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
- if (o->b.txcap2 && ftxcaptrace) fwrite((o->pmrChan->ptxDebug),1,FRAME_SIZE * 2 * 16,ftxcaptrace);
+ if ((o->b.txcap2 && ftxcaptrace) && (fwrite((o->pmrChan->ptxDebug),1,FRAME_SIZE * 2 * 16,ftxcaptrace) != FRAME_SIZE * 2 * 16)) {
+ ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
+ }
#endif
// 160 samples * 2 bytes/sample * 2 chan * 6x oversampling to 48KS/s
@@ -1936,7 +1946,9 @@ static struct ast_frame *usbradio_read(struct ast_channel *c)
#endif
#if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
- if (frxcaptrace && o->b.rxcap2 && o->pmrChan->b.radioactive) fwrite((o->pmrChan->prxDebug),1,FRAME_SIZE * 2 * 16,frxcaptrace);
+ if ((frxcaptrace && o->b.rxcap2 && o->pmrChan->b.radioactive) && (fwrite((o->pmrChan->prxDebug),1,FRAME_SIZE * 2 * 16,frxcaptrace) != FRAME_SIZE * 2 * 16 )) {
+ ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
+ }
#endif
cd = 0;
@@ -3772,7 +3784,9 @@ int RxTestIt(struct chan_usbradio_pvt *o)
PmrRx(pChan,iBuff,oBuff);
- fwrite((void *)pChan->prxDebug,2,numSamples*numChannels,hOutput);
+ if (fwrite((void *)pChan->prxDebug,2,numSamples*numChannels,hOutput) != numSamples * numChannels) {
+ ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
+ }
}
pChan->b.txCapture=0;
pChan->b.rxCapture=0;