ir-core: add imon device driver
Subsystems (3)
cover ir-core: add imon device driver
The following series adds a new device driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
This driver was previously submitted as a pure input layer driver, but I was convinced to port it to the new ir-core infrastructure, so this patch is against http://git.linuxtv.org/mchehab/ir.git.
With only some minor modifications to ir-core (making an already exported function public) and reasonably little porting driver-side, I've managed to finish at least the initial conversion. There's still a local key release timer in use in the driver that needs to be converted to use ir-core's keyup timer, and I'm not using ir_keydown due to some serious quirks in the way the imon hardware decodes IR signals (I need to do my own key release detection, as there are three different ways a key release is identified even on the exact same device...), but it does use all the ir-core keymap loading and parsing code, ir_input_dev, ir_dev_props, etc.
Something I wasn't too sure about... Where exactly should an IR-only device driver live in the tree? I've put it at drivers/media/IR/imon.c for the moment, but it might make sense to have a drivers/media/IR/hardware/ directory to drop things like this and the forthcoming lirc_mceusb port into, rather than intermingling with the core bits.
The most important part: I've tested this out w/actual imon hardware, and it even works. :)
---
Jarod Wilson (3)
ir-core: make ir_g_keycode_from_table a public function
ir-core: add imon pad and mce keymaps
ir-core: add imon driver
drivers/media/IR/Kconfig | 12 + drivers/media/IR/Makefile | 3 + drivers/media/IR/imon.c | 2417 ++++++++++++++++++++++++++++++++ drivers/media/IR/ir-core-priv.h | 7 - drivers/media/IR/keymaps/Makefile | 2 + drivers/media/IR/keymaps/rc-imon-mce.c | 142 ++ drivers/media/IR/keymaps/rc-imon-pad.c | 155 ++ include/media/ir-core.h | 1 + include/media/rc-map.h | 2 + 9 files changed, 2734 insertions(+), 7 deletions(-)
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 1/3 ir-core: make ir_g_keycode_from_table a public function
The imon driver I've previously submitted and have been porting to use ir-core needs to use ir_g_keycode_from_table, as ir_keydown is not sufficient, due to these things having really oddball hardware decoders in them. This just moves the function declaration from ir-core-priv.h over to ir-core.h.
--- drivers/media/IR/ir-core-priv.h | 7 ------- include/media/ir-core.h | 1 + 2 files changed, 1 insertions(+), 7 deletions(-)
drivers/media/IR/ir-core-priv.h +0 -7
@@ -57,13 +57,6 @@ struct ir_raw_event_ctrl {#define TO_US (duration) ((int)TO_UNITS(duration, 1000))/* -* Routines from ir-keytable.c to be used internally on ir-core and decoders -*/ - -u32 ir_g_keycode_from_table (struct input_dev *input_dev, -u32 scancode); - -/* * Routines from ir-sysfs.c - Meant to be called only internally inside * ir-core */
include/media/ir-core.h +1 -0
@@ -124,6 +124,7 @@ void ir_input_unregister(struct input_dev *input_dev);void ir_repeat (struct input_dev *dev);void ir_keydown (struct input_dev *dev,int scancode,u8 toggle); +u32 ir_g_keycode_from_table (struct input_dev *input_dev,u32 scancode);/* From ir-raw-event.c */
Signature · 2 lines
Jarod Wilson [email protected]
PATCH 2/3 ir-core: add imon pad and mce keymaps
In reply to Jarod WilsonThis adds the keymaps for the hardware decode scancodes imon devices create for their native imon pad (and mini) remotes, and the hardware scancodes generated by the imon devices when used with an rc6 windows media center ed. remote.
--- drivers/media/IR/keymaps/Makefile | 2 + drivers/media/IR/keymaps/rc-imon-mce.c | 142 +++++++++++++++++++++++++++++ drivers/media/IR/keymaps/rc-imon-pad.c | 155 ++++++++++++++++++++++++++++++++ include/media/rc-map.h | 2 + 4 files changed, 301 insertions(+), 0 deletions(-)
drivers/media/IR/keymaps/Makefile +2 -0
@@ -30,6 +30,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-genius-tvgo-a11mce.o \ rc-gotview7135.o \ rc-hauppauge-new.o \ + rc-imon-mce.o \ + rc-imon-pad.o \ rc-iodata-bctv7e.o \ rc-kaiomy.o \ rc-kworld-315u.o \
drivers/media/IR/keymaps/rc-imon-mce.c new file +142 -0
142 lines not on this page · raw message
drivers/media/IR/keymaps/rc-imon-pad.c new file +155 -0
155 lines not on this page · raw message
include/media/rc-map.h +2 -0
@@ -79,6 +79,8 @@ void rc_map_init(void);#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"#define RC_MAP_GOTVIEW7135 "rc-gotview7135"#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new" +#define RC_MAP_IMON_MCE "rc-imon-mce" +#define RC_MAP_IMON_PAD "rc-imon-pad"#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"#define RC_MAP_KAIOMY "rc-kaiomy"#define RC_MAP_KWORLD_315U "rc-kworld-315u"
Signature · 2 lines
Jarod Wilson [email protected]
Re: [PATCH 2/3] ir-core: add imon pad and mce keymaps
Quoted 40 lines · Jarod Wilson
This adds the keymaps for the hardware decode scancodes imon devices create for their native imon pad (and mini) remotes, and the hardware scancodes generated by the imon devices when used with an rc6 windows media center ed. remote.
Signed-off-by Jarod Wilson <[email protected]>--- drivers/media/IR/keymaps/Makefile | 2 + drivers/media/IR/keymaps/rc-imon-mce.c | 142 +++++++++++++++++++++++++++++ drivers/media/IR/keymaps/rc-imon-pad.c | 155 ++++++++++++++++++++++++++++++++ include/media/rc-map.h | 2 + 4 files changed, 301 insertions(+), 0 deletions(-)drivers/media/IR/keymaps/Makefile +2
-0@@ -30,6 +30,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-genius-tvgo-a11mce.o \ rc-gotview7135.o \ rc-hauppauge-new.o \ + rc-imon-mce.o \ + rc-imon-pad.o \ rc-iodata-bctv7e.o \ rc-kaiomy.o \ rc-kworld-315u.o \drivers/media/IR/keymaps/rc-imon-mce.c new file +6
-0@@ -0,0 +1,142 @@ +/* rc5-imon-mce.c - Keytable for Windows Media Center RC-6 remotes for use +* with the SoundGraph iMON/Antec Veris hardware IR decoder +* +* Copyright (c) 2010 by Jarod Wilson <[email protected]> +* +* This program is free software; you can redistribute it and/or modify
drivers/media/IR/keymaps/rc-imon-mce.c line 16
Quoted 10 lines
drivers/media/IR/keymaps/rc-imon-mce.c new file +10
-0+* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#include <media/rc-map.h> + +/* mce-mode imon mce remote key table */ +static struct ir_scancode imon_mce[] = { +/* keys sorted mostly by frequency of use to optimize lookups */
Won't help at all, entries are inserted in scancode order in the actual in-kernel keytable to allow for binary scancode searches.
Quoted 4 lines
drivers/media/IR/keymaps/rc-imon-mce.c new file +4
-0+ { 0x800ff415, KEY_REWIND }, + { 0x800ff414, KEY_FASTFORWARD }, + { 0x800ff41b, KEY_PREVIOUS }, + { 0x800ff41a, KEY_NEXT },
...
Quoted 18 lines
drivers/media/IR/keymaps/rc-imon-pad.c new file +11
-0@@ -0,0 +1,155 @@ +/* rc5-imon-pad.c - Keytable for SoundGraph iMON PAD and Antec Veris +* RM-200 Remote Control +* +* Copyright (c) 2010 by Jarod Wilson <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +
drivers/media/IR/keymaps/rc-imon-pad.c line 21
Quoted 10 lines
drivers/media/IR/keymaps/rc-imon-pad.c new file +10
-0+#include <media/rc-map.h> + +/* +* standard imon remote key table, which isn't really entirely +* "standard", as different receivers decode the same key on the +* same remote to different hex codes, and the silkscreened names +* vary a bit between the SoundGraph and Antec remotes... ugh. +*/ +static struct ir_scancode imon_pad[] = { +/* keys sorted mostly by frequency of use to optimize lookups */
Ditto
Signature · 1 line
David Härdeman
Re: [PATCH 2/3] ir-core: add imon pad and mce keymaps
Quoted 6 lines · David Härdeman
Quoted 5 lines · Jarod Wilson
This adds the keymaps for the hardware decode scancodes imon devices create for their native imon pad (and mini) remotes, and the hardware scancodes generated by the imon devices when used with an rc6 windows media center ed. remote.
...
Quoted 6 lines
drivers/media/IR/keymaps/rc-imon-mce.c line 16
Quoted 3 lines
drivers/media/IR/keymaps/rc-imon-mce.c new file +3
-0+/* mce-mode imon mce remote key table */ +static struct ir_scancode imon_mce[] = { + /* keys sorted mostly by frequency of use to optimize lookups */Won't help at all, entries are inserted in scancode order in the actual in-kernel keytable to allow for binary scancode searches.
Ah, yeah, that'd be some "legacy" cruft from when the driver was using its own internal key table and lookups, making mental note to remove those comments...
Signature · 6 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 ir-core: add imon driver
In reply to Jarod WilsonThis is a new driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
--- drivers/media/IR/Kconfig | 12 + drivers/media/IR/Makefile | 3 + drivers/media/IR/imon.c | 2417 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2432 insertions(+), 0 deletions(-)
drivers/media/IR/Kconfig +12 -0
@@ -36,3 +36,15 @@ config IR_RC6_DECODER ---help--- Enable this option if you have an infrared remote control which uses the RC6 protocol, and you need software decoding support. + +config IR_IMON + tristate "SoundGraph iMON Receiver and Display" + depends on USB_ARCH_HAS_HCD + depends on IR_CORE + select USB + ---help--- + Say Y here if you want to use a SoundGraph iMON (aka Antec Veris) + IR Receiver and/or LCD/VFD/VGA display. + + To compile this driver as a module, choose M here: the + module will be called imon.
drivers/media/IR/Makefile +3 -0
@@ -8,3 +8,6 @@ obj-$(CONFIG_VIDEO_IR) += ir-common.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o + +# stand-alone IR receivers/transmitters +obj-$(CONFIG_IR_IMON) += imon.o
drivers/media/IR/imon.c new file +2417 -0
2,417 lines not on this page · raw message
Signature · 2 lines
Jarod Wilson [email protected]
Re: [PATCH 3/3] ir-core: add imon driver
Em Fri, 16 Apr 2010 17:29:02 -0400
Jarod Wilson <[email protected]> escreveu:
drivers/media/IR/imon.c line 339
Quoted 13 lines
This is a new driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
drivers/media/IR/imon.c new file +7
-0+/* IR protocol: native iMON, Windows MCE (RC-6), or iMON w/o PAD stabilize */ +static int ir_protocol; +module_param (ir_protocol, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (ir_protocol,"Which IR protocol to use. 0=auto-detect, " +"1=Windows Media Center Ed. (RC-6), 2=iMON native, " +"4=iMON w/o PAD stabilize (default: auto-detect)" ); +
You don't need this. Let's the protocol to be adjustable via sysfs. All you need to do is to use the set_protocol callbacks with something like:
props->allowed_protos = IR_TYPE_RC6 | IR_TYPE_<imon protocol>;
props->change_protocol = imon_ir_change_protocol;You can see an example of such implementation at drivers/media/video/em28xx-em28xx-input.c. Look for em28xx_ir_change_protocol() function.
That's said, I'm not sure what would be better way to map IR_TYPE_<imon protocol>. Maybe we can just use IR_TYPE_OTHER.
So, basically, we'll have:
IR_TYPE_OTHER | IR_TYPE_RC6 - auto-detected between RC-6 and iMON
IR_TYPE_OTHER - iMON proprietary protocol
IR_TYPE_RC6 - RC-6 protocol
By doing this, the userspace application ir-keycode will already be able to handle the IR protocol.
I'm not sure how to map the "PAD stablilize" case, but it seems that the better would be to add a sysfs node for it, at sys/class/rc/rc0. There are other cases where some protocols may require some adjustments, so I'm thinking on having some protocol-specific properties there.
Except for that, the patch looked sane to my eyes. So, I'll add it on my tree and wait for a latter patch from you addressing the protocol control.
Signature · 2 lines
Cheers, Mauro
Re: [PATCH 3/3] ir-core: add imon driver
Quoted 20 lines · Mauro Carvalho Chehab
Em Fri, 16 Apr 2010 17:29:02 -0400
Jarod Wilson <[email protected]> escreveu:drivers/media/IR/imon.c line 339
Quoted 13 lines
This is a new driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
drivers/media/IR/imon.c new file +7
-0+/* IR protocol: native iMON, Windows MCE (RC-6), or iMON w/o PAD stabilize */ +static int ir_protocol; +module_param (ir_protocol, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (ir_protocol,"Which IR protocol to use. 0=auto-detect, " +"1=Windows Media Center Ed. (RC-6), 2=iMON native, " +"4=iMON w/o PAD stabilize (default: auto-detect)" ); +You don't need this. Let's the protocol to be adjustable via sysfs. All you need to do is to use the
set_protocolcallbacks with something like:
Quoted 5 lines
props->allowed_protos = IR_TYPE_RC6 | IR_TYPE_<imon protocol>; props->change_protocol = imon_ir_change_protocol;You can see an example of such implementation at
drivers/media/video/em28xx-em28xx-input.c. Look forem28xx_ir_change_protocol()function.
Working on it now... I'm about 95% of the way there, just need to sort out one last little bit...
Quoted 5 lines
That's said, I'm not sure what would be better way to map IR_TYPE_<imon protocol>. Maybe we can just use
IR_TYPE_OTHER.So, basically, we'll have:
Quoted 7 lines
IR_TYPE_OTHER|IR_TYPE_RC6- auto-detected between RC-6 and iMON
IR_TYPE_OTHER- iMON proprietary protocol
IR_TYPE_RC6- RC-6 protocolBy doing this, the userspace application ir-keycode will already be able to handle the IR protocol.
I'm going to go with IR_TYPE_OTHER for the iMON native proto for now. To be honest, I don't have a clue what the actual IR protocol looks like... I should try one of my iMON remotes w/an mce transceiver to see if I can figure it out...
Quoted 3 lines
I'm not sure how to map the "PAD stablilize" case, but it seems that the better would be to add a sysfs node for it, at sys/class/rc/rc0. There are other cases where some protocols may require some adjustments, so I'm thinking on having some protocol-specific properties there.
For the moment, I'm dropping the ir_protocol modparam and adding a pad_stabilize one. It was a hack to have it as a protocol, all it really needs to do is bypass a function when processing the pad signals. Can convert it to something more standard once we have a standard for protocol-specific properties. (The pad_thresh modparam is probably a similar case).
Quoted 2 lines
Except for that, the patch looked sane to my eyes. So, I'll add it on my tree and wait for a latter patch from you addressing the protocol control.
Good deal, I'm working off the v4l-dvb git tree now, hope to have something a bit later tonight or tomorrow.
Signature · 2 lines
Jarod Wilson [email protected]
Re: [PATCH 3/3] ir-core: add imon driver
Quoted 18 lines · Jarod Wilson
Quoted 17 lines · Mauro Carvalho Chehab
Em Fri, 16 Apr 2010 17:29:02 -0400
Jarod Wilson <[email protected]> escreveu:drivers/media/IR/imon.c line 339
Quoted 11 lines
This is a new driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
drivers/media/IR/imon.c new file +7
-0+/* IR protocol: native iMON, Windows MCE (RC-6), or iMON w/o PAD stabilize */ +static int ir_protocol; +module_param (ir_protocol, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (ir_protocol,"Which IR protocol to use. 0=auto-detect, " +"1=Windows Media Center Ed. (RC-6), 2=iMON native, " +"4=iMON w/o PAD stabilize (default: auto-detect)" ); +You don't need this. Let's the protocol to be adjustable via sysfs. All you need to do is to use the
set_protocolcallbacks with something like:
Quoted 8 lines
Quoted 5 lines
props->allowed_protos = IR_TYPE_RC6 | IR_TYPE_<imon protocol>; props->change_protocol = imon_ir_change_protocol;You can see an example of such implementation at
drivers/media/video/em28xx-em28xx-input.c. Look forem28xx_ir_change_protocol()function.Working on it now... I'm about 95% of the way there, just need to sort out one last little bit...
Good!
Quoted 10 lines
Quoted 10 lines
That's said, I'm not sure what would be better way to map IR_TYPE_<imon protocol>. Maybe we can just use
IR_TYPE_OTHER.So, basically, we'll have:
IR_TYPE_OTHER|IR_TYPE_RC6- auto-detected between RC-6 and iMON
IR_TYPE_OTHER- iMON proprietary protocol
IR_TYPE_RC6- RC-6 protocol
Quoted 7 lines
Quoted 2 lines
By doing this, the userspace application ir-keycode will already be able to handle the IR protocol.
I'm going to go with
IR_TYPE_OTHERfor the iMON native proto for now. To be honest, I don't have a clue what the actual IR protocol looks like... I should try one of my iMON remotes w/an mce transceiver to see if I can figure it out...
It would be a good idea to get the real protocol, instead of using OTHER. Maybe one of the already-existing decoders may be able to catch it, if you use a raw decoder device.
Quoted 10 lines
Quoted 3 lines
I'm not sure how to map the "PAD stablilize" case, but it seems that the better would be to add a sysfs node for it, at sys/class/rc/rc0. There are other cases where some protocols may require some adjustments, so I'm thinking on having some protocol-specific properties there.
For the moment, I'm dropping the
ir_protocolmodparam and adding apad_stabilizeone. It was a hack to have it as a protocol, all it really needs to do is bypass a function when processing the pad signals. Can convert it to something more standard once we have a standard for protocol-specific properties. (Thepad_threshmodparam is probably a similar case).
Yes. Suggestions/patches for those protocol-specific parameters are welcome ;)
Quoted 5 lines
Quoted 2 lines
Except for that, the patch looked sane to my eyes. So, I'll add it on my tree and wait for a latter patch from you addressing the protocol control.
Good deal, I'm working off the v4l-dvb git tree now, hope to have something a bit later tonight or tomorrow.
Ok.
Signature · 2 lines
Cheers, Mauro
Re: [PATCH 3/3] ir-core: add imon driver
Quoted 22 lines · Mauro Carvalho Chehab
Quoted 21 lines · Jarod Wilson
Quoted 20 lines · Mauro Carvalho Chehab
Em Fri, 16 Apr 2010 17:29:02 -0400
Jarod Wilson <[email protected]> escreveu:drivers/media/IR/imon.c line 339
Quoted 11 lines
This is a new driver for the SoundGraph iMON and Antec Veris IR/display devices commonly found in many home theater pc cases and as after-market case additions.
drivers/media/IR/imon.c new file +7
-0+/* IR protocol: native iMON, Windows MCE (RC-6), or iMON w/o PAD stabilize */ +static int ir_protocol; +module_param (ir_protocol, int,S_IRUGO |S_IWUSR ); +MODULE_PARM_DESC (ir_protocol,"Which IR protocol to use. 0=auto-detect, " +"1=Windows Media Center Ed. (RC-6), 2=iMON native, " +"4=iMON w/o PAD stabilize (default: auto-detect)" ); +You don't need this. Let's the protocol to be adjustable via sysfs. All you need to do is to use the
set_protocolcallbacks with something like:props->allowed_protos = IR_TYPE_RC6 | IR_TYPE_<imon protocol>; props->change_protocol = imon_ir_change_protocol;
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
You can see an example of such implementation at
drivers/media/video/em28xx-em28xx-input.c. Look forem28xx_ir_change_protocol()function.Working on it now... I'm about 95% of the way there, just need to sort out one last little bit...
Good!
Patch coming momentarily. Nice to submit one that actually removes more lines than it adds... :)
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
That's said, I'm not sure what would be better way to map IR_TYPE_<imon protocol>. Maybe we can just use
IR_TYPE_OTHER.So, basically, we'll have:
IR_TYPE_OTHER|IR_TYPE_RC6- auto-detected between RC-6 and iMON
IR_TYPE_OTHER- iMON proprietary protocol
IR_TYPE_RC6- RC-6 protocolBy doing this, the userspace application ir-keycode will already be able to handle the IR protocol.
Quoted 7 lines
Quoted 4 lines
I'm going to go with
IR_TYPE_OTHERfor the iMON native proto for now. To be honest, I don't have a clue what the actual IR protocol looks like... I should try one of my iMON remotes w/an mce transceiver to see if I can figure it out...It would be a good idea to get the real protocol, instead of using OTHER. Maybe one of the already-existing decoders may be able to catch it, if you use a raw decoder device.
On the TODO list, probably after porting the mceusb driver to ir-core, which I can then use for this very purpose.
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I'm not sure how to map the "PAD stablilize" case, but it seems that the better would be to add a sysfs node for it, at sys/class/rc/rc0. There are other cases where some protocols may require some adjustments, so I'm thinking on having some protocol-specific properties there.
Quoted 8 lines
Quoted 6 lines
For the moment, I'm dropping the
ir_protocolmodparam and adding apad_stabilizeone. It was a hack to have it as a protocol, all it really needs to do is bypass a function when processing the pad signals. Can convert it to something more standard once we have a standard for protocol-specific properties. (Thepad_threshmodparam is probably a similar case).Yes. Suggestions/patches for those protocol-specific parameters are welcome ;)
Going to keep it in mind while starting to port more lirc drivers, thinking maybe ideas will emerge after looking at the needs of multiple drivers.
Signature · 2 lines
Jarod Wilson [email protected]