Re: [cecd-devel] [PATCH 2/2] [libcec] fix logical address allocation
Status: Beta
Brought to you by:
pbatard
|
From: Florian F. <f.f...@gm...> - 2012-01-06 14:11:38
|
Hello Pete,
On 01/06/12 01:38, Pete Batard wrote:
> On 2012.01.05 17:13, Florian Fainelli wrote:
>> The current logical address allocation will iterate over all possible
>> logical addresses no matter what device type we configured. According
>> to the specification this is wrong, for instance, if we are a recording
>> device, we should:
>>
>> - take the unregistered address
>> - poll the<N>th logical address corresponding to a recording device
>> * if available, take it
>> * if not available continue to the next logical address
>> - until we either have a valid address or remain unregistered
>
> I think this is what we are already doing.
>
> Internally, we will iterate over all addresses, but it is not because we
> iterate them that we poll.
>
> To illustrate this, let's take the case of a playback device
> (device_type 4). The beginning of the loop code:
>
> for (logical_address = 1; logical_address< 15; logical_address++) {
> if (logical_address_table[logical_address] != device_type) {
> continue;
> }
>
> along with the fact that logical_address_table is defined as:
>
> logical_address_table[15] = {0, 1, 1, 3, 4, 5, 3, 3, 4, 1, 3, 4, 2, 2, 0};
>
> means that for logical_addresses 1 to 3, we don't do anything - we just
> increment logical_address and continue because the device_type won't
> match. Then, for logical_address 4, we have a match on the device_type,
> so we poll to see if the address is in use. If it is, then we will skip
> over logical_address 5, because the device_type won't match either and
> it's only for logical_address 8 that we will poll again.
You are right, I completely missed the use of the logical_address_table
and the use of the continue in the for loop. cecd seems to be doing it
right already.
>
> Thus, I believe that the use of a simple table and the insertion of
> continue statements achieves exactly what we need, and is a lot simpler
> than the solution your proposed.
>
>
> On the other hand, I have applied the polling message fix (good call)
> and also fixed the file permissions that got changed with the version bump.
>
> Regards,
>
> /Pete
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> cecd-devel mailing list
> cec...@li...
> https://lists.sourceforge.net/lists/listinfo/cecd-devel
|