Detecting USB3 devices via UDisks2
Zygmunt Krynicki
zygmunt.krynicki at linaro.org
Thu Sep 20 12:45:30 PDT 2012
W dniu 20.09.2012 21:12, David Zeuthen pisze:
> 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.
Thanks a lot. I'll have a look at this.
> 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.
I'm porting the checkbox package. Checkbox is a hardware testing tool.
It depends on the UDisks1 property to check what's the advertised speed
of USB ports the machine may have. I wrote most other support code for
UDisks2 but that's one of the remaining pieces.
I have a document that describes what I'm doing and what needs to be
done to achieve it if you are interested [1] (google docs)
[1]:
https://docs.google.com/document/d/1tqcaJiGu15CgcZ-8ooGAH2CQirs2L82EqLvA8K1X69s/edit
--
Zygmunt Krynicki
s/Linaro Validation Team/Canonical Certification Team/
s/Validation/Android/
More information about the devkit-devel
mailing list