Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
bec580f3
Commit
bec580f3
authored
Apr 12, 2021
by
Aleix Pol Gonzalez
🐧
Committed by
Aleix Pol Gonzalez
Apr 15, 2021
Browse files
udev: Add a method to get all properties of an UdevDevice
It's useful for debugging.
parent
01f7ef35
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/udev.cpp
View file @
bec580f3
...
...
@@ -256,6 +256,21 @@ const char *UdevDevice::property(const char *key)
return
udev_device_get_property_value
(
m_device
,
key
);
}
QMap
<
QByteArray
,
QByteArray
>
UdevDevice
::
properties
()
const
{
QMap
<
QByteArray
,
QByteArray
>
r
;
if
(
!
m_device
)
{
return
r
;
}
auto
it
=
udev_device_get_properties_list_entry
(
m_device
);
auto
current
=
it
;
udev_list_entry_foreach
(
current
,
it
)
{
r
.
insert
(
udev_list_entry_get_name
(
current
),
udev_list_entry_get_value
(
current
));
}
return
r
;
}
bool
UdevDevice
::
hasProperty
(
const
char
*
key
,
const
char
*
value
)
{
const
char
*
p
=
property
(
key
);
...
...
src/udev.h
View file @
bec580f3
...
...
@@ -34,6 +34,8 @@ public:
const
char
*
property
(
const
char
*
key
);
bool
hasProperty
(
const
char
*
key
,
const
char
*
value
);
QMap
<
QByteArray
,
QByteArray
>
properties
()
const
;
operator
udev_device
*
()
const
{
return
m_device
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment