I am new to driver and want to modify the bulkusb example to talk to our
device.
The problem is that when the driver receives the raw data from the user
space, I need to add a header to it before sending the data to the device.
In BulkUsb_DispatchReadWrite(), it calls the IoBuildPartialMdl to map the
user mdl directly to the URB mdl allocated by the driver. In my case, i want
the new URB mdl to include a header and then the data described by the user
mdl.
I cannot figure out how to do this with MDL manipulation.
I thought about allocate a buffer in the driver and fill it with the header
and the data described by the user mdl. Then create the new URB mdl from this
buffer.
However, it would be great if I can avoid this extra copy with MDL
manipulation.
Thanks in advance.
cheers,
now with that said, the underlying usb host controller stack does not
support chained MDLs, so you cannot prepend your header without a full
memory copy. the simplest solution is to allocate a buffer large enough for
your app's buffer + the header, copy the user's buffer, initialize the
header and send the buffer down in an URB as is (let the underlying bus
allocate the PMDL for you, the PMDL in this case does not buy you anything).
d
"mudehuai" <mude...@discussions.microsoft.com> wrote in message
news:446AE0D1-31D6-4B9D...@microsoft.com...