mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
On Linux, skip virtual ttys that have no parent device.
This commit is contained in:
parent
8683177b9d
commit
08fe0bdbdb
@ -176,7 +176,7 @@ out_release:
|
|||||||
struct udev_list_entry *ud_list;
|
struct udev_list_entry *ud_list;
|
||||||
struct udev_list_entry *ud_entry;
|
struct udev_list_entry *ud_entry;
|
||||||
const char *path;
|
const char *path;
|
||||||
struct udev_device *ud_dev;
|
struct udev_device *ud_dev, *ud_parent;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
ud = udev_new();
|
ud = udev_new();
|
||||||
@ -190,6 +190,13 @@ out_release:
|
|||||||
{
|
{
|
||||||
path = udev_list_entry_get_name(ud_entry);
|
path = udev_list_entry_get_name(ud_entry);
|
||||||
ud_dev = udev_device_new_from_syspath(ud, path);
|
ud_dev = udev_device_new_from_syspath(ud, path);
|
||||||
|
/* If there is no parent device, this is a virtual tty. */
|
||||||
|
ud_parent = udev_device_get_parent(ud_dev);
|
||||||
|
if (ud_parent == NULL)
|
||||||
|
{
|
||||||
|
udev_device_unref(ud_dev);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
name = udev_device_get_devnode(ud_dev);
|
name = udev_device_get_devnode(ud_dev);
|
||||||
list = sp_list_append(list, (void *)name, strlen(name) + 1);
|
list = sp_list_append(list, (void *)name, strlen(name) + 1);
|
||||||
udev_device_unref(ud_dev);
|
udev_device_unref(ud_dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user