PDA

View Full Version : Re: V 0.20 firmware and raw IR code events via CLI



John B
2004-04-06, 23:40
> Currently absolutely nothing is being done with the raw IR samples:
>
> } elsif ($op eq 'RAWI') {
> $::d_slimproto && msg("Raw IR,
> ".(length($data)/4)."samples\n");

Sean,

What sort of length is $data likely to be?
Ideally I'd just like to put the raw contents of $data into an xPL packet so that other apps around the network can use the raw data how they wish.

(unfortunately, I'm not a SqueezeBox owner yet, so can't try this for myself)

Thanks,

John

seanadams
2004-04-07, 09:47
It's going be to some number of sample pairs between 2 and 35 depending
on the format. Each sample pair is a 16-bit measurement for the high,
and then a 16 bit measurement for low side of the pulse. The min of 2
is to prevent stray IR noise in the room, eg from fluorescent lights,
from generating too much junk on the network. The max of 35 is to have
enough room for a 32 bit IR code plus lead pulse plus a little slop in
case of a bad measurement. I forget OTOH what the resolution of the
timer is - I'll get back to you on that.

Basically what you need to do to match an IR code is first decipher
what the format is supposed to look like by capturing a few sequences
and identifying what values make up a one or zero and the lead-in. Then
add some amount of fudge factor because you'll need to match values
within +/- about 10% of the average. Then write a parser for each code
format you want to recognize, and walk through them to see if they
match. To make the checking as fast as possible, first check the number
of samples is what you need, then check if the lead-in is the right
format, and then check each bit. This approach will break out of a
non-matching code set as fast as possible.

It is also really helpful to look at some IR signals on a scope
(measured at the receiver) to get an idea of what you're going to be
matching.


>
>> Currently absolutely nothing is being done with the raw IR samples:
>>
>> } elsif ($op eq 'RAWI') {
>> $::d_slimproto && msg("Raw IR,
>> ".(length($data)/4)."samples\n");
>
> Sean,
>
> What sort of length is $data likely to be?
> Ideally I'd just like to put the raw contents of $data into an xPL
> packet so that other apps around the network can use the raw data how
> they wish.
>
> (unfortunately, I'm not a SqueezeBox owner yet, so can't try this for
> myself)
>
> Thanks,
>
> John