[Asterisk-Dev] zaptel driver reads

Liam Kenny liam at druidsoftware.com
Fri Jun 6 01:36:27 MST 2003


Hi Rafael,

I think I may have mislead you. The problem I describe is only an
issue when you write a user space program that directly accesses zaptel file
descriptors. Under those circumstances, you currently need to ensure
that you set the drivers block size to the value you will use in the "read"
calls on that file descriptor.

*, as far as I can tell, always does this - e.g. chan_zap.c does.
(So any user of the * program should be OK - unless someone forgot
to do it for one of the zaptel devices - unlikely)
Mark and the other * developers are obviously aware of/designed this
behaviour.  
My question was : is it a driver design decision for efficiency/simplicity/
etc. at the expense of having to remember to do a few more things in 
userland ?

I only ask this because I got a surprise when I tried to use the zaptel
 driver directly without any user library wrapper like zapata.

Liam.

>From: <rafael.gonzalez at avanzada7.com>
>To: <asterisk-dev at lists.digium.com>
>Subject: Re: [Asterisk-Dev] zaptel driver reads
>Date: Thu, 5 Jun 2003 13:49:18 +0200
>Reply-To: asterisk-dev at lists.digium.com
>Hi,
>
>I have problems with zap channel.
>
>When * detects a call through X100P,  it pickup the call but when the
>other side of communication hangups, * doesn't recognize hungup.
>
>I think, this problem its resolved with your 'patch'.  Please, i need
>more information for resolved this problem.
>
>Thanks in advance
>
>
>Rafael Gonzalez Lomeña
>
>
>----- Original Message -----
>From: "Liam Kenny" <liam at druidsoftware.com>
>To: <asterisk-dev at lists.digium.com>
>Sent: Thursday, June 05, 2003 11:59 AM
>Subject: [Asterisk-Dev] zaptel driver reads
>
>
>>
>> Hi,
>>
>> I noticed that doing a read on a zaptel driver file descriptor will
>> discard any bytes in the current zaptel buffer that were not consumed
>> by the read. i.e. If there are 200 bytes in the current read buffer, and
>> a user process invokes read asking for 150 bytes, then the remaining
>> 50 bytes will be discarded by the driver and will never be received by
>> the user.
>>
>> So for instance if a user process is reading a zaptel clear channel, it
>> should always set the channels bufsize (using ioctl) to equal the chunk
>> size it will use for reads on that channel.
>>
>> Note:  I modified zt_read in zaptel.c so that it did not discard the extra
>> bytes just to be sure I understood this behaviour correctly
>>
>> Since Im new to asterisk I wondered if anyone could tell me whether this
is
>> designed behaviour ? i.e. Is it a well known prerequisite to using the
zaptel
>> driver that the bufsize should always be initialised. (Like zap_open does
>> in zapata)
>>
>> Thanks,
>> Liam.




More information about the asterisk-dev mailing list