Re: [Interest] USB support

2018-04-18 Thread Konrad Rosenbaum
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

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] USB support

2018-04-17 Thread Roland Hughes



On 04/17/2018 09:15 AM, Thiago Macieira wrote:

On Monday, 16 April 2018 17:16:43 PDT Roland Hughes wrote:

All,

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:
http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/

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.


Of course, root, for an embedded system, isn't much of an issue. 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.


It does appear there should be some kind of support already there if one 
built the webengine


roland@roland-I5-HP-Compaq-8300-Elite-SFF-PC:/$ sudo find -iname libusb
./home/roland/qt5.7.1/qt-everywhere-opensource-src-5.7.1/qtwebengine/src/3rdparty/chromium/third_party/libusb
./home/roland/qt5.7.1/qt-everywhere-opensource-src-5.7.1/qtwebengine/src/3rdparty/chromium/third_party/libusb/src/libusb

Not sure if that is still around in 5.xx or 6.x but 5.7.1 appears to 
have included libusb 1.0.17


/* This file is parsed by m4 and windres and RC.EXE so please keep it simple. */
#include "version_nano.h"
#ifndef LIBUSB_MAJOR
#define LIBUSB_MAJOR 1
#endif

#ifndef LIBUSB_MINOR
#define LIBUSB_MINOR 0
#endif

#ifndef LIBUSB_MICRO
#define LIBUSB_MICRO 17
#endif

#ifndef LIBUSB_NANO
#define LIBUSB_NANO 0
#endif

/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
#ifndef LIBUSB_RC
#define LIBUSB_RC ""
#endif

ah
https://github.com/libusb/libusb/wiki/FAQ#Can_I_run_libusb_applications_on_Linux_without_root_privilege


 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.


 * udev homepage
   
 * Debian's udev overview 
 * Writing udev rules 
 * Proper place to ask questions about udev rules
   


 



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.



--
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us/
http://onedollarcontentstore.com

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] USB support

2018-04-16 Thread Thiago Macieira
On Monday, 16 April 2018 17:16:43 PDT Roland Hughes wrote:
> All,
> 
> 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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest