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]

 



Greg,

86000 changes? These must be mostly done in drivers' space (at least more that 50%).

Here is what you have requested: diff -abBu testusb.c.original testusb.c > testusb_diff.txt

Please, find diff file attached.

Zoran

-----Original Message-----
From: Greg KH [mailto:greg@xxxxxxxxx] 
Sent: Saturday, January 21, 2012 3:03 PM
To: Stojsavljevic, Zoran
Cc: linux-usb@xxxxxxxxxxxxxxx
Subject: Re: Latest testusb.c, with my additions... While opening usbtest, what device should be opened?!


A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Sat, Jan 21, 2012 at 01:46:20PM +0000, Stojsavljevic, Zoran wrote:
> Hello Greg,
> 
> Here are my comments.
> 
> The kernel I am using from its Makefile:
> VERSION = 2
> PATCHLEVEL = 6
> SUBLEVEL = 34
> EXTRAVERSION = .10
> NAME = Sheep on Meth
> 
> Why do you think the version of this kernel is outdated. I don't think so!?

The 2.6.34 kernel was released in May of 2010.  There have been over
86000 changes to the kernel since then by the community, making what you are using pretty obsolete and unmemorable by us, the community.

Yes, there is a longterm stable release cycle for the 2.6.34 kernel, but that is merely backporting important fixes from upstream to this kernel, it is not up to date with regards to larger issues like interoperating with newer hardware and the like, which is what you are doing.

> The device on USB address 7 went away, but it came back upon new 
> registration and numeration, as device 8 (/proc/bus/usb/002/008). So 
> the original conditions are very true/correct. Please, do note that I 
> ran with:
> ./testusb -a  -t 0
> 
> Yes, I am trying to reach on target platform g_printer device, for 
> some reason I am not able to register g_zero on target (enumeration 
> process fails). But g_printer behaves very correctly. It should work 
> also with g_printer, as my understanding is.
> 
> I see that on my host the directory /sys/bus/usb/devices/2-2.1/ (which is printer gadget), structure:
> struct usb_device_descriptor {
>         __u8  bLength;
>         __u8  bDescriptorType;
>         __u16 bcdUSB;
>         __u8  bDeviceClass;
>         __u8  bDeviceSubClass;
>         __u8  bDeviceProtocol;
>         __u8  bMaxPacketSize0;
>         __u16 idVendor;
> 	__u16 idProduct;
>         __u16 bcdDevice;
>         __u8  iManufacturer;
>         __u8  iProduct;
> 	__u8  iSerialNumber;
>         __u8  bNumConfigurations;
> } __attribute__ ((packed));
> 
> Is initialized correctly.
> 
> Please, find attached diff text file between original and modified 
> version (Copyright (c) 2002 by David Brownell- * + * Copyright (c)
> 2010 by Samsung Electronics+ * Author: Michal Nazarewicz 
> <m.nazarewicz@xxxxxxxxxxx>).

Please use 'diff -u' so we can read it.

greg k-h
--------------------------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland 
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
--- testusb.c.original	2012-01-21 05:28:05.906634903 -0800

+++ testusb.c	2012-01-21 05:26:35.310634016 -0800

@@ -208,6 +208,23 @@

         if (dev.idVendor == 0x0525 && dev.idProduct == 0xa4a0)
                 return 0;
 
+        /*
+	 * -- 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
+	 */
+	/* "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;
+	}
+
         /* user mode subset of that */
         if (dev.idVendor == 0x0525 && dev.idProduct == 0xa4a4)
                 return testdev_ffs_ifnum(fd);

@@ -272,6 +289,11 @@

                 goto nomem;
 
         entry->name = strdup(name);
+	printf("Let me report Test Device %s!\n", entry->name);
+
+	// FIXME about usb speed here, assuming USB 2.0
+	entry->speed = USB_SPEED_HIGH;
+
         if (!entry->name) {
                 free(entry);
 nomem:

@@ -281,7 +303,7 @@
 
         entry->ifnum = ifnum;
 
-        /* FIXME ask usbfs what speed; update USBDEVFS_CONNECTINFO so
+        /*FIXME ask usbfs what speed; update USBDEVFS_CONNECTINFO so
          * it tells about high speed etc */
 
         fprintf(stderr, "%s speed\t%s\t%u\n",

@@ -301,6 +323,7 @@

         wrapper.ioctl_code = request;
         wrapper.data = param;
  
+	printf("Here is actual _ioctl system call: fd = %d, wrapper.ifno = %d, USBDEVFS_IOCTL = %lu request = %u\n", fd, ifno, USBDEVFS_IOCTL, request);
         return ioctl (fd, USBDEVFS_IOCTL, &wrapper);
 }
 
@@ -315,16 +338,21 @@

                 return 0;
         }
  
+	printf("Opened dev->name %s file with file descriptor %d\n", dev->name, fd);
 restart:
         for (i = 0; i < TEST_CASES; i++) {
                 if (dev->test != -1 && dev->test != i)
                         continue;
                 dev->param.test_num = i;
  
+		printf("Entering kernel ioctl system call with the following parameters:fd = %d, dev->ifnum = 0x%x, USBTEST_REQUEST = %lu, test number = %u, test = %u\n", fd, dev->ifnum, USBTEST_REQUEST, dev->param.test_num, dev->test);
                 status = usbdev_ioctl (fd, dev->ifnum,
                                 USBTEST_REQUEST, &dev->param);
-                if (status < 0 && errno == EOPNOTSUPP)
-                       continue;
+		printf("status = %d, errno = %d, error string = %s\n", status, errno, strerror(errno));
+		// for now iGNORE these
+		//    if (status < 0 && errno == EOPNOTSUPP)
+		//      continue;
+		// EOPNOTSUPP is 95
 
                 /* FIXME need a "syslog it" option for background testing */
 

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

  Powered by Linux