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]

 



On Sat, Jan 21, 2012 at 12:47:46PM +0000, Stojsavljevic, Zoran wrote:
> Hello Linux USB members,
> 
> Your name came to my attention while trying to test max3420 SPI USB
> driver on target platform, we in INTEL call it Moon Creek (N450 Atom +
> ICH8 PCH), kernel 2.6.34.10 running on this platform.

You do realize just how old and out of date that kernel is, and the fact
that we can't support you, or do anything about such an obsolete kernel
version here, right?

> The driver is properly configured and it does shows signs of
> activities on both host (and on the host I am using VMware Guest OS:
> Fedora 14 x86_64), which runs on VMware Player, installed on Win 7,
> and target (as mentioned).
> 
> I had an idea to test this whole thing with testusb.c using usbtest.c
> driver, but, apparently I am NOT able to reach _ioctl function on
> usbtest driver, which happily inserts into host Fedora 14 x86_64 .
> 
> Please, find attached both modified testusb.c and usbtest.c (which I
> compile externally as module using the host /lib/modules/$(shell uname
> -r)/build soft link which points to right kernel structure.
> As you see, I added to function static int testdev_ifnum(FILE *fd) printer gadget device:

Sorry, we can't see your changes, could you provide them in 'diff -u'
format so that we can?

>         /*
>                 * -- From /proc/bus/usb/devices file --
>                 *
>                 *    T:  Bus=02 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
>                 *    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
>                 *    P:  Vendor=0525 ProdID=a4a8 Rev= 2.27
>                 *    S:  Product=Printer Gadget
>                 *    C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
>                 *    I:* If#= 0 Alt= 0 #EPs= 1 Cls=07(print) Sub=01 Prot=02 Driver=(none)
>                 *    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
>                 */

so your device shows up properly, right?

>                 /* "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 0;
> }
> 
> As I mentioned, the problem is that I do NOT see _ioctl function on
> usbtest driver, which says to me that while opening it, I did NOT
> reach correct device!

That's probably true.

> When I insert usbtest.ko, I see it in sysfs: /sys/bus/usb/drivers/usbtest
> 
> The outcome of the whole thing is:
> [root@localhost modules_fedora-14-x86_14]# ./testusb -a  -t 0
> Found Test Device Vendor id 0x525 and Product Id 0xa4a8!
> Let me report Test Device /proc/bus/usb/002/008!
> high speed          /proc/bus/usb/002/008                0
> Opened dev->name /proc/bus/usb/002/008 file with file descriptor 3
> Entering kernel ioctl system call with the following parameters:fd = 3, dev->ifnum = 0x0, USBTEST_REQUEST = 3223868772, test number = 0, test = 0
> Here is actual _ioctl system call: fd = 3, wrapper.ifno = 0, USBDEVFS_IOCTL = 3222295826 request = 3223868772
> status = -1, errno = 25, error string = Inappropriate ioctl for device
> /proc/bus/usb/002/008 test 0 --> 25 (Inappropriate ioctl for device)
> [root@localhost modules_fedora-14-x86_14]#
> 
> It says that I opened device with the name /proc/bus/usb/002/008 which IS the USB device connected to target platform and correctly enumerated, whn the registration occurred (last few lines from the host dmesg);
> 
> [33735.851834] usb 2-2.1: USB disconnect, address 7

Your device went away.

> [96008.243718] usb 2-2.1: new full speed USB device using uhci_hcd and address 8
> [96008.387399] usb 2-2.1: config 1 interface 0 altsetting 0 has an invalid endpoint with address 0x0, skipping
> [96008.438092] usb 2-2.1: New USB device found, idVendor=0525, idProduct=a4a8
> [96008.438096] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> [96008.438098] usb 2-2.1: Product: Printer Gadget
> [96008.438116] usb 2-2.1: Manufacturer: Linux 2.6.34.10-WR4.3.0.0_standard with max_udc
> [96008.438118] usb 2-2.1: SerialNumber: 1
> 
> Question: what is the device which we should open to reach usb test driver? /proc/bus/usb/002/008? I don't think so!!!

Why not?

But let's get to your most basic issue here, what exactly are you trying
to do?  Why are you using the usbtest module for a printer device?

greg k-h
--
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