From patchwork Sun Aug 21 20:34:14 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: 1083802 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7LKYn1j027457 for ; Sun, 21 Aug 2011 20:34:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693Ab1HUUe5 (ORCPT ); Sun, 21 Aug 2011 16:34:57 -0400 Received: from mail-iy0-f170.google.com ([209.85.210.170]:64871 "EHLO mail-iy0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670Ab1HUUe4 (ORCPT ); Sun, 21 Aug 2011 16:34:56 -0400 Received: by mail-iy0-f170.google.com with SMTP id 16so9119350iye.1 for ; Sun, 21 Aug 2011 13:34:56 -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:in-reply-to :references; bh=BtUC5EbAYiJPXtpJ/gUcQQi9udnrtTf1P9PJBq6YG20=; b=Jg3KyUYRWkinGAh2rANna5XR7EaFIZ03lFC94b0Bv9nE3c5HvblH8g6X9hUUYaNPWf NPXbTLbKQ+zcvBjdi0k1vCOJ6OG0nkr25AwE/SMNBMbuRmWt8e/uJ43jD67qcUmUvlPk 7PP3jbCm5Exx+R9dfnyjp0qXKXBxbHQOUqXrU= Received: by 10.231.41.69 with SMTP id n5mr4045724ibe.92.1313958896364; Sun, 21 Aug 2011 13:34:56 -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 a9sm2974822ibi.60.2011.08.21.13.34.54 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 21 Aug 2011 13:34:55 -0700 (PDT) From: bernie@plugable.com To: linux-fbdev@vger.kernel.org Cc: FlorianSchandinat@gmx.de, Andrew Kephart , Bernie Thompson Subject: [PATCH 2/5] udlfb: Search config descriptor if not at device level Date: Sun, 21 Aug 2011 13:34:14 -0700 Message-Id: <1313958862-5640-4-git-send-email-bernie@plugable.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313958862-5640-1-git-send-email-bernie@plugable.com> References: <1313958862-5640-1-git-send-email-bernie@plugable.com> 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 (demeter1.kernel.org [140.211.167.41]); Sun, 21 Aug 2011 20:34:57 +0000 (UTC) From: Andrew Kephart For at least one DisplayLink device, the vendor-specific information can be found in the config descriptor instead of as a separate, device-level descriptor. This patch searches the current interface (of the current config descriptor) for the DL vendor-specific descriptor. Signed-off-by: Andrew Kephart Signed-off-by: Bernie Thompson --- drivers/video/udlfb.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 844b371..bdd21de 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -1489,21 +1489,30 @@ static int dlfb_select_std_channel(struct dlfb_data *dev) } static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev, - struct usb_device *usbdev) + struct usb_interface *interface) { char *desc; char *buf; char *desc_end; - u8 total_len = 0; + int total_len = 0; buf = kzalloc(MAX_VENDOR_DESCRIPTOR_SIZE, GFP_KERNEL); if (!buf) return false; desc = buf; - total_len = usb_get_descriptor(usbdev, 0x5f, /* vendor specific */ - 0, desc, MAX_VENDOR_DESCRIPTOR_SIZE); + total_len = usb_get_descriptor(interface_to_usbdev(interface), + 0x5f, /* vendor specific */ + 0, desc, MAX_VENDOR_DESCRIPTOR_SIZE); + + /* if not found, look in configuration descriptor */ + if (total_len < 0) { + if (0 == usb_get_extra_descriptor(interface->cur_altsetting, + 0x5f, &desc)) + total_len = (int) desc[0]; + } + if (total_len > 5) { pr_info("vendor descriptor length:%x data:%02x %02x %02x %02x" \ "%02x %02x %02x %02x %02x %02x %02x\n", @@ -1544,6 +1553,8 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dev, } desc += length; } + } else { + pr_info("vendor descriptor not available (%d)\n", total_len); } goto success; @@ -1593,7 +1604,7 @@ static int dlfb_usb_probe(struct usb_interface *interface, dev->sku_pixel_limit = 2048 * 1152; /* default to maximum */ - if (!dlfb_parse_vendor_descriptor(dev, usbdev)) { + if (!dlfb_parse_vendor_descriptor(dev, interface)) { pr_err("firmware not recognized. Assume incompatible device\n"); goto error; }