On Sun, 16 Apr 2006, Andre Draszik wrote: > Hi, > > Alan Stern wrote: > > On Tue, 11 Apr 2006, Andre' Draszik wrote: > > > > (1) You shouldn't need to change a class-based device driver such as > > usb-storage to work with your special host controller. Besides, > > if you need to change one then you need to change them all, and > > that hardly seems practical. Better to change your driver to > > make it work with all the existing code. > > Changing usb-storage was easy and worked because buffers are always a > multiple of 4 as I now found out. Other drivers provide other buffers > and thus I can't just swab32() bytes, I have to make sure buffersizes > are a multiple of 4, first which means to kmalloc()/kfree() memory to > compensate this, which seems impractical, too :( This seems to be the > reason why my patch was not working as expected.
You can rely on kmalloc always providing buffers whose actual length is divisible by 4. On the other hand, I/O buffers don't always start at the beginning of the kmalloc-ed buffer they belong to. In the end you may have to provide a special "overspill" buffer for each active endpoint, in which you store the contents of the last packet being sent to/from the endpoint. > > (2) The data structures that usb_fill_control_urb and > > usb_fill_bulk_urb create are pre-defined and well documented. > > In particular, the byte order is fixed and should not be > > changed. > > Yes, but this controller is really swab32()ing _all_ incoming and > outgoing data (in hardware), so this is unfortunately neccessary I fear. No it isn't. You _cannot_ change usb_fill_control_urb and usb_fill_bulk_urb because drivers are allowed to examine and modify the URB contents after using those macros and before calling usb_submit_urb. The most you can do is change the URB contents while your HCD has control over it, and then change them back before returning the URB. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&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