summaryrefslogtreecommitdiff
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-09-16 14:35:58 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-10-05 13:55:08 +0300
commit0ac5a603a732dda81de8e9b4ae67e79ba07bda55 (patch)
tree824114acfac7277e63075489e0dff46cc3834382 /drivers/media/rc
parentfec225a04330d0f222d24feb5bea045526031675 (diff)
downloadlinux-0ac5a603a732dda81de8e9b4ae67e79ba07bda55.tar.xz
media: rc: imon: report mouse events using rc-core's input device
There is no need to create another input device. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/ir-imon-decoder.c62
-rw-r--r--drivers/media/rc/rc-core-priv.h2
-rw-r--r--drivers/media/rc/rc-main.c6
3 files changed, 10 insertions, 60 deletions
diff --git a/drivers/media/rc/ir-imon-decoder.c b/drivers/media/rc/ir-imon-decoder.c
index 67c1b0c15aae..a0efe2605393 100644
--- a/drivers/media/rc/ir-imon-decoder.c
+++ b/drivers/media/rc/ir-imon-decoder.c
@@ -70,24 +70,13 @@ static void ir_imon_decode_scancode(struct rc_dev *dev)
}
if (!imon->stick_keyboard) {
- struct lirc_scancode lsc = {
- .scancode = imon->bits,
- .rc_proto = RC_PROTO_IMON,
- };
+ input_report_rel(dev->input_dev, REL_X, rel_x);
+ input_report_rel(dev->input_dev, REL_Y, rel_y);
- ir_lirc_scancode_event(dev, &lsc);
-
- input_event(imon->idev, EV_MSC, MSC_SCAN, imon->bits);
-
- input_report_rel(imon->idev, REL_X, rel_x);
- input_report_rel(imon->idev, REL_Y, rel_y);
-
- input_report_key(imon->idev, BTN_LEFT,
+ input_report_key(dev->input_dev, BTN_LEFT,
(imon->bits & 0x00010000) != 0);
- input_report_key(imon->idev, BTN_RIGHT,
+ input_report_key(dev->input_dev, BTN_RIGHT,
(imon->bits & 0x00040000) != 0);
- input_sync(imon->idev);
- return;
}
}
@@ -243,62 +232,19 @@ static int ir_imon_encode(enum rc_proto protocol, u32 scancode,
static int ir_imon_register(struct rc_dev *dev)
{
- struct input_dev *idev;
struct imon_dec *imon = &dev->raw->imon;
- int ret;
-
- idev = input_allocate_device();
- if (!idev)
- return -ENOMEM;
-
- snprintf(imon->name, sizeof(imon->name),
- "iMON PAD Stick (%s)", dev->device_name);
- idev->name = imon->name;
- idev->phys = dev->input_phys;
-
- /* Mouse bits */
- set_bit(EV_REL, idev->evbit);
- set_bit(EV_KEY, idev->evbit);
- set_bit(REL_X, idev->relbit);
- set_bit(REL_Y, idev->relbit);
- set_bit(BTN_LEFT, idev->keybit);
- set_bit(BTN_RIGHT, idev->keybit);
-
- /* Report scancodes too */
- set_bit(EV_MSC, idev->evbit);
- set_bit(MSC_SCAN, idev->mscbit);
-
- input_set_drvdata(idev, imon);
-
- ret = input_register_device(idev);
- if (ret < 0) {
- input_free_device(idev);
- return -EIO;
- }
- imon->idev = idev;
imon->stick_keyboard = false;
return 0;
}
-static int ir_imon_unregister(struct rc_dev *dev)
-{
- struct imon_dec *imon = &dev->raw->imon;
-
- input_unregister_device(imon->idev);
- imon->idev = NULL;
-
- return 0;
-}
-
static struct ir_raw_handler imon_handler = {
.protocols = RC_PROTO_BIT_IMON,
.decode = ir_imon_decode,
.encode = ir_imon_encode,
.carrier = 38000,
.raw_register = ir_imon_register,
- .raw_unregister = ir_imon_unregister,
.min_timeout = IMON_UNIT * IMON_BITS * 2,
};
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index 22b0ec853acc..41a99a1dc3bb 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -133,8 +133,6 @@ struct ir_raw_event_ctrl {
int last_chk;
unsigned int bits;
bool stick_keyboard;
- struct input_dev *idev;
- char name[64];
} imon;
};
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 7e5a9bc9b81d..552bbe82a160 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1743,12 +1743,18 @@ static int rc_prepare_rx_device(struct rc_dev *dev)
dev->enabled_protocols = rc_proto;
}
+ /* Keyboard events */
set_bit(EV_KEY, dev->input_dev->evbit);
set_bit(EV_REP, dev->input_dev->evbit);
set_bit(EV_MSC, dev->input_dev->evbit);
set_bit(MSC_SCAN, dev->input_dev->mscbit);
bitmap_fill(dev->input_dev->keybit, KEY_CNT);
+ /* Pointer/mouse events */
+ set_bit(EV_REL, dev->input_dev->evbit);
+ set_bit(REL_X, dev->input_dev->relbit);
+ set_bit(REL_Y, dev->input_dev->relbit);
+
if (dev->open)
dev->input_dev->open = ir_open;
if (dev->close)