Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965811AbbBQMMK (ORCPT ); Tue, 17 Feb 2015 07:12:10 -0500 Received: from cantor2.suse.de ([195.135.220.15]:34070 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751299AbbBQMMH (ORCPT ); Tue, 17 Feb 2015 07:12:07 -0500 Date: Tue, 17 Feb 2015 13:12:05 +0100 (CET) From: Jiri Kosina To: =?ISO-8859-15?Q?Michal_Mal=FD?= cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, simon@mungewell.org, elias.vds@gmail.com Subject: Re: [PATCH 1/4] HID: Identify Logitech gaming wheels in compatibility modes accordingly to Logitech specifications In-Reply-To: <1423240486-6714-2-git-send-email-madcatxster@devoid-pointer.net> Message-ID: References: <1423240486-6714-1-git-send-email-madcatxster@devoid-pointer.net> <1423240486-6714-2-git-send-email-madcatxster@devoid-pointer.net> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2927 Lines: 82 On Fri, 6 Feb 2015, Michal Malý wrote: > Identify Logitech gaming wheels in compatibility modes accordingly to Logitech > specifications. > > Logitech specification contains a general method of identifying various > models of their gaming wheels while they are in "compatibility" mode. > This patch implements the method instead of checking against known > values of bcdDevice. Handling of the mode switch upon initialization is > also adjusted so that the driver does not have to go through the entire > initialization routine because the wheels are set to perform a USB > detach before they reappear in "native" mode. > > Signed-off-by: Michal Malý [ ... snip ... > +u16 lg4ff_identify_multimode_wheel(struct hid_device *hid, const u16 reported_product_id, const u16 bcdDevice) This should be static. > +{ > + const struct lg4ff_wheel_ident_checklist *checklist; > + int i, from_idx, to_idx; > + > + switch (reported_product_id) { > + case USB_DEVICE_ID_LOGITECH_WHEEL: > + case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: > + checklist = &lg4ff_main_checklist; > + from_idx = 0; > + to_idx = checklist->count - 1; > + break; > + case USB_DEVICE_ID_LOGITECH_G25_WHEEL: > + checklist = &lg4ff_main_checklist; > + from_idx = 0; > + to_idx = checklist->count - 2; /* End identity check at G25 */ > + break; > + case USB_DEVICE_ID_LOGITECH_G27_WHEEL: > + checklist = &lg4ff_main_checklist; > + from_idx = 1; /* Start identity check at G27 */ > + to_idx = checklist->count - 3; /* End identity check at G27 */ > + break; > + case USB_DEVICE_ID_LOGITECH_DFGT_WHEEL: > + checklist = &lg4ff_main_checklist; > + from_idx = 0; > + to_idx = checklist->count - 4; /* End identity check at DFGT */ > + break; > + default: > + return 0; > + } > + > + for (i = from_idx; i <= to_idx; i++) { > + const u16 mask = checklist->models[i]->mask; > + const u16 result = checklist->models[i]->result; > + const u16 real_product_id = checklist->models[i]->real_product_id; > + > + if ((bcdDevice & mask) == result) { > + dbg_hid("Found wheel with real PID %X whose reported PID is %X\n", real_product_id, reported_product_id); > + return real_product_id; > + } > + } > + > + /* No match found. This is an unknown wheel model, do not touch it */ > + dbg_hid("Wheel with bcdDevice %X was not recognized as multimode wheel, leaving in its current mode\n", bcdDevice); > + return 0; > +} > + > +int lg4ff_handle_multimode_wheel(struct hid_device *hid, u16 *real_product_id, const u16 bcdDevice) And this as well. Otherwise the patchset looks good, please resend with these major things fixed and I'll apply it. Thanks, -- Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/