[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB8PR04MB6826516958DA6083192250CFF1840@DB8PR04MB6826.eurprd04.prod.outlook.com>
Date: Tue, 24 Sep 2019 03:32:37 +0000
From: Ran Wang <ran.wang_1@....com>
To: Alan Stern <stern@...land.harvard.edu>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Mathias Payer <mathias.payer@...elwelt.net>,
Dennis Wassenberg <dennis.wassenberg@...unet.com>,
"open list:USB SUBSYSTEM" <linux-usb@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: hub add filter for device with specific VID&PID
Hi Alan,
On Monday, September 23, 2019 23:01, Alan Stern wrote:
>
> On Mon, 23 Sep 2019, Ran Wang wrote:
>
> > USB 2.0 Embedded Host PET Automated Test (CH6) 6.7.23 A-UUT
> > "Unsupported Device" Message require to stop enumerating device with
> > VID=0x1a0a PID=0x0201 and pop message to declare this device is not
> supported.
> >
> > Signed-off-by: Ran Wang <ran.wang_1@....com>
> > ---
> > drivers/usb/core/hub.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index
> > bbcfa63..3cda0da 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -4982,6 +4982,18 @@ static void hub_port_connect(struct usb_hub *hub,
> int port1, u16 portstatus,
> > if (status < 0)
> > goto loop;
> >
> > + /* USB 2.0 Embedded Host PET Automated Test (CH6)
> > + * 6.7.23 A-UUT "Unsupported Device" Message
> > + * require to filter out below device when enumeration
> > + */
> > + if ((udev->descriptor.idVendor == 0x1a0a)
> > + && (udev->descriptor.idProduct == 0x0201)) {
> > + dev_err(&udev->dev, "This device is not supported:
> idVendor=0x%x idProduct=0x%x\n",
> > + udev->descriptor.idVendor,
> > + udev->descriptor.idProduct);
>
> There's no need to write out the Vendor and Product IDs. They already appear
> in the "New device" message.
OK
> > + goto done;
> > + }
> > +
> > if (udev->quirks & USB_QUIRK_DELAY_INIT)
> > msleep(2000);
>
> Shouldn't this be implemented as a device quirk?
Yes, I was also looking for the way in quirk but not quite sure currently.
So we can stop initializing a device (with specific VID&PID) in quirk, right?
Actually in drivers/usb/core/hub.c function usb_enumerate_device(), it will
call is_targeted(udev) which has below implementation:
54 /* OTG PET device is always targeted (see OTG 2.0 ECN 6.4.2) */
55 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a &&
56 le16_to_cpu(dev->descriptor.idProduct) == 0x0200))
57 return 1;
The ID is very close to what I need to response. So, do I need to add code here?
Thanks.
Ran
Powered by blists - more mailing lists