From fb3f9e8559f3df2da84f317164ab18cdd26a0d34 Mon Sep 17 00:00:00 2001 From: Olivier Dormond Date: Sat, 30 May 2020 13:31:14 +0200 Subject: [PATCH] Fix set_absinfo to allow setting parameters to zero --- docs/changelog.rst | 6 ++++++ evdev/device.py | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8266989..07abba6 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,12 @@ Changelog --------- +Master +==================== + +- Fix ``InputDevice.set_absinfo`` to allow setting parameters to zero. + + 1.3.0 (Jan 12, 2020) ==================== diff --git a/evdev/device.py b/evdev/device.py index 94fa037..6949183 100644 --- a/evdev/device.py +++ b/evdev/device.py @@ -435,10 +435,10 @@ def set_absinfo(self, axis_num, value=None, min=None, max=None, fuzz=None, flat= ''' cur_absinfo = self.absinfo(axis_num) - new_absinfo = AbsInfo(value if value else cur_absinfo.value, - min if min else cur_absinfo.min, - max if max else cur_absinfo.max, - fuzz if fuzz else cur_absinfo.fuzz, - flat if flat else cur_absinfo.flat, - resolution if resolution else cur_absinfo.resolution) + new_absinfo = AbsInfo(value if value is not None else cur_absinfo.value, + min if min is not None else cur_absinfo.min, + max if max is not None else cur_absinfo.max, + fuzz if fuzz is not None else cur_absinfo.fuzz, + flat if flat is not None else cur_absinfo.flat, + resolution if resolution is not None else cur_absinfo.resolution) _input.ioctl_EVIOCSABS(self.fd, axis_num, new_absinfo)