From patchwork Sun Jul 10 07:30:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bernie@plugable.com X-Patchwork-Id: 960752 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6A7UQNd030319 for ; Sun, 10 Jul 2011 07:30:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751534Ab1GJHa0 (ORCPT ); Sun, 10 Jul 2011 03:30:26 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:55656 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221Ab1GJHaZ (ORCPT ); Sun, 10 Jul 2011 03:30:25 -0400 Received: by pvg12 with SMTP id 12so1975563pvg.19 for ; Sun, 10 Jul 2011 00:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=cfOUM5zmkG0ggdq/C0Xvql/yHD9C83qValJn6aM/lfc=; b=mQrmsa4FgLWndyKrYMkblCMjyN/7ZlIHR1oWZhMkBfyNiHJCaPx7P7iU1m6RKwK23A i3276jRfngfy6WK4MPXebgZiWNOSra14p8FPc91Zp7MvPG/sqr/TtgWZjkYh/FPs/Jdc 1VrWeLoyYwrUym3cVRHiW6PMHbNbuCL0tGKgw= Received: by 10.68.57.103 with SMTP id h7mr5547569pbq.11.1310283024887; Sun, 10 Jul 2011 00:30:24 -0700 (PDT) Received: from localhost.localdomain (c-76-22-58-200.hsd1.wa.comcast.net [76.22.58.200]) by mx.google.com with ESMTPS id z6sm29385pbc.46.2011.07.10.00.30.23 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Jul 2011 00:30:23 -0700 (PDT) From: bernie@plugable.com To: linux-fbdev@vger.kernel.org Cc: lethal@linux-sh.org, akephart@akephart.org, Bernie Thompson Subject: [PATCH] drivers/video/udlfb match class, subclass, and protocol Date: Sun, 10 Jul 2011 00:30:00 -0700 Message-Id: <1310283000-2482-1-git-send-email-bernie@plugable.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sun, 10 Jul 2011 07:30:26 +0000 (UTC) From: Bernie Thompson Match udlfb only against vendor-specific class (e.g. only DisplayLink graphics, not composite standard audio class interfaces). This enables compatibility with composite graphics+audio devices (e.g. HDMI). Match udlfb only against compatible subclass 0 and protocol 0 chips. DisplayLink's USB 3.0 generation chips increment these values to signal that they have a incompatible protocol, preventing udlfb from erroneously matching to hardware it does not support. Tested to confirm proper behavior on both USB 2.0 and USB 3.0 generation devices. Reported-by: Andrew Kephart Signed-off-by: Bernie Thompson --- drivers/video/udlfb.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index c6584c9..4e13375 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -49,13 +49,22 @@ static const u32 udlfb_info_flags = FBINFO_DEFAULT | FBINFO_READS_FAST | FBINFO_HWACCEL_COPYAREA | FBINFO_MISC_ALWAYS_SETPAR; /* - * There are many DisplayLink-based products, all with unique PIDs. We are able - * to support all volume ones (circa 2009) with a single driver, so we match - * globally on VID. TODO: Probe() needs to detect when we might be running - * "future" chips, and bail on those, so a compatible driver can match. + * There are many DisplayLink-based graphics products, all with unique PIDs. + * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff) + * We also require a match on SubClass (0x00) and Protocol (0x00), + * which is compatible with all known USB 2.0 era graphics chips and firmware, + * but allows DisplayLink to increment those for any future incompatible chips */ static struct usb_device_id id_table[] = { - {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, + {.idVendor = 0x17e9, + .bInterfaceClass = 0xff, + .bInterfaceSubClass = 0x00, + .bInterfaceProtocol = 0x00, + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | + USB_DEVICE_ID_MATCH_INT_CLASS | + USB_DEVICE_ID_MATCH_INT_SUBCLASS | + USB_DEVICE_ID_MATCH_INT_PROTOCOL, + }, {}, }; MODULE_DEVICE_TABLE(usb, id_table);