Hi, Alan Stern wrote: > On Sun, 16 Apr 2006, Andre Draszik wrote: >> >> Alan Stern wrote: > > 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.
Yes, often the buffers are just some pointer into otherwise allocated memory. > 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. That sounds like a better plan than my extra kmalloc/kfree of a complete buffer... Have to see if I understand enough of the linux usb code already to implement this :) It will probably get a bit complicated with driver allocated DMA memory (URB_NO_SETUP/TRANSFER_DMA_MAP). Thanks! >>> (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. Well, this was a misunderstanding (or maybe I wasn't clear enough) - exactly what you write was one of my concerns that my current patch isn't really good. I am not happy with the patch I currently have and want to change this... :) Therefore I am in the middle of making it work the way you describe (i.e. change data while HCD has control over the URB). That's where I noticed the length % 4 issue. Greets, Andre' ------------------------------------------------------- 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