[linux-dvb] Hauppauge IR remote codes & basic C programming

Darren Salt linux at youmustbejoking.demon.co.uk
Thu Apr 27 19:25:39 CEST 2006

I demand that Simon Baxter may or may not have written...

> I'm trying to get some more granluarity on the IR codes produced by my
> remote and WinTV Nova-T card.
> Darren's patch [...] I think was written for an A415 remote,

The budget-ci patches assume an R808; the cx88 patch assumes an A415.

> but this patch stops any codes appearing while monitoring 'input-events 2'.
> My remote is a Grey R808-HPG-S 0604 002568.

Hmm... I think that only "R808" is significant. (34-button? Numbers at top?
Colour buttons arranged around the arrow keys?)

> My c programming is very poor.  What does the command 'ir->sampling =
> (0x1E<<6) | 1'   do??  Is 'ir->sampling' a variable? (can you have '-' &
> '>' in a variable????)

ir is a pointer to a structure. "->" is needed to access the structure
content through the pointer.

> If so, and his A415 remote generates 0x16 to 0x1E (if this is what this
> means), how do I find out what my remote sends?

No. It's (address << 6) | 1; though since the address is 0x1E and not 0, the
"| 1" isn't needed.

> Also, what does 'ir->release = jiffies + msecs_to_jiffies(120)'  do?

The calculation is of a timeout, 120ms from the current time.

What you seem to want is this:

  # echo 1 >/sys/module/cx88xx/parameters/ir_debug

Now press a key on your remote control - let's say the power button. For my
two remote controls (R808 and A415, in that order):

  # dmesg | grep biphase
  cx88[0] IR: biphase decoded: 3ffd
  cx88[0] IR: biphase decoded: 3fbd

(Don't worry if you see 37fd or 37bd. That's normal; bit 11 is toggled by
the remote control on each new key press. Bits 12 to 15 are fixed; bits 0 to
5 are the key code.)

Plugging the numbers into ((value >> 6) & 0x1F), we get 0x1F and 0x1E.

Once done, don't forget
  # echo 0 >/sys/module/cx88xx/parameters/ir_debug
unless you like spamming the kernel message buffer ;-)

If I'm right about this then, for your remote control:
  * either:
    - replace that 0x1E with 0x1F, so you end up with (0x1F<<6) | 1
    - replace the 0x1F which is added in the last hunk of my patch with 0x1E,
      which will allow addresses 0x1E and 0x1F; you end up with
      ((ircode ^ ir->sampling) & (0x1E << 6)))
  * recompile, reinstall, reload.

Or you could suffer from interference from the TV remote control:
  # echo 1 >/sys/module/cx88xx/parameters/ir_any_address

I'm thinking that maybe we need to add some parameters with suitable
common-case defaults (given here for Nova-T, assuming A415):

  ir_address_width (5)
  ir_address_shift (6)
  ir_address_value (0x1E)
  ir_keypress_bit  (11)

Except that these should be per-device, not per-module - array, perhaps?

| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
|   Say NO to UK ID cards. http://www.no2id.net/

It is impossible to make anything foolproof because fools are so ingenious.

More information about the linux-dvb mailing list