lenovo-dytc: Use new gudev helper

This commit is contained in:
Bastien Nocera 2020-09-15 10:29:56 +02:00
parent b219d729d7
commit 7f74321381
3 changed files with 13 additions and 17 deletions

View file

@ -14,12 +14,23 @@ variables:
python3-gobject
python3-dbusmock
umockdev
make
automake
autoconf
libtool
pkgconfig(libudev)
build_stable:
before_script:
- dnf upgrade -y --nogpgcheck fedora-release fedora-repos*
- dnf update -y && dnf install -y $DEPENDENCIES
script:
# For when gudev gets updated/released
- git clone https://gitlab.gnome.org/GNOME/libgudev.git
- cd libgudev
- ./autogen.sh --prefix=/usr --disable-umockdev -disable-dependency-tracking
- make install
- cd ..
- meson -Dgtk_doc=true -Dgtk-tests=true _build
- ninja -v -C _build
- ninja -v -C _build install

View file

@ -35,7 +35,7 @@ if systemd_system_unit_dir == 'auto'
systemd_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
endif
gio_dep = dependency('gio-2.0')
gudev_dep = dependency('gudev-1.0', version: '>= 232')
gudev_dep = dependency('gudev-1.0', version: '>= 234')
upower_dep = dependency('upower-glib')
gnome = import('gnome')

View file

@ -45,21 +45,6 @@ ppd_driver_lenovo_dytc_constructor (GType type,
return object;
}
static gboolean
sysfs_attr_as_boolean (GUdevDevice *device,
const char *attribute)
{
g_autofree char *contents = NULL;
g_autofree char *filename = NULL;
filename = g_build_filename (g_udev_device_get_sysfs_path (device), attribute, NULL);
if (!g_file_get_contents (filename, &contents, NULL, NULL))
return FALSE;
g_strdelimit (contents, "\n", '\0');
return (g_strcmp0 (contents, "1") == 0);
}
static const char *
profile_to_perfmode_value (PpdProfile profile)
{
@ -80,7 +65,7 @@ update_dytc_state (PpdDriverLenovoDytc *dytc)
{
gboolean new_lapmode;
new_lapmode = sysfs_attr_as_boolean (dytc->device, LAPMODE_SYSFS_NAME);
new_lapmode = g_udev_device_get_sysfs_attr_as_boolean_uncached (dytc->device, LAPMODE_SYSFS_NAME);
if (new_lapmode != dytc->lapmode) {
dytc->lapmode = new_lapmode;
g_debug ("dytc_lapmode is now %s, so profile is %s",