> > > On Thu, Nov 04, 2010 at 02:01:27PM +0800, Luo, Yifei wrote: > > > > >From 604a04773333c221cb9bd83ed9a0b1f052c47bda Mon Sep 17 > 00:00:00 > > > 2001 > > > > From: Andy Luo <[email protected]> > > > > Date: Thu, 4 Nov 2010 13:34:33 +0800 > > > > Subject: [PATCH] usb: add usb test mode support > > > > > > > > This patch adds test mode support for Langwell gadget driver, and it > > > implements debug interface for Host & Client test mode entry. > > > > > > > > Change-Id: I9cd76417ad47c201948159353fbb8af926fe8683 > > > > Signed-off-by: Andy Luo <[email protected]> > > > > Signed-off-by: Henry Yuan <[email protected]> > > > > --- > > > > drivers/usb/core/sysfs.c | 18 ++++++++ > > > > drivers/usb/gadget/langwell_udc.c | 20 +++++++++ > > > > drivers/usb/host/ehci-dbg.c | 86 > > > +++++++++++++++++++++++++++++++++++++ > > > > drivers/usb/host/ehci-hub.c | 7 +++ > > > > drivers/usb/host/ehci.h | 1 + > > > > include/linux/usb/ehci_def.h | 4 ++ > > > > 6 files changed, 136 insertions(+), 0 deletions(-) > > > > > > > > diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c > > > > index 448f5b4..e864b8d 100644 > > > > --- a/drivers/usb/core/sysfs.c > > > > +++ b/drivers/usb/core/sysfs.c > > > > @@ -581,6 +581,23 @@ static ssize_t usb_remove_store(struct device > > > *dev, > > > > } > > > > static DEVICE_ATTR(remove, 0200, NULL, usb_remove_store); > > > > > > > > +static ssize_t usb_testmode_store(struct device *dev, > > > > + struct device_attribute *attr, > > > > + const char *buf, size_t count) > > > > +{ > > > > + int selector; > > > > + struct usb_device *udev = to_usb_device(dev); > > > > + > > > > + if (strict_strtoul(buf, 16, &selector)) > > > > + return -EINVAL; > > > > + usb_control_msg(udev, usb_sndctrlpipe(udev, 0), > > > USB_REQ_SET_FEATURE, > > > > + USB_RECIP_DEVICE, USB_DEVICE_TEST_MODE, > > > > + selector << 8, NULL, 0, 1000); > > > > + > > > > + return count; > > > > +} > > > > +static DEVICE_ATTR(test, 0200, NULL, usb_testmode_store); > > > > > > As you have added a sysfs file, you HAVE to write the documentation for > > > it in a Documentation/ABI/ file. Please do that otherwise this will be > > > flat-out rejected. > > > > Thank you for your comments, I will fix it. > > > > > Also, are you sure you really want to do a file like this for all > > > USB devices? > > > > I think it is helpful to provide a method for a USB device to enter test > > mode, > and > > adding a file in sysfs can cover most devices. Is there any risk to > > implement it > like > > this? > > Can all devices support this mode? > According to USB2.0 spec, it is a must to support Test Mode for host controllers, hubs, and high-speed capable functions. I implemented the interface as spec described, but only verified on several devices.
> And as you are creating a user/kernel api, please get it accepted > upstream first. > OK, I'll send patch 2/2 to upstream first, then is patch 1/2 acceptable? Thanks, Andy _______________________________________________ MeeGo-kernel mailing list [email protected] http://lists.meego.com/listinfo/meego-kernel
