[PATCH 3/4] media/rc/imon.c: do not try to register 2nd intf if 1st intf failed
] ? dequeue_task_fair+0x9f/0xc0 Apr 8 18:20:30 homeserver kernel: [c0131312] ? release_task+0x1d2/0x330 Apr 8 18:20:30 homeserver kernel: [c01477b0] ? abort_exclusive_wait+0x90/0x90 Apr 8 18:20:30 homeserver kernel: [c040f080] ? usb_remote_wakeup+0x40/0x40 Apr 8 18:20:30 homeserver kernel: [c0146ed2] ? kthread+0x92/0xa0 Apr 8 18:20:30 homeserver kernel: [c05c7877] ? ret_from_kernel_thread+0x1b/0x28 Apr 8 18:20:30 homeserver kernel: [c0146e40] ? kthread_freezable_should_stop+0x50/0x50 Apr 8 18:20:30 homeserver kernel: Code: 89 04 24 89 f0 e8 05 ff ff ff 8b 5c 24 24 8b 74 24 28 8b 7c 24 2c 8b 6c 24 30 83 c4 34 c3 00 83 ec 08 89 1c 24 89 74 24 04 89 c3 f0 ff 08 79 05 e8 ca 03 00 00 64 a1 70 d6 80 c0 8b 74 24 04 89 Apr 8 18:20:30 homeserver kernel: EIP: [c05c4e4c] mutex_lock+0xc/0x30 SS:ESP 0068:f6577c28 Apr 8 18:20:30 homeserver kernel: CR2: 0014 Apr 8 18:20:30 homeserver kernel: ---[ end trace df134132c967205c ]--- Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 624fd33..3af7bb6 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -2324,7 +2324,14 @@ static int imon_probe(struct usb_interface *interface, } } else { - /* this is the secondary interface on the device */ + /* this is the secondary interface on the device */ + + /* fail early if first intf failed to register */ + if (!first_if_ctx) { + ret = -ENODEV; + goto fail; + } + ictx = imon_init_intf1(interface, first_if_ctx); if (!ictx) { pr_err(failed to attach to context!\n); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] media/rc/imon.c: make send_packet() delay larger for 15c2:0036 [v2]
Imon device 15c2:0036 need a higher delay between send_packet() calls. Also use interruptible wait to avoid load average going too high (and let caller handle signals). Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index e5d1c0d..624fd33 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -112,6 +112,7 @@ struct imon_context { bool tx_control; unsigned char usb_rx_buf[8]; unsigned char usb_tx_buf[8]; + unsigned int send_packet_delay; struct tx_t { unsigned char data_buf[35]; /* user data buffer */ @@ -185,6 +186,10 @@ enum { IMON_KEY_PANEL = 2, }; +enum { + IMON_NEED_20MS_PKT_DELAY = 1 +}; + /* * USB Device ID for iMON USB Control Boards * @@ -215,7 +220,7 @@ static struct usb_device_id imon_usb_id_table[] = { /* SoundGraph iMON OEM Touch LCD (IR 4.3 VGA LCD) */ { USB_DEVICE(0x15c2, 0x0035) }, /* SoundGraph iMON OEM VFD (IR VFD) */ - { USB_DEVICE(0x15c2, 0x0036) }, + { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY }, /* device specifics unknown */ { USB_DEVICE(0x15c2, 0x0037) }, /* SoundGraph iMON OEM LCD (IR LCD) */ @@ -535,12 +540,12 @@ static int send_packet(struct imon_context *ictx) kfree(control_req); /* -* Induce a mandatory 5ms delay before returning, as otherwise, +* Induce a mandatory delay before returning, as otherwise, * send_packet can get called so rapidly as to overwhelm the device, * particularly on faster systems and/or those with quirky usb. */ - timeout = msecs_to_jiffies(5); - set_current_state(TASK_UNINTERRUPTIBLE); + timeout = msecs_to_jiffies(ictx-send_packet_delay); + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(timeout); return retval; @@ -2088,7 +2093,8 @@ static bool imon_find_endpoints(struct imon_context *ictx, } -static struct imon_context *imon_init_intf0(struct usb_interface *intf) +static struct imon_context *imon_init_intf0(struct usb_interface *intf, + const struct usb_device_id *id) { struct imon_context *ictx; struct urb *rx_urb; @@ -2128,6 +2134,10 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) ictx-vendor = le16_to_cpu(ictx-usbdev_intf0-descriptor.idVendor); ictx-product = le16_to_cpu(ictx-usbdev_intf0-descriptor.idProduct); + /* default send_packet delay is 5ms but some devices need more */ + ictx-send_packet_delay = id-driver_info IMON_NEED_20MS_PKT_DELAY ? + 20 : 5; + ret = -ENODEV; iface_desc = intf-cur_altsetting; if (!imon_find_endpoints(ictx, iface_desc)) { @@ -2306,7 +2316,7 @@ static int imon_probe(struct usb_interface *interface, first_if_ctx = usb_get_intfdata(first_if); if (ifnum == 0) { - ictx = imon_init_intf0(interface); + ictx = imon_init_intf0(interface, id); if (!ictx) { pr_err(failed to initialize context!\n); ret = -ENODEV; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] media/rc/imon.c: kill urb when send_packet() is interrupted
This avoids: Apr 12 23:52:16 homeserver kernel: imon:send_packet: task interrupted Apr 12 23:52:16 homeserver kernel: [ cut here ] Apr 12 23:52:16 homeserver kernel: WARNING: at drivers/usb/core/urb.c:327 usb_submit_urb+0x353/0x370() Apr 12 23:52:16 homeserver kernel: Hardware name: Unknow Apr 12 23:52:16 homeserver kernel: URB f64b6f00 submitted while active Apr 12 23:52:16 homeserver kernel: Modules linked in: Apr 12 23:52:16 homeserver kernel: Pid: 3154, comm: LCDd Not tainted 3.8.6-htpc-5-g9e6fc5e #26 Apr 12 23:52:16 homeserver kernel: Call Trace: Apr 12 23:52:16 homeserver kernel: [c012d778] ? warn_slowpath_common+0x78/0xb0 Apr 12 23:52:16 homeserver kernel: [c04136c3] ? usb_submit_urb+0x353/0x370 Apr 12 23:52:16 homeserver kernel: [c04136c3] ? usb_submit_urb+0x353/0x370 Apr 12 23:52:16 homeserver kernel: [c0447010] ? imon_ir_change_protocol+0x150/0x150 Apr 12 23:52:16 homeserver kernel: [c012d843] ? warn_slowpath_fmt+0x33/0x40 Apr 12 23:52:16 homeserver kernel: [c04136c3] ? usb_submit_urb+0x353/0x370 Apr 12 23:52:16 homeserver kernel: [c0446c67] ? send_packet+0x97/0x270 Apr 12 23:52:16 homeserver kernel: [c0446cfe] ? send_packet+0x12e/0x270 Apr 12 23:52:16 homeserver kernel: [c05c5743] ? do_nanosleep+0xa3/0xd0 Apr 12 23:52:16 homeserver kernel: [c044760e] ? vfd_write+0xae/0x250 Apr 12 23:52:16 homeserver kernel: [c0447560] ? lcd_write+0x180/0x180 Apr 12 23:52:16 homeserver kernel: [c01b2b19] ? vfs_write+0x89/0x140 Apr 12 23:52:16 homeserver kernel: [c01b2dda] ? sys_write+0x4a/0x90 Apr 12 23:52:16 homeserver kernel: [c05c7c45] ? sysenter_do_call+0x12/0x26 Apr 12 23:52:16 homeserver kernel: ---[ end trace a0b6f0fcfd2f9a1d ]--- Apr 12 23:52:16 homeserver kernel: imon:send_packet: error submitting urb(-16) Apr 12 23:52:16 homeserver kernel: imon:vfd_write: send packet #3 failed Apr 12 23:52:16 homeserver kernel: imon:send_packet: error submitting urb(-16) Apr 12 23:52:16 homeserver kernel: imon:vfd_write: send packet #0 failed Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 3af7bb6..72e3fa6 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -528,8 +528,10 @@ static int send_packet(struct imon_context *ictx) mutex_unlock(ictx-lock); retval = wait_for_completion_interruptible( ictx-tx.finished); - if (retval) + if (retval) { + usb_kill_urb(ictx-tx_urb); pr_err_ratelimited(task interrupted\n); + } mutex_lock(ictx-lock); retval = ictx-tx.status; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] Revert media/rc/imon.c: make send_packet() delay larger for 15c2:0036
This reverts commit d92f150f9cb80b4df56331d1f42442da78e351f0. It seems send_packet() is used during initialization, before send_packet_delay is set. This will be fixed by another patch. Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index b8f9f85..e5d1c0d 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -112,7 +112,6 @@ struct imon_context { bool tx_control; unsigned char usb_rx_buf[8]; unsigned char usb_tx_buf[8]; - unsigned int send_packet_delay; struct tx_t { unsigned char data_buf[35]; /* user data buffer */ @@ -186,10 +185,6 @@ enum { IMON_KEY_PANEL = 2, }; -enum { - IMON_NEED_20MS_PKT_DELAY = 1 -}; - /* * USB Device ID for iMON USB Control Boards * @@ -220,7 +215,7 @@ static struct usb_device_id imon_usb_id_table[] = { /* SoundGraph iMON OEM Touch LCD (IR 4.3 VGA LCD) */ { USB_DEVICE(0x15c2, 0x0035) }, /* SoundGraph iMON OEM VFD (IR VFD) */ - { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY }, + { USB_DEVICE(0x15c2, 0x0036) }, /* device specifics unknown */ { USB_DEVICE(0x15c2, 0x0037) }, /* SoundGraph iMON OEM LCD (IR LCD) */ @@ -540,12 +535,12 @@ static int send_packet(struct imon_context *ictx) kfree(control_req); /* -* Induce a mandatory delay before returning, as otherwise, +* Induce a mandatory 5ms delay before returning, as otherwise, * send_packet can get called so rapidly as to overwhelm the device, * particularly on faster systems and/or those with quirky usb. */ - timeout = msecs_to_jiffies(ictx-send_packet_delay); - set_current_state(TASK_INTERRUPTIBLE); + timeout = msecs_to_jiffies(5); + set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(timeout); return retval; @@ -2329,10 +2324,6 @@ static int imon_probe(struct usb_interface *interface, } - /* default send_packet delay is 5ms but some devices need more */ - ictx-send_packet_delay = id-driver_info IMON_NEED_20MS_PKT_DELAY ? - 20 : 5; - usb_set_intfdata(interface, ictx); if (ifnum == 0) { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/4] Revert buggy patch and fix other issues with imon driver
Hi, Following patchset fixes several issues with imon driver and reverts one (previously applied) buggy patch. Mauro, could you please apply this on top of your tree? Best regards, Kevin Baradon (4): Revert media/rc/imon.c: make send_packet() delay larger for 15c2:0036 media/rc/imon.c: make send_packet() delay larger for 15c2:0036 [v2] media/rc/imon.c: do not try to register 2nd intf if 1st intf failed media/rc/imon.c: kill urb when send_packet() is interrupted drivers/media/rc/imon.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] media/rc/imon.c: make send_packet() delay configurable
Le Thu, 14 Mar 2013 12:01:53 -0300, Mauro Carvalho Chehab mche...@redhat.com a écrit : Em Sun, 24 Feb 2013 21:19:29 +0100 Kevin Baradon kevin.bara...@gmail.com escreveu: Some imon devices (like 15c2:0036) need a higher delay between send_packet calls. Default value is still 5ms to avoid regressions on already working hardware. Also use interruptible wait to avoid load average going too high (and let caller handle signals). Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 78d109b..a3e66a0 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -347,6 +347,11 @@ module_param(pad_stabilize, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(pad_stabilize, Apply stabilization algorithm to iMON PAD presses in arrow key mode. 0=disable, 1=enable (default).); +static unsigned int send_packet_delay = 5; +module_param(send_packet_delay, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(send_packet_delay, Minimum delay between send_packet() calls +(default 5ms)); + Users will find a hard time discovering what delay is needed for each device. If this is a per-device type property, then it should, instead, be associated with the device's USB ID. The better would be to encapsulate it at the USB device table, like adding a NEED_(extra)_DELAY flag, like: { USB_DEVICE(0x15c2, 0x0036), .driver_info = NEED_10MS_DELAY }, If such flag is zero (like on all devices where .driver_info is not filled, as Kernel zeroes the memory on all static vars), then it will keep using 5ms. Another alternative would be to use .driver_info for the device type, and add a logic to handle different types with different logic. This is what mceusb.c does, for example. Hi, Please find below an updated patch: From 8d4ba61cb21617b8169127b085332ed7813470c9 Mon Sep 17 00:00:00 2001 From: Kevin Baradon kevin.bara...@gmail.com Date: Mon, 18 Feb 2013 18:42:47 +0100 Subject: [PATCH 1/2] media/rc/imon.c: make send_packet() delay larger for 15c2:0036 Imon device 15c2:0036 need a higher delay between send_packet() calls. Also use interruptible wait to avoid load average going too high (and let caller handle signals). Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index dec203b..178b946 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -112,6 +112,7 @@ struct imon_context { bool tx_control; unsigned char usb_rx_buf[8]; unsigned char usb_tx_buf[8]; + unsigned int send_packet_delay; struct tx_t { unsigned char data_buf[35]; /* user data buffer */ @@ -185,6 +186,10 @@ enum { IMON_KEY_PANEL = 2, }; +enum { + IMON_NEED_20MS_PKT_DELAY = 1 +}; + /* * USB Device ID for iMON USB Control Boards * @@ -215,7 +220,7 @@ static struct usb_device_id imon_usb_id_table[] = { /* SoundGraph iMON OEM Touch LCD (IR 4.3 VGA LCD) */ { USB_DEVICE(0x15c2, 0x0035) }, /* SoundGraph iMON OEM VFD (IR VFD) */ - { USB_DEVICE(0x15c2, 0x0036) }, + { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY }, /* device specifics unknown */ { USB_DEVICE(0x15c2, 0x0037) }, /* SoundGraph iMON OEM LCD (IR LCD) */ @@ -535,12 +540,12 @@ static int send_packet(struct imon_context *ictx) kfree(control_req); /* -* Induce a mandatory 5ms delay before returning, as otherwise, +* Induce a mandatory delay before returning, as otherwise, * send_packet can get called so rapidly as to overwhelm the device, * particularly on faster systems and/or those with quirky usb. */ - timeout = msecs_to_jiffies(5); - set_current_state(TASK_UNINTERRUPTIBLE); + timeout = msecs_to_jiffies(ictx-send_packet_delay); + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(timeout); return retval; @@ -2335,6 +2340,10 @@ static int imon_probe(struct usb_interface *interface, } + /* default send_packet delay is 5ms but some devices need more */ + ictx-send_packet_delay = id-driver_info IMON_NEED_20MS_PKT_DELAY ? + 20 : 5; + usb_set_intfdata(interface, ictx); if (ifnum == 0) { -- 1.7.10.4 /* * In certain use cases, mouse mode isn't really helpful, and could actually * cause confusion, so allow disabling it when the IR device is open. @@ -535,12 +540,15 @@ static int send_packet(struct imon_context *ictx) kfree(control_req); /* -* Induce a mandatory 5ms delay before
Re: [PATCH 2/2] media/rc/imon.c: avoid flooding syslog with unknown keypress when keypad is pressed
Le Thu, 14 Mar 2013 12:18:41 -0300, Mauro Carvalho Chehab mche...@redhat.com a écrit : Em Sun, 24 Feb 2013 21:19:30 +0100 Kevin Baradon kevin.bara...@gmail.com escreveu: My 15c2:0036 device floods syslog when a keypad key is pressed: Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fef2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 This patch lowers severity of this message when key appears to be coming from keypad. Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index a3e66a0..bca03d4 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1499,7 +1499,7 @@ static void imon_incoming_packet(struct imon_context *ictx, int i; u64 scancode; int press_type = 0; - int msec; + int msec, is_pad_key = 0; struct timeval t; static struct timeval prev_time = { 0, 0 }; u8 ktype; @@ -1562,6 +1562,7 @@ static void imon_incoming_packet(struct imon_context *ictx, ((len == 8) (buf[0] 0x40) !(buf[1] 0x1 || buf[1] 2 0x1))) { len = 8; + is_pad_key = 1; imon_pad_to_keys(ictx, buf); } @@ -1625,8 +1626,16 @@ static void struct imon_context *ictx, unknown_key: spin_unlock_irqrestore(ictx-kc_lock, flags); - dev_info(dev, %s: unknown keypress, code 0x%llx\n, __func__, -(long long)scancode); + /* +* On some devices syslog is flooded with unknown keypresses when keypad +* is pressed. Lower message severity in that case. +*/ + if (!is_pad_key) + dev_info(dev, %s: unknown keypress, code 0x%llx\n, __func__, +(long long)scancode); + else + dev_dbg(dev, %s: unknown keypad keypress, code 0x%llx\n, + __func__, (long long)scancode); Hmmm... this entire logic looks weird to me. IMO, the proper fix is to remove this code snippet from imon_incoming_packet(): spin_lock_irqsave(ictx-kc_lock, flags); if (ictx-kc == KEY_UNKNOWN) goto unknown_key; spin_unlock_irqrestore(ictx-kc_lock, flags); and similar logic from other parts of the code, and just let rc_keydown() to be handled for KEY_UNKNOWN. rc_keydown() actually produces two input events: input_event(dev-input_dev, EV_MSC, MSC_SCAN, scancode); input_event(dev, EV_KEY, code, !!value); (the last one, indirectly, by calling input_report_key) In this particular case, the fist event will allow userspace programs like rc-keycode -t to detect that an unknown scancode was produced, helping the user to properly fill the scancode table for a particular device. In the case of your remote, you'll likely will want to add support for those currently unknown scancodes. Those unkonwn keypad keypress type of messages are now obsolete, as users can get it anytime in userspace, using the appropriate tool (ir-keytable, with is part of v4l-utils). Hi Here is an updated version: From a9b4ea2a0211fc319887590efb9e772d1d16f817 Mon Sep 17 00:00:00 2001 From: Kevin Baradon kevin.bara...@gmail.com Date: Mon, 18 Feb 2013 19:10:22 +0100 Subject: [PATCH 2/2] media/rc/imon.c: avoid flooding syslog with unknown keypress when keypad is pressed My 15c2:0036 device floods syslog when a keypad key is pressed: Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fef2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 This patch removes those messages from imon, following suggestion from Mauro. Unknown keys shall be correctly handled by rc/input layer. Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 178b946..b8f9f85 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1573,11 +1573,6 @@ static void imon_incoming_packet(struct imon_context *ictx
[PATCH 0/2] Improve imon LCD/VFD driver to better support 15c2:0036
Hi, Please find those two short patches to improve support of (at least) 15c2:0036 imon device. These apply on latest git and were tested on 3.7.8 and 3.7.9 kernels. Thanks. Kevin Baradon (2): media/rc/imon.c: make send_packet() delay configurable media/rc/imon.c: avoid flooding syslog with unknown keypress when keypad is pressed drivers/media/rc/imon.c | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] media/rc/imon.c: make send_packet() delay configurable
Some imon devices (like 15c2:0036) need a higher delay between send_packet calls. Default value is still 5ms to avoid regressions on already working hardware. Also use interruptible wait to avoid load average going too high (and let caller handle signals). Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 78d109b..a3e66a0 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -347,6 +347,11 @@ module_param(pad_stabilize, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(pad_stabilize, Apply stabilization algorithm to iMON PAD presses in arrow key mode. 0=disable, 1=enable (default).); +static unsigned int send_packet_delay = 5; +module_param(send_packet_delay, uint, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(send_packet_delay, Minimum delay between send_packet() calls +(default 5ms)); + /* * In certain use cases, mouse mode isn't really helpful, and could actually * cause confusion, so allow disabling it when the IR device is open. @@ -535,12 +540,15 @@ static int send_packet(struct imon_context *ictx) kfree(control_req); /* -* Induce a mandatory 5ms delay before returning, as otherwise, +* Induce a mandatory delay before returning, as otherwise, * send_packet can get called so rapidly as to overwhelm the device, * particularly on faster systems and/or those with quirky usb. +* Do not use TASK_UNINTERRUPTIBLE as this routine is called quite often +* and doing so will increase load average slightly. Caller will handle +* signals itself. */ - timeout = msecs_to_jiffies(5); - set_current_state(TASK_UNINTERRUPTIBLE); + timeout = msecs_to_jiffies(send_packet_delay); + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(timeout); return retval; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] media/rc/imon.c: avoid flooding syslog with unknown keypress when keypad is pressed
My 15c2:0036 device floods syslog when a keypad key is pressed: Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fef2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 Feb 18 19:00:57 homeserver kernel: imon 5-1:1.0: imon_incoming_packet: unknown keypress, code 0x100fff2 This patch lowers severity of this message when key appears to be coming from keypad. Signed-off-by: Kevin Baradon kevin.bara...@gmail.com --- drivers/media/rc/imon.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index a3e66a0..bca03d4 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -1499,7 +1499,7 @@ static void imon_incoming_packet(struct imon_context *ictx, int i; u64 scancode; int press_type = 0; - int msec; + int msec, is_pad_key = 0; struct timeval t; static struct timeval prev_time = { 0, 0 }; u8 ktype; @@ -1562,6 +1562,7 @@ static void imon_incoming_packet(struct imon_context *ictx, ((len == 8) (buf[0] 0x40) !(buf[1] 0x1 || buf[1] 2 0x1))) { len = 8; + is_pad_key = 1; imon_pad_to_keys(ictx, buf); } @@ -1625,8 +1626,16 @@ static void imon_incoming_packet(struct imon_context *ictx, unknown_key: spin_unlock_irqrestore(ictx-kc_lock, flags); - dev_info(dev, %s: unknown keypress, code 0x%llx\n, __func__, -(long long)scancode); + /* +* On some devices syslog is flooded with unknown keypresses when keypad +* is pressed. Lower message severity in that case. +*/ + if (!is_pad_key) + dev_info(dev, %s: unknown keypress, code 0x%llx\n, __func__, +(long long)scancode); + else + dev_dbg(dev, %s: unknown keypad keypress, code 0x%llx\n, + __func__, (long long)scancode); return; not_input_data: -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html