Hi Greg, > > I recently found out an endianess issue in a USB driver I'm developing. > > While browsing through the USB stack code to find where the problem comes > > from, I found what I think to be a mistake in the > > usb_get_device_descriptor() function documentation. > > > > /* > > * usb_get_device_descriptor - (re)reads the device descriptor (usbcore) > > * @dev: the device whose device descriptor is being updated > > * @size: how much of the descriptor to read > > * Context: !in_interrupt () > > * > > * Updates the copy of the device descriptor stored in the device > > structure, * which dedicates space for this purpose. Note that several > > fields are * converted to the host CPU's byte order: the USB version > > (bcdUSB), and * vendors product and version fields (idVendor, idProduct, > > and bcdDevice). * That lets device drivers compare against > > non-byteswapped constants. * > > * Not exported, only for use by the core. If drivers really want to > > read * the device descriptor directly, they can call usb_get_descriptor() > > with * type = USB_DT_DEVICE and index = 0. > > * > > * This call is synchronous, and may not be used in an interrupt context. > > * > > * Returns the number of bytes received on success, or else the status > > code * returned by the underlying usb_control_msg() call. > > */ > > > > After reading the code I can't find any place where the bcdUSB, idVendor, > > idProduct and bcdDevice fields are converted to host CPU's byte order. > > > > Could anyone confirm ? If so, the documentation should be fixed. > > Yes, I forgot to update the documentation when I made the change to the > code, very sorry about that. > > Please feel free to send a patch for this.
I've already sent a patch on the list on 2006-10-25. The e-mail subject was [linux-usb-devel] [PATCH] USB: Fixed outdated usb_get_device_descriptor() documentation Should I send it again ? Laurent Pinchart ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel