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ý <madcatxster@xxxxxxxxxxxxxxxxxx> [ ... 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-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html