On Sat, 15 May 2004, fengwei yin wrote: > >You have to do this for _all_ the data you send to or receive from _every_ > >USB device? > > Yes,I think all the data send/receive from USB device will be swap. > > > What happens if the transfer buffer length isn't a multiple > >of 4? > > Sorry,I don't know how to set transfer buffer length(It should be in device > driver?).
That's right, it is set by the device driver, not the controller driver. Suppose the device driver wants to send 3 bytes: "ABC". The controller driver needs to reverse that into "\000CBA" but it can't, because the buffer is only 3 bytes long and it needs 4 bytes. So what do you do? > Is there any difference between internal hub and external hub? > I found that they ALL used usb_control_msg to get port status. > So I thought that they(in/external hub) ALl were treated as USB device. > Am I right? No. The hub driver does use usb_control_msg() to get the port status, that much is right. For external hubs, this results in a USB message sent to the hub and its response received in the transfer buffer. But that doesn't happen with the internal hub. With the internal hub, the HCD reads the port status from the controller's registers and stores the values directly into the transfer buffer. There's no USB communication involved. All this happens in rh_submit_urb() in usb-ohci.c. The part of interest to you is these two lines: case RH_GET_STATUS | RH_OTHER | RH_CLASS: *(__u32 *) data_buf = cpu_to_le32 (RD_RH_PORTSTAT); OK (4); My guess is that the data fetched by RD_RH_PORTSTAT comes from the controller in the wrong format. Then you interchange the wPortStatus and wPortChanged fields so it looks right -- but then everything from an external hub looks wrong. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel