From patchwork Fri Jun 28 02:28:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Dillow X-Patchwork-Id: 2796741 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3469BF4A1 for ; Fri, 28 Jun 2013 02:28:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD32620116 for ; Fri, 28 Jun 2013 02:28:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C83D2200F7 for ; Fri, 28 Jun 2013 02:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754032Ab3F1C2u (ORCPT ); Thu, 27 Jun 2013 22:28:50 -0400 Received: from matrix.voodoobox.net ([75.127.97.206]:41039 "EHLO matrix.voodoobox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753652Ab3F1C2t (ORCPT ); Thu, 27 Jun 2013 22:28:49 -0400 Received: from shed.thedillows.org ([IPv6:2001:470:8:bf8:218:f3ff:fe04:4c7d]) by matrix.voodoobox.net (8.13.8/8.13.8) with ESMTP id r5S2Sieu020154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Jun 2013 22:28:46 -0400 Received: from [192.168.0.11] (haswell.thedillows.org [192.168.0.11]) by shed.thedillows.org (8.14.4/8.14.4) with ESMTP id r5S2Shsx023301; Thu, 27 Jun 2013 22:28:43 -0400 Message-ID: <1372386523.28740.8.camel@haswell.thedillows.org> Subject: [RFC] hid/sony: add autorepeat for PS3 remotes From: David Dillow To: linux-input@vger.kernel.org Cc: Stephan Raue Date: Thu, 27 Jun 2013 22:28:43 -0400 X-Mailer: Evolution 3.8.3 (3.8.3-2.fc19) Mime-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some applications using the PS3 remote would like to have autorepeat from the device. Use the input subsystem's software emulation to provide this capability, and enable those that don't need it to turn it off. --- I'm not sure this is the correct approach, or if it is even appropriate for a remote to do autorepeat. However, the media/rc subsystem does do it by default, and it's been requested by users, so there is at least some demand. This compiled against the hid-sony driver with the PS3 remote changes merged, but I have done no testing of it. If the approach seems reasonable, I'll try to test it when the MythTV is idle. drivers/hid/hid-sony.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index ecbc749..0bbcd07 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -274,6 +274,24 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi, return 1; } +static int ps3remote_setup_repeat(struct hid_device *hdev) +{ + struct hid_input *hidinput = list_first_entry(&hdev->inputs, + struct hid_input, list); + struct input_dev *input = hidinput->input; + + /* + * Set up autorepeat defaults per the remote control subsystem; + * this must be done after hid_hw_start(), as having these non-zero + * at the time of input_register_device() tells the input system that + * the hardware does the autorepeat, and the PS3 remote does not. + */ + set_bit(EV_REP, input->evbit); + input->rep[REP_DELAY] = 500; + input->rep[REP_PERIOD] = 125; + + return 0; +} /* Sony Vaio VGX has wrongly mouse pointer declared as constant */ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, @@ -659,6 +677,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ret = sixaxis_set_operational_bt(hdev); else if (sc->quirks & BUZZ_CONTROLLER) ret = buzz_init(hdev); + else if (sc->quirks & PS3REMOTE) + ret = ps3remote_setup_repeat(hdev); else ret = 0;