Detecting USB3 devices via UDisks2

David Zeuthen zeuthen at gmail.com
Thu Sep 20 12:12:34 PDT 2012


Hi,

On Thu, Sep 20, 2012 at 1:45 PM, Zygmunt Krynicki
<zygmunt.krynicki at linaro.org> wrote:
> Looking at UDisks2 API there is no apparent property that would encode it.

It's true that in udisks 1.x there was

 http://hal.freedesktop.org/docs/udisks/Device.html#Device:DriveConnectionSpeed

but if you think about it, we just can't really reliably tell - just
for USB, there could be (slow) USB hubs, Ethernet/IP or anything
inbetween (think Spice and USB redirection). For other interconnects
there could be other things such as SAS expanders, SATA port
multipliers, FC switches, IP / Ethernet. Anything, really.

So that's why that thing isn't in udisks 2.x. We just can't reliably tell.

> Do I understand correctly that I need to monitor udev manually and poke at
> sysfs to read the appropriate speed file? Is there a better/cleaner way to
> achieve the same result.

Yeah, you need to look at sysfs and possibly the entire interconnect
as well. Shouldn't be that hard, really, use

 http://www.freedesktop.org/software/systemd/gudev/GUdevClient.html#g-udev-client-query-by-device-file

and then use

 http://www.freedesktop.org/software/systemd/gudev/GUdevDevice.html#g-udev-device-get-parent-with-subsystem

to get the USB parent in question.

It's hard to give advice without knowing what you are trying to
achieve - but as a general sentiment, I would suggest that you
redesign your application so you don't need to convey the "speed" of
the device - most of the time it just isn't very reliable information
- and even if it was, I'm not entirely sure the user thinks that it's
_useful_ information. So there's that.

   David


More information about the devkit-devel mailing list