Use sysfs on Linux when available
This change is the continuation of the previous:
* sha1: 4bdbbe4c87676ca94daae947ac5908d77966319b
The previous operation was to use the nodes in the "/dev" hierarchy.
The "sysfs" was only used for extending the information that cannot be
obtained from "/dev", like manufacturer, description of the device, etc.
This decision had a shortcoming of expansion of the list of filters in
case of appearance the new device with the new name. Besides, the Linux
kernel has a lot drivers, each of which provide a various names for an
serial devices, so we can't know all these names.
Now the sysfs is used directly, without filters. To search for devices
we use an appropriate "/sys/class/tty" directory that contains all
necessary info.
Notes:
* There are possible some regressions relating to enumeration of rfcomm,
ircomm devices. Because this devices can belong to other subsystems
which we do not process and skip at present. It needs to be checked and
submitted the set of next patches to fix it.
* If sysfs is not available, the fallback algorithm uses the "/dev"
hierarchy by having a predefined device entry list.
Tested on:
* Fedora 19 Desktop Edition (64-bit)
* Ubuntu 12.04.2 LTS (32-bit)
with on-board (PnP) and pluggable (USB) devices using Qt4 and then Qt5.
Change-Id: Ia242bb2ed81d17b6f826a187454bb9d2a12d40a9
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>