RE: Latest testusb.c, with my additions... While opening usbtest, what device should be opened?!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please tell your email client to fold long lines after 72 columns or 
so.  It will make replying a lot easier.

On Tue, 24 Jan 2012, Stojsavljevic, Zoran wrote:

> Hello Alan,
> 
> After I successfully reached stage where I start hiting usbtest.ko's _ioctl, another problem poped up.
> 
> It is obvious that test0 worked (./testusb -a -t 0), but none of other tests did not worked at all, and they had early bail out.
> 
> I peeked around to understand why. It appear that in case 1, case 2, case 3... dev->out_pipe = 0, so it breaks right here.
> 
> The code in _ioctl:
> /* Simple non-queued bulk I/O tests */
>         case 1:
>                 if (dev->out_pipe == 0)
>                         break;
>                 dev_info(&intf->dev,
>      
> Now, I am wondering what this statement really means? Maybe in other words... dev->out_pipe = ep0 which is 0!? Does this mean that ep0 should NOT be used for these tests?

It means what it says, not what you imagine.  A pipe value is not the
same thing as an endpoint number.  In this case, out_pipe == 0 means
the device does not have a bulk-OUT endpoint; it has nothing to do with
ep0.  You should look at the code where dev->out_pipe gets set.

And of course ep0 is not used for these tests!  Didn't you read the 
comment you quoted above?  It says "bulk I/O tests" -- ep0 is not a 
bulk endpoint.

> I am testing max SPI USB Linux driver, which supposed to have all 4 endpoints implemented: ep0 to ep3. 

The number of endpoints doesn't matter.  What matters is their type and 
direction.  usbtest looks for bulk-IN and bulk-OUT.

> On the another side of the story, I do insert usbtest with modprobe usb_test vendor=0x0525 product=0xa4a8
> 
> But in modified testusb code I did insert in testdev_ifnum(FILE *fd) the following:
> 
>         /* "printer gadget", Linux-USB test software */
>         if (dev.idVendor == 0x0525 && dev.idProduct == 0xa4a8) {
> 		printf("Found Test Device Vendor id 0x%x and Product Id 0x%x!\n", dev.idVendor, dev.idProduct);
>                 /* return testdev_ffs_ifnum(fd); */
>                 return 0;
>         }
> 
> Should I try to return testdev_ffs_ifnum(fd) instead of 0? And what does this I/F number mean? The index of device (if more devices that 1)?

I have no idea what testdev_ifnum() or testdev_ffs_ifnum() are supposed 
to do.  There's nothing like either of them in my copy of testusb.c.

"ifnum" (or "I/F number") is short for "interface number".  USB devices
have interfaces, and ifnum is the number of the interface the code will
use.  If you don't understand what interfaces are and how they work
then you need to read up on the basics of USB before you try to do any
more programming.

> From what I see, the SPI USB target driver (which usbtest binds to) has some problems, and I am trying to detect what kind of nature are these problems??

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux