Passmark USB loopback test plugs

Felipe Balbi felipebalbi at
Wed Nov 21 11:28:03 UTC 2007

Hi Greg,

On Nov 20, 2007 5:06 PM, Greg KH <greg at> wrote:
> On Tue, Nov 20, 2007 at 04:24:19PM -0400, Felipe Balbi wrote:
> > >
> > > My question is _why_ does it need to be a kernel driver, why can't this
> > > all be done in userspace instead?
> >
> > On musb driver I was using a kernel driver with a sysfs interface and
> > a hacked usb cable with 1k resistor between D+/D- and a switchable
> > load between Vbus and GROUND (500mA and 100mA).
> > Of course this code is musb specific and shouldn't even get integrated
> > to linux-omap nor to mainline.
> Why not, have you posted it anywhere?  That sounds a bit useful to have,
> although why it too would need to be a kernel driver is a bit strange.

The driver was mainly written by Tony Lindgren, I re-worked it a bit
to include id-pin
test as well and you can get it from n800 linux kernel source posted by nokia at

One should wait until next release come up (OS2008) then you'll get
kernel 2.6.21.

> > Having a proper device for running loopback tests (it this is the same
> > loopback test I'm wondering :-p)
> > would allow us to provide "portable" code that would work with any
> > HCD, not only this or that one.
> Ah, I see, your hacked cable is not a "real" device that the HCD could
> discover at all.


> And have you looked at the usbtest module?  It already provides such a
> driver, that works for all HCDs today.

I think I was using it with a userspace app which I can't remember the name.

> > Using a sysfs interface (aka linux device driver), looks better to me,
> > and that's what I plan to do for USB HSET and USB Command Verifier
> > tools for linux. If you pay attention on windows, those tools provides
> > a different Host Controller Driver from where they can issue the
> > commands they want.
> Are you thinking to use sysfs to send USB commands to a device?  You do
> know that sysfs is not made for this, right?  :)

Yeah... and I'm not wondering to use this way. But a sysfs_*_show(),
i.e. cat sysfs entry,
start a test scenario which would internally handle all usb commands.
Or maybe echo testN > $sysfs_entry

> > Well, that's only my opinion. Userspace should only handle the results
> > reported by sysfs interfaces or whatever the driver wanna do.
> Again, at first glance, this driver looks like it can be written in
> userspace, using usbfs, without any kernel code at all.  That's my main
> question.

If it can be done completely in userspace with usbfs, I can't see why
not. But I can't also see
why not putting in the kernel and allowing users to build it as a module.

> thanks,
> greg k-h

Best Regards,

Felipe Balbi
felipebalbi at

More information about the devel mailing list