2009-12-13 19:00:08 +00:00
|
|
|
/* ir-register.c - handle IR scancode->keycode tables
|
|
|
|
*
|
2010-03-24 23:47:53 +00:00
|
|
|
* Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
|
2009-12-13 19:00:08 +00:00
|
|
|
*
|
|
|
|
* 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 version 2 of the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2009-12-13 19:00:08 +00:00
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <media/ir-core.h>
|
|
|
|
|
|
|
|
#define IRRCV_NUM_DEVICES 256
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/* bit array to represent IR sysfs device number */
|
|
|
|
static unsigned long ir_core_dev_number;
|
2009-12-13 19:00:08 +00:00
|
|
|
|
V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-03-27 01:45:16 +00:00
|
|
|
/* class for /sys/class/rc */
|
2010-03-11 15:41:56 +00:00
|
|
|
static char *ir_devnode(struct device *dev, mode_t *mode)
|
|
|
|
{
|
V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-03-27 01:45:16 +00:00
|
|
|
return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
|
2010-03-11 15:41:56 +00:00
|
|
|
}
|
|
|
|
|
2010-03-24 23:47:53 +00:00
|
|
|
static struct class ir_input_class = {
|
V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-03-27 01:45:16 +00:00
|
|
|
.name = "rc",
|
2010-03-11 15:41:56 +00:00
|
|
|
.devnode = ir_devnode,
|
|
|
|
};
|
2009-12-13 19:00:08 +00:00
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/**
|
|
|
|
* show_protocol() - shows the current IR protocol
|
|
|
|
* @d: the device descriptor
|
|
|
|
* @mattr: the device attribute struct (unused)
|
|
|
|
* @buf: a pointer to the output buffer
|
|
|
|
*
|
|
|
|
* This routine is a callback routine for input read the IR protocol type.
|
2010-03-28 21:38:49 +00:00
|
|
|
* it is trigged by reading /sys/class/rc/rc?/current_protocol.
|
2009-12-14 05:55:03 +00:00
|
|
|
* It returns the protocol name, as understood by the driver.
|
|
|
|
*/
|
2009-12-14 05:16:36 +00:00
|
|
|
static ssize_t show_protocol(struct device *d,
|
|
|
|
struct device_attribute *mattr, char *buf)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
struct ir_input_dev *ir_dev = dev_get_drvdata(d);
|
2009-12-14 16:53:37 +00:00
|
|
|
u64 ir_type = ir_dev->rc_tab.ir_type;
|
2009-12-14 05:16:36 +00:00
|
|
|
|
2009-12-14 16:53:37 +00:00
|
|
|
IR_dprintk(1, "Current protocol is %lld\n", (long long)ir_type);
|
2009-12-14 05:16:36 +00:00
|
|
|
|
|
|
|
/* FIXME: doesn't support multiple protocols at the same time */
|
|
|
|
if (ir_type == IR_TYPE_UNKNOWN)
|
|
|
|
s = "Unknown";
|
|
|
|
else if (ir_type == IR_TYPE_RC5)
|
2010-04-08 04:02:49 +00:00
|
|
|
s = "rc-5";
|
2009-12-14 05:16:36 +00:00
|
|
|
else if (ir_type == IR_TYPE_PD)
|
2010-04-08 04:02:49 +00:00
|
|
|
s = "pulse-distance";
|
2009-12-14 05:16:36 +00:00
|
|
|
else if (ir_type == IR_TYPE_NEC)
|
2010-04-08 04:02:49 +00:00
|
|
|
s = "nec";
|
2009-12-14 05:16:36 +00:00
|
|
|
else
|
2010-04-08 04:02:49 +00:00
|
|
|
s = "other";
|
2009-12-14 05:16:36 +00:00
|
|
|
|
|
|
|
return sprintf(buf, "%s\n", s);
|
|
|
|
}
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/**
|
|
|
|
* store_protocol() - shows the current IR protocol
|
|
|
|
* @d: the device descriptor
|
|
|
|
* @mattr: the device attribute struct (unused)
|
|
|
|
* @buf: a pointer to the input buffer
|
|
|
|
* @len: length of the input buffer
|
|
|
|
*
|
|
|
|
* This routine is a callback routine for changing the IR protocol type.
|
2010-03-28 21:38:49 +00:00
|
|
|
* it is trigged by reading /sys/class/rc/rc?/current_protocol.
|
2009-12-14 05:55:03 +00:00
|
|
|
* It changes the IR the protocol name, if the IR type is recognized
|
|
|
|
* by the driver.
|
|
|
|
* If an unknown protocol name is used, returns -EINVAL.
|
|
|
|
*/
|
2009-12-14 05:46:42 +00:00
|
|
|
static ssize_t store_protocol(struct device *d,
|
|
|
|
struct device_attribute *mattr,
|
|
|
|
const char *data,
|
|
|
|
size_t len)
|
|
|
|
{
|
|
|
|
struct ir_input_dev *ir_dev = dev_get_drvdata(d);
|
2010-04-08 04:02:49 +00:00
|
|
|
u64 ir_type = 0;
|
2009-12-14 05:46:42 +00:00
|
|
|
int rc = -EINVAL;
|
2009-12-14 05:56:15 +00:00
|
|
|
unsigned long flags;
|
2009-12-14 05:46:42 +00:00
|
|
|
char *buf;
|
|
|
|
|
2010-04-08 04:02:49 +00:00
|
|
|
while (buf = strsep((char **) &data, " \n")) {
|
|
|
|
if (!strcasecmp(buf, "rc-5") || !strcasecmp(buf, "rc5"))
|
|
|
|
ir_type |= IR_TYPE_RC5;
|
|
|
|
if (!strcasecmp(buf, "pd") || !strcasecmp(buf, "pulse-distance"))
|
|
|
|
ir_type |= IR_TYPE_PD;
|
|
|
|
if (!strcasecmp(buf, "nec"))
|
|
|
|
ir_type |= IR_TYPE_NEC;
|
|
|
|
}
|
2009-12-14 05:46:42 +00:00
|
|
|
|
2010-04-08 04:02:49 +00:00
|
|
|
if (!ir_type) {
|
|
|
|
IR_dprintk(1, "Unknown protocol\n");
|
2009-12-14 05:46:42 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2009-12-17 02:46:48 +00:00
|
|
|
if (ir_dev->props && ir_dev->props->change_protocol)
|
2009-12-14 05:46:42 +00:00
|
|
|
rc = ir_dev->props->change_protocol(ir_dev->props->priv,
|
|
|
|
ir_type);
|
|
|
|
|
|
|
|
if (rc < 0) {
|
2009-12-14 16:53:37 +00:00
|
|
|
IR_dprintk(1, "Error setting protocol to %lld\n",
|
|
|
|
(long long)ir_type);
|
2009-12-14 05:46:42 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2009-12-14 05:56:15 +00:00
|
|
|
spin_lock_irqsave(&ir_dev->rc_tab.lock, flags);
|
2009-12-14 05:46:42 +00:00
|
|
|
ir_dev->rc_tab.ir_type = ir_type;
|
2009-12-14 05:56:15 +00:00
|
|
|
spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags);
|
2009-12-14 05:46:42 +00:00
|
|
|
|
2010-04-08 04:02:49 +00:00
|
|
|
IR_dprintk(1, "Current protocol(s) is(are) %lld\n",
|
2009-12-14 16:53:37 +00:00
|
|
|
(long long)ir_type);
|
2009-12-14 05:46:42 +00:00
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2010-04-08 04:02:49 +00:00
|
|
|
static ssize_t show_supported_protocols(struct device *d,
|
|
|
|
struct device_attribute *mattr, char *buf)
|
|
|
|
{
|
|
|
|
char *orgbuf = buf;
|
|
|
|
struct ir_input_dev *ir_dev = dev_get_drvdata(d);
|
|
|
|
|
|
|
|
/* FIXME: doesn't support multiple protocols at the same time */
|
|
|
|
if (ir_dev->props->allowed_protos == IR_TYPE_UNKNOWN)
|
|
|
|
buf += sprintf(buf, "unknown ");
|
|
|
|
if (ir_dev->props->allowed_protos & IR_TYPE_RC5)
|
|
|
|
buf += sprintf(buf, "rc-5 ");
|
|
|
|
if (ir_dev->props->allowed_protos & IR_TYPE_PD)
|
|
|
|
buf += sprintf(buf, "pulse-distance ");
|
|
|
|
if (ir_dev->props->allowed_protos & IR_TYPE_NEC)
|
|
|
|
buf += sprintf(buf, "nec ");
|
|
|
|
if (buf == orgbuf)
|
|
|
|
buf += sprintf(buf, "other ");
|
|
|
|
|
|
|
|
buf += sprintf(buf - 1, "\n");
|
|
|
|
|
|
|
|
return buf - orgbuf;
|
|
|
|
}
|
2010-03-12 14:50:17 +00:00
|
|
|
|
|
|
|
#define ADD_HOTPLUG_VAR(fmt, val...) \
|
|
|
|
do { \
|
|
|
|
int err = add_uevent_var(env, fmt, val); \
|
|
|
|
if (err) \
|
|
|
|
return err; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env)
|
|
|
|
{
|
|
|
|
struct ir_input_dev *ir_dev = dev_get_drvdata(device);
|
|
|
|
|
|
|
|
if (ir_dev->rc_tab.name)
|
|
|
|
ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name);
|
2010-03-13 00:18:14 +00:00
|
|
|
if (ir_dev->driver_name)
|
|
|
|
ADD_HOTPLUG_VAR("DRV_NAME=\"%s\"", ir_dev->driver_name);
|
2010-03-12 14:50:17 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/*
|
|
|
|
* Static device attribute struct with the sysfs attributes for IR's
|
|
|
|
*/
|
2010-04-08 04:02:49 +00:00
|
|
|
static DEVICE_ATTR(protocol, S_IRUGO | S_IWUSR,
|
2009-12-14 05:46:42 +00:00
|
|
|
show_protocol, store_protocol);
|
2009-12-13 19:00:08 +00:00
|
|
|
|
2010-04-08 04:02:49 +00:00
|
|
|
static DEVICE_ATTR(supported_protocols, S_IRUGO | S_IWUSR,
|
|
|
|
show_supported_protocols, NULL);
|
|
|
|
|
2010-04-07 02:21:46 +00:00
|
|
|
static struct attribute *ir_hw_dev_attrs[] = {
|
2010-04-08 04:02:49 +00:00
|
|
|
&dev_attr_protocol.attr,
|
|
|
|
&dev_attr_supported_protocols.attr,
|
2009-12-29 18:48:04 +00:00
|
|
|
NULL,
|
2009-12-13 19:00:08 +00:00
|
|
|
};
|
|
|
|
|
2010-04-07 02:21:46 +00:00
|
|
|
static struct attribute_group ir_hw_dev_attr_grp = {
|
|
|
|
.attrs = ir_hw_dev_attrs,
|
2010-03-11 15:41:56 +00:00
|
|
|
};
|
|
|
|
|
2010-04-07 02:21:46 +00:00
|
|
|
static const struct attribute_group *ir_hw_dev_attr_groups[] = {
|
|
|
|
&ir_hw_dev_attr_grp,
|
2010-03-11 15:41:56 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2010-04-07 02:21:46 +00:00
|
|
|
static struct device_type rc_dev_type = {
|
|
|
|
.groups = ir_hw_dev_attr_groups,
|
|
|
|
.uevent = ir_dev_uevent,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct device_type ir_raw_dev_type = {
|
2010-03-12 14:50:17 +00:00
|
|
|
.uevent = ir_dev_uevent,
|
2010-03-11 15:41:56 +00:00
|
|
|
};
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/**
|
2010-03-28 21:38:49 +00:00
|
|
|
* ir_register_class() - creates the sysfs for /sys/class/rc/rc?
|
2009-12-14 05:55:03 +00:00
|
|
|
* @input_dev: the struct input_dev descriptor of the device
|
|
|
|
*
|
|
|
|
* This routine is used to register the syfs code for IR class
|
|
|
|
*/
|
2009-12-13 19:00:08 +00:00
|
|
|
int ir_register_class(struct input_dev *input_dev)
|
|
|
|
{
|
|
|
|
int rc;
|
2010-03-11 15:41:56 +00:00
|
|
|
const char *path;
|
2009-12-13 19:00:08 +00:00
|
|
|
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
|
|
|
int devno = find_first_zero_bit(&ir_core_dev_number,
|
|
|
|
IRRCV_NUM_DEVICES);
|
|
|
|
|
|
|
|
if (unlikely(devno < 0))
|
|
|
|
return devno;
|
|
|
|
|
2010-04-07 02:21:46 +00:00
|
|
|
if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE)
|
|
|
|
ir_dev->dev.type = &rc_dev_type;
|
|
|
|
else
|
|
|
|
ir_dev->dev.type = &ir_raw_dev_type;
|
|
|
|
|
2010-03-11 15:41:56 +00:00
|
|
|
ir_dev->dev.class = &ir_input_class;
|
|
|
|
ir_dev->dev.parent = input_dev->dev.parent;
|
2010-03-28 21:38:49 +00:00
|
|
|
dev_set_name(&ir_dev->dev, "rc%d", devno);
|
2010-03-12 14:50:17 +00:00
|
|
|
dev_set_drvdata(&ir_dev->dev, ir_dev);
|
2010-03-11 15:41:56 +00:00
|
|
|
rc = device_register(&ir_dev->dev);
|
|
|
|
if (rc)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
|
|
|
|
input_dev->dev.parent = &ir_dev->dev;
|
|
|
|
rc = input_register_device(input_dev);
|
|
|
|
if (rc < 0) {
|
|
|
|
device_del(&ir_dev->dev);
|
|
|
|
return rc;
|
2009-12-13 19:00:08 +00:00
|
|
|
}
|
|
|
|
|
2010-03-11 15:41:56 +00:00
|
|
|
__module_get(THIS_MODULE);
|
|
|
|
|
2010-03-12 14:50:17 +00:00
|
|
|
path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL);
|
|
|
|
printk(KERN_INFO "%s: %s as %s\n",
|
2010-03-11 15:41:56 +00:00
|
|
|
dev_name(&ir_dev->dev),
|
|
|
|
input_dev->name ? input_dev->name : "Unspecified device",
|
|
|
|
path ? path : "N/A");
|
|
|
|
kfree(path);
|
|
|
|
|
2009-12-13 19:00:08 +00:00
|
|
|
ir_dev->devno = devno;
|
|
|
|
set_bit(devno, &ir_core_dev_number);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/**
|
|
|
|
* ir_unregister_class() - removes the sysfs for sysfs for
|
2010-03-28 21:38:49 +00:00
|
|
|
* /sys/class/rc/rc?
|
2009-12-14 05:55:03 +00:00
|
|
|
* @input_dev: the struct input_dev descriptor of the device
|
|
|
|
*
|
|
|
|
* This routine is used to unregister the syfs code for IR class
|
|
|
|
*/
|
2009-12-13 19:00:08 +00:00
|
|
|
void ir_unregister_class(struct input_dev *input_dev)
|
|
|
|
{
|
|
|
|
struct ir_input_dev *ir_dev = input_get_drvdata(input_dev);
|
|
|
|
|
|
|
|
clear_bit(ir_dev->devno, &ir_core_dev_number);
|
2010-03-11 15:41:56 +00:00
|
|
|
input_unregister_device(input_dev);
|
|
|
|
device_del(&ir_dev->dev);
|
2009-12-13 19:00:08 +00:00
|
|
|
|
2010-03-11 15:41:56 +00:00
|
|
|
module_put(THIS_MODULE);
|
2009-12-13 19:00:08 +00:00
|
|
|
}
|
|
|
|
|
2009-12-14 05:55:03 +00:00
|
|
|
/*
|
V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-03-27 01:45:16 +00:00
|
|
|
* Init/exit code for the module. Basically, creates/removes /sys/class/rc
|
2009-12-14 05:55:03 +00:00
|
|
|
*/
|
|
|
|
|
2009-12-13 19:00:08 +00:00
|
|
|
static int __init ir_core_init(void)
|
|
|
|
{
|
2010-03-11 15:41:56 +00:00
|
|
|
int rc = class_register(&ir_input_class);
|
|
|
|
if (rc) {
|
V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc
IR is an alias for Infrared Remote, while RC is an alias for Remote
Controller.
While currently all implementations are with Infrared Remote Controller,
this subsystem is not meant to be used only by IR type of RC's. So,
as discussed on both linux-media and linux-input, the better is to
rename the subsystem as Remote Controller.
While, currently, the only application that uses the /sys/class/irrcv is
ir-keytable application, and its sysfs support works only with the
current linux-next code, it is still possible to change the userspace API
without the risk of breaking applications. So, better to rename this
sooner than later.
Later patches will be needed to rename the files and to move them away
from drivers/media, but this is not a critical issue. So, for now,
let's just change the name of the sysfs class/nodes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-03-27 01:45:16 +00:00
|
|
|
printk(KERN_ERR "ir_core: unable to register rc class\n");
|
2010-03-11 15:41:56 +00:00
|
|
|
return rc;
|
2009-12-13 19:00:08 +00:00
|
|
|
}
|
|
|
|
|
2010-04-02 23:01:00 +00:00
|
|
|
/* Initialize/load the decoders/keymap code that will be used */
|
2010-03-24 23:47:53 +00:00
|
|
|
ir_raw_init();
|
2010-04-02 23:01:00 +00:00
|
|
|
rc_map_init();
|
|
|
|
|
2010-03-24 23:47:53 +00:00
|
|
|
|
2009-12-13 19:00:08 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit ir_core_exit(void)
|
|
|
|
{
|
2010-03-11 15:41:56 +00:00
|
|
|
class_unregister(&ir_input_class);
|
2009-12-13 19:00:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(ir_core_init);
|
|
|
|
module_exit(ir_core_exit);
|