Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical.
Message ID | 201105231637.39053.hselasky@c2i.net (mailing list archive) |
---|---|
State | Rejected, archived |
Headers |
Return-path: <mchehab@pedra> Envelope-to: mchehab@pedra Delivery-date: Mon, 23 May 2011 11:39:53 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from <mchehab@pedra>) id 1QOWIR-0004JD-1G for mchehab@pedra; Mon, 23 May 2011 11:39:52 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for <mchehab@localhost> (single-drop); Mon, 23 May 2011 11:39:51 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QOWHj-000862-Ik; Mon, 23 May 2011 14:39:07 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330Ab1EWOiv (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Mon, 23 May 2011 10:38:51 -0400 Received: from mailfe03.c2i.net ([212.247.154.66]:44497 "EHLO swip.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755253Ab1EWOiv (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 23 May 2011 10:38:51 -0400 X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=0KkIQGagYCvnrzE3Z2Lmid87OPdbX6VLcZYwAuLMZ50= c=1 sm=1 a=oBVYxUPRnbQA:10 a=WQU8e4WWZSUA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=SObZXD9RMCsnjX8LmoMA:9 a=CjuIK1q_8ugA:10 a=8kQB0OdkAAAA:8 a=X2PpMt_jvgySGMW1IAgA:9 a=9aOQ2cSd83gA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 130655544; Mon, 23 May 2011 16:38:50 +0200 To: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org> Subject: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical. Cc: Mauro Carvalho Chehab <mchehab@redhat.com> From: Hans Petter Selasky <hselasky@c2i.net> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-15?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-15?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= Date: Mon, 23 May 2011 16:37:39 +0200 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_zEn2NxpFtxIsen3" Message-Id: <201105231637.39053.hselasky@c2i.net> Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org Sender: <mchehab@pedra> |
Commit Message
Hans Petter Selasky
May 23, 2011, 2:37 p.m. UTC
--HPS
Comments
Em 23-05-2011 11:37, Hans Petter Selasky escreveu: > -HPS > > > dvb-usb-0016.patch > > > From 3cf61d6a77b22f58471188cd0e7e3dc6c3a29b0b Mon Sep 17 00:00:00 2001 > From: Hans Petter Selasky <hselasky@c2i.net> > Date: Mon, 23 May 2011 16:36:55 +0200 > Subject: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical. > > Signed-off-by: Hans Petter Selasky <hselasky@c2i.net> > --- > drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c > index cbe2f0d..38a7d03 100644 > --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c > +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c > @@ -971,6 +971,14 @@ static int ttusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) > > static int ttusb_setup_interfaces(struct ttusb *ttusb) > { > + /* > + * Try to select alternate setting 1 for first interface. If > + * that does not work, restore to alternate setting 0. > + */ > + if (usb_set_interface(ttusb->dev, 0, 1) < 0) > + usb_set_interface(ttusb->dev, 0, 0); > + > + /* Select alternate setting 1 for second interface. */ > usb_set_interface(ttusb->dev, 1, 1); > > ttusb->bulk_out_pipe = usb_sndbulkpipe(ttusb->dev, 1); > -- 1.7.1.1 I don't have any ttusb device here, but I doubt that this would work. Alternates should be selected depending on the bandwidth needed. The right way is to write some logic that will get the maximum packet size for each mode, between the alternates that provide the type of transfer (Bulk or ISOC) accepted by the driver. You may take a look at staging/tm6000 or at drivers/media/video/em28xx or at drivers/media/video/gspca to see a few examples on how to do that. IMHO, the alternates selection code at tm6000 is in better shape than the others I know. Cheers, Mauro. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: > Em 23-05-2011 11:37, Hans Petter Selasky escreveu: > > I don't have any ttusb device here, but I doubt that this would work. Hi, It is already tested and works fine. What I see is that interface 1 does not have an alternate setting like the driver code expects, while interface 0 does. So it is the opposite of what the driver expects. Maybe the manufacturer changed something. Endpoints are still the same. Please find attached an USB descriptor dump from this device. > > Alternates should be selected depending on the bandwidth needed. The right > way is to write some logic that will get the maximum packet size for each > mode, between the alternates that provide the type of transfer (Bulk or > ISOC) accepted by the driver. Right, but this driver doesn't do this. It only selects a working one. --HPS ugen6.2: <WinTV NOVA-t USB Hauppauge> at usbus6, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON bLength = 0x0012 bDescriptorType = 0x0001 bcdUSB = 0x0100 bDeviceClass = 0x0000 bDeviceSubClass = 0x0000 bDeviceProtocol = 0x0000 bMaxPacketSize0 = 0x0008 idVendor = 0x0b48 idProduct = 0x1005 bcdDevice = 0x0100 iManufacturer = 0x0001 <Hauppauge> iProduct = 0x0002 <WinTV NOVA-t USB> iSerialNumber = 0x0000 <no string> bNumConfigurations = 0x0001 Configuration index 0 bLength = 0x0009 bDescriptorType = 0x0002 wTotalLength = 0x019f bNumInterfaces = 0x0002 bConfigurationValue = 0x0001 iConfiguration = 0x0004 <Config0> bmAttributes = 0x0040 bMaxPower = 0x0000 Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0000 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 1 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0001 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0390 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 2 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0002 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0360 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 3 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0003 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0338 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 4 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0004 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x02d8 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 5 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0005 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0278 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 6 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0006 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0220 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 7 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0007 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x01c0 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 8 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0008 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0160 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 9 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0009 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0100 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 10 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x000a bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x00c0 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 11 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x000b bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0080 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 0 Alt 12 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x000c bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0081 <IN> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 1 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0001 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0020 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000 Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0040 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Interface 1 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0001 bAlternateSetting = 0x0000 bNumEndpoints = 0x0001 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> Endpoint 0 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0002 <OUT> bmAttributes = 0x0002 <BULK> wMaxPacketSize = 0x0008 bInterval = 0x0000 bRefresh = 0x0000 bSynchAddress = 0x0000
Em 23-05-2011 15:48, Hans Petter Selasky escreveu: > On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: >> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: >> >> I don't have any ttusb device here, but I doubt that this would work. > > Hi, > > It is already tested and works fine. This will work for you, but it will likely break for the others. Your patch is assuming that returning an error if selecting alt 1 is enough to know that alt 0 should be used. > What I see is that interface 1 does not have an alternate setting like the > driver code expects, while interface 0 does. So it is the opposite of what the > driver expects. Maybe the manufacturer changed something. Endpoints are still > the same. That sometimes happen. Or maybe you just need a different size. > > Please find attached an USB descriptor dump from this device. Int 0, endpoint 0: Interface 0 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0000 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> ... Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0000 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 ... Interface 0 Alt 1 bLength = 0x0009 bDescriptorType = 0x0004 bInterfaceNumber = 0x0000 bAlternateSetting = 0x0001 bNumEndpoints = 0x0003 bInterfaceClass = 0x0000 bInterfaceSubClass = 0x0000 bInterfaceProtocol = 0x0000 iInterface = 0x0000 <no string> ... Endpoint 2 bLength = 0x0007 bDescriptorType = 0x0005 bEndpointAddress = 0x0082 <IN> bmAttributes = 0x0001 <ISOCHRONOUS> wMaxPacketSize = 0x0390 bInterval = 0x0001 bRefresh = 0x0000 bSynchAddress = 0x0000 Hmm... assuming that the driver is using ISOC transfers, the difference between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so, you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is 0x390. What the driver should be doing is to select an alt mode where the wMaxPacketSize is big enough to handle the transfer. Calculating what "big enough" is device-dependent, but, basically, a 480 Mbps USB bus is capable of providing 800 isoc slots per interval. If the packets are bigger, the max bandwidth is bigger. You're able to see the amount of packets per interval by doing a cat /proc/bus/usb/devices: T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 The "B:" line above shows the USB bandwidth usage. > >> >> Alternates should be selected depending on the bandwidth needed. The right >> way is to write some logic that will get the maximum packet size for each >> mode, between the alternates that provide the type of transfer (Bulk or >> ISOC) accepted by the driver. > > Right, but this driver doesn't do this. It only selects a working one. > > --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote: > Em 23-05-2011 15:48, Hans Petter Selasky escreveu: > > On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: > >> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: > >> > >> I don't have any ttusb device here, but I doubt that this would work. > > > > Hi, > > > > It is already tested and works fine. > > This will work for you, but it will likely break for the others. Your patch > is assuming that returning an error if selecting alt 1 is enough to know > that alt 0 should be used. > > > What I see is that interface 1 does not have an alternate setting like > > the driver code expects, while interface 0 does. So it is the opposite > > of what the driver expects. Maybe the manufacturer changed something. > > Endpoints are still the same. > > That sometimes happen. Or maybe you just need a different size. > > > Please find attached an USB descriptor dump from this device. > > Int 0, endpoint 0: > > Interface 0 > bLength = 0x0009 > bDescriptorType = 0x0004 > bInterfaceNumber = 0x0000 > bAlternateSetting = 0x0000 > bNumEndpoints = 0x0003 > bInterfaceClass = 0x0000 > bInterfaceSubClass = 0x0000 > bInterfaceProtocol = 0x0000 > iInterface = 0x0000 <no string> > > ... > > Endpoint 2 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0082 <IN> > bmAttributes = 0x0001 <ISOCHRONOUS> > wMaxPacketSize = 0x0000 > bInterval = 0x0001 > bRefresh = 0x0000 > bSynchAddress = 0x0000 > > ... > > Interface 0 Alt 1 > bLength = 0x0009 > bDescriptorType = 0x0004 > bInterfaceNumber = 0x0000 > bAlternateSetting = 0x0001 > bNumEndpoints = 0x0003 > bInterfaceClass = 0x0000 > bInterfaceSubClass = 0x0000 > bInterfaceProtocol = 0x0000 > iInterface = 0x0000 <no string> > > ... > Endpoint 2 > bLength = 0x0007 > bDescriptorType = 0x0005 > bEndpointAddress = 0x0082 <IN> > bmAttributes = 0x0001 <ISOCHRONOUS> > wMaxPacketSize = 0x0390 > bInterval = 0x0001 > bRefresh = 0x0000 > bSynchAddress = 0x0000 > Hi, > Hmm... assuming that the driver is using ISOC transfers, the difference > between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so, > you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is > 0x390. > > What the driver should be doing is to select an alt mode where the > wMaxPacketSize is big enough to handle the transfer. I can write the code to do that. Summed up: 1) Search interface 0, for alternate settings that have an ISOC-IN and wMaxPacket != 0. Select this alternate setting. 2) Search interface 1, for alternate settings that have an ISOC-IN and wMaxPacket != 0. Select this alternate setting. 3) Done. Do you think this will work better? > Calculating what "big enough" is device-dependent, but, basically, a 480 > Mbps USB bus is capable of providing 800 isoc slots per interval. If the > packets are bigger, the max bandwidth is bigger. This is a FULL speed device, max 10MBit/second. > You're able to see the amount of packets per interval by doing a cat > /proc/bus/usb/devices: > > T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 > B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 > > The "B:" line above shows the USB bandwidth usage. Do you need this information to proceed with the patch? --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Em 23-05-2011 16:17, Hans Petter Selasky escreveu: > On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote: >> Em 23-05-2011 15:48, Hans Petter Selasky escreveu: >>> On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: >>>> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: >>>> >>>> I don't have any ttusb device here, but I doubt that this would work. >>> >>> Hi, >>> >>> It is already tested and works fine. >> >> This will work for you, but it will likely break for the others. Your patch >> is assuming that returning an error if selecting alt 1 is enough to know >> that alt 0 should be used. >> >>> What I see is that interface 1 does not have an alternate setting like >>> the driver code expects, while interface 0 does. So it is the opposite >>> of what the driver expects. Maybe the manufacturer changed something. >>> Endpoints are still the same. >> >> That sometimes happen. Or maybe you just need a different size. >> >>> Please find attached an USB descriptor dump from this device. >> >> Int 0, endpoint 0: >> >> Interface 0 >> bLength = 0x0009 >> bDescriptorType = 0x0004 >> bInterfaceNumber = 0x0000 >> bAlternateSetting = 0x0000 >> bNumEndpoints = 0x0003 >> bInterfaceClass = 0x0000 >> bInterfaceSubClass = 0x0000 >> bInterfaceProtocol = 0x0000 >> iInterface = 0x0000 <no string> >> >> ... >> >> Endpoint 2 >> bLength = 0x0007 >> bDescriptorType = 0x0005 >> bEndpointAddress = 0x0082 <IN> >> bmAttributes = 0x0001 <ISOCHRONOUS> >> wMaxPacketSize = 0x0000 >> bInterval = 0x0001 >> bRefresh = 0x0000 >> bSynchAddress = 0x0000 >> >> ... >> >> Interface 0 Alt 1 >> bLength = 0x0009 >> bDescriptorType = 0x0004 >> bInterfaceNumber = 0x0000 >> bAlternateSetting = 0x0001 >> bNumEndpoints = 0x0003 >> bInterfaceClass = 0x0000 >> bInterfaceSubClass = 0x0000 >> bInterfaceProtocol = 0x0000 >> iInterface = 0x0000 <no string> >> >> ... >> Endpoint 2 >> bLength = 0x0007 >> bDescriptorType = 0x0005 >> bEndpointAddress = 0x0082 <IN> >> bmAttributes = 0x0001 <ISOCHRONOUS> >> wMaxPacketSize = 0x0390 >> bInterval = 0x0001 >> bRefresh = 0x0000 >> bSynchAddress = 0x0000 >> > > Hi, > >> Hmm... assuming that the driver is using ISOC transfers, the difference >> between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so, >> you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is >> 0x390. >> >> What the driver should be doing is to select an alt mode where the >> wMaxPacketSize is big enough to handle the transfer. > > I can write the code to do that. Summed up: > > 1) Search interface 0, for alternate settings that have an ISOC-IN and > wMaxPacket != 0. Select this alternate setting. > > 2) Search interface 1, for alternate settings that have an ISOC-IN and > wMaxPacket != 0. Select this alternate setting. > > 3) Done. > > Do you think this will work better? > >> Calculating what "big enough" is device-dependent, but, basically, a 480 >> Mbps USB bus is capable of providing 800 isoc slots per interval. If the >> packets are bigger, the max bandwidth is bigger. > > This is a FULL speed device, max 10MBit/second. Hmm... USB 1.1 devices are even more limited on the amount of used bandwidth. The above procedure is better than the one you've proposed, but yet you may not be able to receive channels with higher bandwidths. The usb "max" limit is lower than the maximum bandwidth. I think that full speed provides 900 isoc slots per interval, but the interval for usb 1.1 is higher (1s, while the interval for usb 2.0 is 125 us), but you need to double check such constraints at the USB 1.1 and 2.0 specs, as I may be wrong on that, as I read it a long time ago ;) The proper way would be to have a function that would dynamically select the alternate depending on the channel bandwidth and on the stream needs. Someone might of course just write a code that selects the highest wMaxPacket, but this would cause some troubles if another device is connected to the USB 1.1 bus. > >> You're able to see the amount of packets per interval by doing a cat >> /proc/bus/usb/devices: >> >> T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 >> B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 >> >> The "B:" line above shows the USB bandwidth usage. > > Do you need this information to proceed with the patch? > > --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 23 May 2011 21:47:57 Mauro Carvalho Chehab wrote: > Em 23-05-2011 16:17, Hans Petter Selasky escreveu: > > On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote: > >> Em 23-05-2011 15:48, Hans Petter Selasky escreveu: > >>> On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: > >>>> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: > >>>> > >>>> I don't have any ttusb device here, but I doubt that this would work. > >>> > >>> Hi, > >>> > >>> It is already tested and works fine. > >> > >> This will work for you, but it will likely break for the others. Your > >> patch is assuming that returning an error if selecting alt 1 is enough > >> to know that alt 0 should be used. > >> > >>> What I see is that interface 1 does not have an alternate setting like > >>> the driver code expects, while interface 0 does. So it is the opposite > >>> of what the driver expects. Maybe the manufacturer changed something. > >>> Endpoints are still the same. > >> > >> That sometimes happen. Or maybe you just need a different size. > >> > >>> Please find attached an USB descriptor dump from this device. > >> > >> Int 0, endpoint 0: > >> Interface 0 > >> > >> bLength = 0x0009 > >> bDescriptorType = 0x0004 > >> bInterfaceNumber = 0x0000 > >> bAlternateSetting = 0x0000 > >> bNumEndpoints = 0x0003 > >> bInterfaceClass = 0x0000 > >> bInterfaceSubClass = 0x0000 > >> bInterfaceProtocol = 0x0000 > >> iInterface = 0x0000 <no string> > >> > >> ... > >> > >> Endpoint 2 > >> > >> bLength = 0x0007 > >> bDescriptorType = 0x0005 > >> bEndpointAddress = 0x0082 <IN> > >> bmAttributes = 0x0001 <ISOCHRONOUS> > >> wMaxPacketSize = 0x0000 > >> bInterval = 0x0001 > >> bRefresh = 0x0000 > >> bSynchAddress = 0x0000 > >> > >> ... > >> > >> Interface 0 Alt 1 > >> > >> bLength = 0x0009 > >> bDescriptorType = 0x0004 > >> bInterfaceNumber = 0x0000 > >> bAlternateSetting = 0x0001 > >> bNumEndpoints = 0x0003 > >> bInterfaceClass = 0x0000 > >> bInterfaceSubClass = 0x0000 > >> bInterfaceProtocol = 0x0000 > >> iInterface = 0x0000 <no string> > >> > >> ... > >> > >> Endpoint 2 > >> > >> bLength = 0x0007 > >> bDescriptorType = 0x0005 > >> bEndpointAddress = 0x0082 <IN> > >> bmAttributes = 0x0001 <ISOCHRONOUS> > >> wMaxPacketSize = 0x0390 > >> bInterval = 0x0001 > >> bRefresh = 0x0000 > >> bSynchAddress = 0x0000 > > > > Hi, > > > >> Hmm... assuming that the driver is using ISOC transfers, the difference > >> between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so, > >> you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is > >> 0x390. > >> > >> What the driver should be doing is to select an alt mode where the > >> wMaxPacketSize is big enough to handle the transfer. > > > > I can write the code to do that. Summed up: > > > > 1) Search interface 0, for alternate settings that have an ISOC-IN and > > wMaxPacket != 0. Select this alternate setting. > > > > 2) Search interface 1, for alternate settings that have an ISOC-IN and > > wMaxPacket != 0. Select this alternate setting. > > > > 3) Done. > > > > Do you think this will work better? > > > >> Calculating what "big enough" is device-dependent, but, basically, a > >> 480 Mbps USB bus is capable of providing 800 isoc slots per interval. > >> If the packets are bigger, the max bandwidth is bigger. > > > > This is a FULL speed device, max 10MBit/second. > > Hmm... USB 1.1 devices are even more limited on the amount of used > bandwidth. The above procedure is better than the one you've proposed, but > yet you may not be able to receive channels with higher bandwidths. > > The usb "max" limit is lower than the maximum bandwidth. I think that full > speed provides 900 isoc slots per interval, but the interval for usb 1.1 is > higher (1s, while the interval for usb 2.0 is 125 us), but you need to > double check such constraints at the USB 1.1 and 2.0 specs, as I may be > wrong on that, as I read it a long time ago ;) Hi, There are 1000 frames per second when using Full Speed USB. I know the device cannot receive all streams, but it is very well suited for DVB radio. --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Em 23-05-2011 16:52, Hans Petter Selasky escreveu: > On Monday 23 May 2011 21:47:57 Mauro Carvalho Chehab wrote: >> Em 23-05-2011 16:17, Hans Petter Selasky escreveu: >>> On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote: >>>> Em 23-05-2011 15:48, Hans Petter Selasky escreveu: >>>>> On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: >>>>>> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: >>>>>> >>>>>> I don't have any ttusb device here, but I doubt that this would work. >>>>> >>>>> Hi, >>>>> >>>>> It is already tested and works fine. >>>> >>>> This will work for you, but it will likely break for the others. Your >>>> patch is assuming that returning an error if selecting alt 1 is enough >>>> to know that alt 0 should be used. >>>> >>>>> What I see is that interface 1 does not have an alternate setting like >>>>> the driver code expects, while interface 0 does. So it is the opposite >>>>> of what the driver expects. Maybe the manufacturer changed something. >>>>> Endpoints are still the same. >>>> >>>> That sometimes happen. Or maybe you just need a different size. >>>> >>>>> Please find attached an USB descriptor dump from this device. >>>> >>>> Int 0, endpoint 0: >>>> Interface 0 >>>> >>>> bLength = 0x0009 >>>> bDescriptorType = 0x0004 >>>> bInterfaceNumber = 0x0000 >>>> bAlternateSetting = 0x0000 >>>> bNumEndpoints = 0x0003 >>>> bInterfaceClass = 0x0000 >>>> bInterfaceSubClass = 0x0000 >>>> bInterfaceProtocol = 0x0000 >>>> iInterface = 0x0000 <no string> >>>> >>>> ... >>>> >>>> Endpoint 2 >>>> >>>> bLength = 0x0007 >>>> bDescriptorType = 0x0005 >>>> bEndpointAddress = 0x0082 <IN> >>>> bmAttributes = 0x0001 <ISOCHRONOUS> >>>> wMaxPacketSize = 0x0000 >>>> bInterval = 0x0001 >>>> bRefresh = 0x0000 >>>> bSynchAddress = 0x0000 >>>> >>>> ... >>>> >>>> Interface 0 Alt 1 >>>> >>>> bLength = 0x0009 >>>> bDescriptorType = 0x0004 >>>> bInterfaceNumber = 0x0000 >>>> bAlternateSetting = 0x0001 >>>> bNumEndpoints = 0x0003 >>>> bInterfaceClass = 0x0000 >>>> bInterfaceSubClass = 0x0000 >>>> bInterfaceProtocol = 0x0000 >>>> iInterface = 0x0000 <no string> >>>> >>>> ... >>>> >>>> Endpoint 2 >>>> >>>> bLength = 0x0007 >>>> bDescriptorType = 0x0005 >>>> bEndpointAddress = 0x0082 <IN> >>>> bmAttributes = 0x0001 <ISOCHRONOUS> >>>> wMaxPacketSize = 0x0390 >>>> bInterval = 0x0001 >>>> bRefresh = 0x0000 >>>> bSynchAddress = 0x0000 >>> >>> Hi, >>> >>>> Hmm... assuming that the driver is using ISOC transfers, the difference >>>> between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so, >>>> you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is >>>> 0x390. >>>> >>>> What the driver should be doing is to select an alt mode where the >>>> wMaxPacketSize is big enough to handle the transfer. >>> >>> I can write the code to do that. Summed up: >>> >>> 1) Search interface 0, for alternate settings that have an ISOC-IN and >>> wMaxPacket != 0. Select this alternate setting. >>> >>> 2) Search interface 1, for alternate settings that have an ISOC-IN and >>> wMaxPacket != 0. Select this alternate setting. >>> >>> 3) Done. >>> >>> Do you think this will work better? >>> >>>> Calculating what "big enough" is device-dependent, but, basically, a >>>> 480 Mbps USB bus is capable of providing 800 isoc slots per interval. >>>> If the packets are bigger, the max bandwidth is bigger. >>> >>> This is a FULL speed device, max 10MBit/second. >> >> Hmm... USB 1.1 devices are even more limited on the amount of used >> bandwidth. The above procedure is better than the one you've proposed, but >> yet you may not be able to receive channels with higher bandwidths. >> >> The usb "max" limit is lower than the maximum bandwidth. I think that full >> speed provides 900 isoc slots per interval, but the interval for usb 1.1 is >> higher (1s, while the interval for usb 2.0 is 125 us), but you need to >> double check such constraints at the USB 1.1 and 2.0 specs, as I may be >> wrong on that, as I read it a long time ago ;) > > Hi, > > There are 1000 frames per second when using Full Speed USB. No, it is 900. See [1]: [1] http://www.google.com.br/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3A%2F%2Fmprolab.teipir.gr%2Fvivlio80X86%2Fusb11.pdf&ei=DrzaTfD5HqW90AHY-Jn8Aw&usg=AFQjCNHZW7ogFrjqoim1lTduQTHTDJoAUg "5.6.4 Isochronous Transfer Bus Access Constraints Isochronous transfers can be used only by full-speed devices. The USB requires that no more than 90% of any frame be allocated for periodic (isochronous and interrupt) transfers." 90% of 1000 frames is 900 frames/s. That's the maximum limit for ISOC transfers. > I know the device > cannot receive all streams, but it is very well suited for DVB radio. Yeah, for DVB radio, that's ok, but the driver should be ok also for other usages. Of course, streams with > 9Mbps won't fit on it, but if the driver is not selecting the maximum alternate, the bandwidth limit will be even smaller than that. Mauro. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Monday 23 May 2011 22:04:07 Mauro Carvalho Chehab wrote: > Em 23-05-2011 16:52, Hans Petter Selasky escreveu: > > On Monday 23 May 2011 21:47:57 Mauro Carvalho Chehab wrote: > >> Em 23-05-2011 16:17, Hans Petter Selasky escreveu: > >>> On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote: > >>>> Em 23-05-2011 15:48, Hans Petter Selasky escreveu: > >>>>> On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote: > >>>>>> Em 23-05-2011 11:37, Hans Petter Selasky escreveu: > >>>>>> > >>>>>> I don't have any ttusb device here, but I doubt that this would > >>>>>> work. > >>>>> > >>>>> Hi, > >>>>> > >>>>> It is already tested and works fine. > >>>> > >>>> This will work for you, but it will likely break for the others. Your > >>>> patch is assuming that returning an error if selecting alt 1 is enough > >>>> to know that alt 0 should be used. > >>>> > >>>>> What I see is that interface 1 does not have an alternate setting > >>>>> like the driver code expects, while interface 0 does. So it is the > >>>>> opposite of what the driver expects. Maybe the manufacturer changed > >>>>> something. Endpoints are still the same. > >>>> > >>>> That sometimes happen. Or maybe you just need a different size. > >>>> > >>>>> Please find attached an USB descriptor dump from this device. > >>>> > >>>> Int 0, endpoint 0: > >>>> Interface 0 > >>>> > >>>> bLength = 0x0009 > >>>> bDescriptorType = 0x0004 > >>>> bInterfaceNumber = 0x0000 > >>>> bAlternateSetting = 0x0000 > >>>> bNumEndpoints = 0x0003 > >>>> bInterfaceClass = 0x0000 > >>>> bInterfaceSubClass = 0x0000 > >>>> bInterfaceProtocol = 0x0000 > >>>> iInterface = 0x0000 <no string> > >>>> > >>>> ... > >>>> > >>>> Endpoint 2 > >>>> > >>>> bLength = 0x0007 > >>>> bDescriptorType = 0x0005 > >>>> bEndpointAddress = 0x0082 <IN> > >>>> bmAttributes = 0x0001 <ISOCHRONOUS> > >>>> wMaxPacketSize = 0x0000 > >>>> bInterval = 0x0001 > >>>> bRefresh = 0x0000 > >>>> bSynchAddress = 0x0000 > >>>> > >>>> ... > >>>> > >>>> Interface 0 Alt 1 > >>>> > >>>> bLength = 0x0009 > >>>> bDescriptorType = 0x0004 > >>>> bInterfaceNumber = 0x0000 > >>>> bAlternateSetting = 0x0001 > >>>> bNumEndpoints = 0x0003 > >>>> bInterfaceClass = 0x0000 > >>>> bInterfaceSubClass = 0x0000 > >>>> bInterfaceProtocol = 0x0000 > >>>> iInterface = 0x0000 <no string> > >>>> > >>>> ... > >>>> > >>>> Endpoint 2 > >>>> > >>>> bLength = 0x0007 > >>>> bDescriptorType = 0x0005 > >>>> bEndpointAddress = 0x0082 <IN> > >>>> bmAttributes = 0x0001 <ISOCHRONOUS> > >>>> wMaxPacketSize = 0x0390 > >>>> bInterval = 0x0001 > >>>> bRefresh = 0x0000 > >>>> bSynchAddress = 0x0000 > >>> > >>> Hi, > >>> > >>>> Hmm... assuming that the driver is using ISOC transfers, the > >>>> difference between alt 0 and alt 1 is that, on alt0, the > >>>> mwMaxPacketSize is 0 (so, you can't use it for isoc transfers), > >>>> while, on alt 1, wMaxPacketSize is 0x390. > >>>> > >>>> What the driver should be doing is to select an alt mode where the > >>>> wMaxPacketSize is big enough to handle the transfer. > >>> > >>> I can write the code to do that. Summed up: > >>> > >>> 1) Search interface 0, for alternate settings that have an ISOC-IN and > >>> wMaxPacket != 0. Select this alternate setting. > >>> > >>> 2) Search interface 1, for alternate settings that have an ISOC-IN and > >>> wMaxPacket != 0. Select this alternate setting. > >>> > >>> 3) Done. > >>> > >>> Do you think this will work better? > >>> > >>>> Calculating what "big enough" is device-dependent, but, basically, a > >>>> 480 Mbps USB bus is capable of providing 800 isoc slots per interval. > >>>> If the packets are bigger, the max bandwidth is bigger. > >>> > >>> This is a FULL speed device, max 10MBit/second. > >> > >> Hmm... USB 1.1 devices are even more limited on the amount of used > >> bandwidth. The above procedure is better than the one you've proposed, > >> but yet you may not be able to receive channels with higher bandwidths. > >> > >> The usb "max" limit is lower than the maximum bandwidth. I think that > >> full speed provides 900 isoc slots per interval, but the interval for > >> usb 1.1 is higher (1s, while the interval for usb 2.0 is 125 us), but > >> you need to double check such constraints at the USB 1.1 and 2.0 specs, > >> as I may be wrong on that, as I read it a long time ago ;) > > > > Hi, > > > > There are 1000 frames per second when using Full Speed USB. > > No, it is 900. See [1]: > > [1] > http://www.google.com.br/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3 > A%2F%2Fmprolab.teipir.gr%2Fvivlio80X86%2Fusb11.pdf&ei=DrzaTfD5HqW90AHY-Jn8A > w&usg=AFQjCNHZW7ogFrjqoim1lTduQTHTDJoAUg > > "5.6.4 Isochronous Transfer Bus Access Constraints > Isochronous transfers can be used only by full-speed devices. > The USB requires that no more than 90% of any frame be allocated for > periodic (isochronous and interrupt) transfers." > > 90% of 1000 frames is 900 frames/s. That's the maximum limit for ISOC > transfers. Hi, FULL speed USB has 1000 frames per second which is constant. During each frame that last 1ms you can send max 1200 bytes approximately simplex. You are allowed to use up to 90% of 1200 bytes, which is 1080 bytes which is just above the maximum of 1023 bytes for isochronous transfers. Hope you see now! --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From 3cf61d6a77b22f58471188cd0e7e3dc6c3a29b0b Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky <hselasky@c2i.net> Date: Mon, 23 May 2011 16:36:55 +0200 Subject: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical. Signed-off-by: Hans Petter Selasky <hselasky@c2i.net> --- drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index cbe2f0d..38a7d03 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -971,6 +971,14 @@ static int ttusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) static int ttusb_setup_interfaces(struct ttusb *ttusb) { + /* + * Try to select alternate setting 1 for first interface. If + * that does not work, restore to alternate setting 0. + */ + if (usb_set_interface(ttusb->dev, 0, 1) < 0) + usb_set_interface(ttusb->dev, 0, 0); + + /* Select alternate setting 1 for second interface. */ usb_set_interface(ttusb->dev, 1, 1); ttusb->bulk_out_pipe = usb_sndbulkpipe(ttusb->dev, 1); -- 1.7.1.1