Hello everyone, hello Randy, usually I don't post code into a mailinglist to reduce traffic, but you asked me and I am glad, someone is willing to help. Thank You! If we need even more code next time, I will upload it on a webpage.
> Von: Randy.Dunlap [mailto:rddunlap@;osdl.org] > Gesendet am: Mittwoch, 30. Oktober 2002 01:08 > > My questions thus far: > . can you post the host driver source code so that we can see it? > . what processor chip is in the target usb device? is it little or > big endian? So, here we are. In the attachment come a subset of all needed files. usbcphost.c and .h are all I needed to get a simple connection done. It's enough for testing, since I actually develop the device's side. descript.c and .h are out of the packet of source files for the device driver. The device uses an embedded linux, kernel 2.4.18, and a usb device chip Philips ISP1181A. On the host pc side I got a ASUS P4S533 with a SiS645DX chipset. Everything runs USB1.1. Let's take a look at the source code: "usbcphost" is the driver on the host side. It runs fine with other usb devices I developed with an Philips PDIUSBD12 chip and beside the strange probing and "lost" serialnumber I can send and receive data through it with the actual hardware also. It is almost the skeleton driver Greg did some day. I added "usb_cphost_ioctl" to get the serialnumber out of the device whenever I want it. In line 439 you will find a printk to show up this string. "descript.c": The part of sources for the device to do enumeration. In line 607 you find the logical and of 0x000f. If I leave it 0x00ff I get that error I mentioned before that sometimes wValue gets 0x03F5. In this file the descriptor struct is shown also. I guess that makes sense. (At least the USB-IF compliance test is satisfied in all tests.) The values for ConfigDescr.wTotallength is shown zero, but it is set dynamically and the value transmitted while enumeration is right (0x0020). So does the dynamically filled value of InterfaceDescr.bNumEndpoints. "descript.h": In line 127 I defined the string indices the way "I liked" it. With the combination #define STR_INDEX_CONFIGURATION 0x04 #define STR_INDEX_INTERFACE 0x05 #define STR_INDEX_SERIALNUMBER 0x03 I get this message in xconsole when I plug in the device: ... probing: idVendor=0x10D1, idProduct=0x0202 MGCplus (CP42/CP22) now attached to USBcphost0 device identification (serialnumber)=Interface 0 ... If I change in descript.h defines like this: #define STR_INDEX_CONFIGURATION 0x03 #define STR_INDEX_INTERFACE 0x04 #define STR_INDEX_SERIALNUMBER 0x05 I get: ... device identification (serialnumber)=CP42p00000 as I expected it to be. Be aware that I do the logical "wValue & 0x000f" to get any serialnumber. As you can see I do some DPRINT (printk) in descript.c. When it comes to line 608 it says: "wValue=0x0305" and within the succeeding setup packet (btw: why is it repeated?): "wValue=0x03F5". And ofcourse, if I do "wValue & 0x000f" I interpret this as unknown index and react with stall. So what's all about this F5? And why are there dependencies on the number for the indeces? I don't see any constants in usb.c either, but anyway, I get this strange messages. Ah. The USB analyzer shows no errors or bit stuffing errors. It also shows the strange request with wValue=0x03F5. Thank You for Your precious time! Siegfried.
usbcphost.h
Description: Binary data
usbcphost.c
Description: Binary data
descript.h
Description: Binary data
descript.c
Description: Binary data