All of lore.kernel.org
 help / color / mirror / Atom feed
* rc-core: how to use hid (hardware) decoder?
@ 2017-07-14  1:14 Antti Palosaari
  2017-07-15  9:05 ` Sean Young
  0 siblings, 1 reply; 3+ messages in thread
From: Antti Palosaari @ 2017-07-14  1:14 UTC (permalink / raw)
  To: LMML

Moikka!
Some remote controller receivers uses HID interface. I looked rc-core 
implementation, but failed to find how it could be used for hid. I need 
somehow get scancodes and keycodes out from rc-core and write those to 
hardware which then generate hid events. Also, I am not sure if kernel 
keycodes are same than HID codes, but if not then those should be 
translated somehow.

There is rc_g_keycode_from_table() function, which could be used to dump 
current scancode:keycode mapping, but calling it in a loop millions of 
times is not surely correctly :]

Any ideas?

regards
Antti


-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rc-core: how to use hid (hardware) decoder?
  2017-07-14  1:14 rc-core: how to use hid (hardware) decoder? Antti Palosaari
@ 2017-07-15  9:05 ` Sean Young
  2017-07-15  9:54   ` Antti Palosaari
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Young @ 2017-07-15  9:05 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: LMML

Hello,

On Fri, Jul 14, 2017 at 04:14:05AM +0300, Antti Palosaari wrote:
> Moikka!
> Some remote controller receivers uses HID interface. I looked rc-core
> implementation, but failed to find how it could be used for hid. I need
> somehow get scancodes and keycodes out from rc-core and write those to
> hardware which then generate hid events. Also, I am not sure if kernel
> keycodes are same than HID codes, but if not then those should be translated
> somehow.
>
> There is rc_g_keycode_from_table() function, which could be used to dump
> current scancode:keycode mapping, but calling it in a loop millions of times
> is not surely correctly :]

Possibly you could use rc_map_get() to get the entire array. However you
would be limited to rc keymaps which are compiled into the kernel.

It be good to expose an interface to userspace which allows you to read and
write the mapping from IR protocol + scancode to hid usage codes; you could
then have an ir-keytable-like tool to change the keymap.


Sean

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rc-core: how to use hid (hardware) decoder?
  2017-07-15  9:05 ` Sean Young
@ 2017-07-15  9:54   ` Antti Palosaari
  0 siblings, 0 replies; 3+ messages in thread
From: Antti Palosaari @ 2017-07-15  9:54 UTC (permalink / raw)
  To: Sean Young; +Cc: LMML

On 07/15/2017 12:05 PM, Sean Young wrote:
> Hello,
> 
> On Fri, Jul 14, 2017 at 04:14:05AM +0300, Antti Palosaari wrote:
>> Moikka!
>> Some remote controller receivers uses HID interface. I looked rc-core
>> implementation, but failed to find how it could be used for hid. I need
>> somehow get scancodes and keycodes out from rc-core and write those to
>> hardware which then generate hid events. Also, I am not sure if kernel
>> keycodes are same than HID codes, but if not then those should be translated
>> somehow.
>>
>> There is rc_g_keycode_from_table() function, which could be used to dump
>> current scancode:keycode mapping, but calling it in a loop millions of times
>> is not surely correctly :]
> 
> Possibly you could use rc_map_get() to get the entire array. However you
> would be limited to rc keymaps which are compiled into the kernel.
> 
> It be good to expose an interface to userspace which allows you to read and
> write the mapping from IR protocol + scancode to hid usage codes; you could
> then have an ir-keytable-like tool to change the keymap.

That was just the plan. I added callback to ir_update_mapping() in order 
to get info and new rc_map every-time when it was changed. Then driver 
configures hid table accordingly.

I ran some issues:
* HID has very limited set of keys used for remote controllers compared 
to linux. So mapping from Linux remote controller to HID went hard.

* NEC 16/24/32 mess. rc_map used by rc-core was typed as NEC16, even 
there was NEC24 scancodes. So more self-made heuristics as hw wants NEC32.

So I given it up. I can configure that remote both polling mode via 
rc-core and HID. rc-core gives much more flexibility, mainly due to 
limited keymap of HID (hw supports only HID page 7, keyboard).

regards
Antti

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-15  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-14  1:14 rc-core: how to use hid (hardware) decoder? Antti Palosaari
2017-07-15  9:05 ` Sean Young
2017-07-15  9:54   ` Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.