[Interest] USB support
Konrad Rosenbaum
konrad at silmor.de
Wed Apr 18 11:32:56 CEST 2018
Hi,
On Tue, April 17, 2018 16:39, Roland Hughes wrote:
> On 04/17/2018 09:15 AM, Thiago Macieira wrote:
>> On Monday, 16 April 2018 17:16:43 PDT Roland Hughes wrote:
>>> I know the answer may well be RTFD, but, has raw USB communications
>>> been
>>> more integrated or are the libusb examples from 2008 "current"?
>> Nothing changed since 2008. You need to run as root anyway, so it's not
>> a
>> functionality you should expect to see in Qt any time soon.
> Interesting.
>
> I don't see any mention of needing to be root here:
> And the current "official" site http://libusb.info
> It is user-mode: No special privilege or elevation is required for the
> application to communicate with a device.
You have 2 options: a) be root, b) setup a udev rule to make the USB
device accessible to other users.
I leave the task of guessing which one is recommended and which one
happens most often in practice up to you as a practice. ;-)
> Of course, root, for an embedded system, isn't much of an issue.
Yes, it is. You can destroy the device as root. UIs or complicated
calculations should never run as root.
> One
> would think that being a member of plugdev would give you USB access
> much like being a member of dialout gives you access to serial port.
One would think. But one would often be wrong.
> It does appear there should be some kind of support already there if one
> built the webengine
Just because WebEngine uses it does not mean you get a public API from
there. It actually means there is potential trouble since you may be
running with 2 instances of libusb.
> Can I run libusb applications on Linux without root privilege?
>
> Yes.
> The standard solution is to use udev rules. Here are some links to udev
> related websites.
Correct. It is pretty easy, once you've read a few of those files.
> Should prove to be an interesting experiment. I imagine a few dozen
> people have written their own QObject based wrapper class for that
> library but getting code contributed is monumentally impossible so they
> are all one-offs.
...and they are likely very project dependent.
Konrad
More information about the Interest
mailing list