USB storage detachment / reattachment

Boris Mulder boris.mulder at ...434...
Fri Feb 10 14:12:18 CET 2017


Hi, I've stumbled upon a bit of a problem when using the usb driver
coupled with a usb_block driver component. As said:

> FWIW, there is an USB block storage driver [1] that uses the Usb raw
> session and can be used instead of the in-built storage driver of the
> usb_drv. A custom runtime/management component could monitor the
> usb_drv device report and spawn the whole stack if it detects a USB
> storage device. The usb_drv's device report does not contain the device
> class so far though but adding that to the report is easy.
Now, I'm spawning this usb block driver dynamically, which then tries to
connect to the usb driver. In my scenario, the usb driver is found, but
at some point the usb_block just hangs at the first time it reaches the
line:

iface.bulk_transfer(p, ep, block, &c);

(usb_block/main.cc line 308, called from line 432 as I verified with
print statements in the code)

the bulk_transfer method (with block=true) blocks indefinitely.

I do not know what causes this. I think it might be the usb interface
specified to the config of usb_block. The config passed to usb_block
looks like this:

<config label="usb-3-1" report="yes" writeable="yes" interface="0"
lun="0" />

Where usb-3-1 is the correct device label. Omitting the interface and
lun fields from the config gives the same error. the usb driver config
(which happens to be generated by a usb_report_filter) looks like this:

<config uhci="yes" ehci="yes" xhci="yes">
    <hid/>
    <raw>
    <report devices="yes"/>
    <policy label="media -> usb_blk -> usb-1-3" vendor_id="0x058f" product_id="0x6387" bus="0x0001" dev="0x0003"/>
    </raw>
</config>

Since the usb block driver gives the "Device plugged" message, I'd say
it is not because it cannot find the right device or driver or anything.
The config of the usb driver also allows usb_block to start a usb
session (otherwise the policy parser would have thrown an error).

Besides this, the usb driver gives "Could not read string descriptor
index: 0" warnings somewhere inside initialize() at line 365 of
usb_block. Otherwise, nothing is to be seen. This makes it look like the
usb_block is connected to the usb driver. Besides, no other components
are providing the usb service in my scenario. I am sure the usb stick
itself is formatted properly (it has worked for another scenario and in
linux as well).

Can anybody help me with this?

-- 

Met vriendelijke groet / kind regards,

Boris Mulder

Cyber Security Labs B.V. | Gooimeer 6-31 | 1411 DD Naarden | The Netherlands
+31 35 631 3253 (office)






More information about the users mailing list