From patchwork Tue Sep 18 14:29:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 10604459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD5DF15A6 for ; Tue, 18 Sep 2018 14:29:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D3A22AE5D for ; Tue, 18 Sep 2018 14:29:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 916332AE62; Tue, 18 Sep 2018 14:29:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F10BA2AE5D for ; Tue, 18 Sep 2018 14:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729877AbeIRUCW (ORCPT ); Tue, 18 Sep 2018 16:02:22 -0400 Received: from gofer.mess.org ([88.97.38.141]:36033 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727756AbeIRUCW (ORCPT ); Tue, 18 Sep 2018 16:02:22 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id BAB9A60AC0; Tue, 18 Sep 2018 15:29:30 +0100 (BST) From: Sean Young To: linux-media@vger.kernel.org Subject: [PATCH 1/4] media: rc: some events are dropped by userspace Date: Tue, 18 Sep 2018 15:29:27 +0100 Message-Id: <20180918142930.6686-1-sean@mess.org> X-Mailer: git-send-email 2.11.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP libevdev (which is used by libinput) gets a list of keycodes from the input device on creation. Any events with keycodes which are not in this list are silently dropped. So, set all keycodes on device creation since we do not know which will be used if the keymap changes. Signed-off-by: Sean Young --- drivers/media/rc/rc-main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index ca68e1d2b2f9..97086fbbed41 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -289,20 +289,9 @@ static unsigned int ir_update_mapping(struct rc_dev *dev, old_keycode == KEY_RESERVED ? "New" : "Replacing", rc_map->scan[index].scancode, new_keycode); rc_map->scan[index].keycode = new_keycode; - __set_bit(new_keycode, dev->input_dev->keybit); } if (old_keycode != KEY_RESERVED) { - /* A previous mapping was updated... */ - __clear_bit(old_keycode, dev->input_dev->keybit); - /* ... but another scancode might use the same keycode */ - for (i = 0; i < rc_map->len; i++) { - if (rc_map->scan[i].keycode == old_keycode) { - __set_bit(old_keycode, dev->input_dev->keybit); - break; - } - } - /* Possibly shrink the keytable, failure is not a problem */ ir_resize_table(dev, rc_map, GFP_ATOMIC); } @@ -1759,6 +1748,8 @@ static int rc_prepare_rx_device(struct rc_dev *dev) 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); + if (dev->open) dev->input_dev->open = ir_open; if (dev->close)