[PATCH evemu 1/5] Actually set the version field
Benjamin Tissoires
benjamin.tissoires at gmail.com
Mon Nov 11 13:47:40 PST 2013
On Thu, Oct 24, 2013 at 2:03 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> evemu_new would set the version but the memset in evemu_read() resets it to 0.
> afaict from the history, this has never worked but great that we had a tests
> that made sure that the broken behaviour passed...
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> python/evemu/tests/test_device.py | 2 +-
> src/evemu.c | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/python/evemu/tests/test_device.py b/python/evemu/tests/test_device.py
> index 3e207e0..e942af9 100644
> --- a/python/evemu/tests/test_device.py
> +++ b/python/evemu/tests/test_device.py
> @@ -141,7 +141,7 @@ class DevicePropertiesTestCase(testcase.BaseTestCase):
> super(DevicePropertiesTestCase, self).tearDown()
>
> def test_version(self):
> - self.assertEqual(self._device.version, 0)
> + self.assertEqual(self._device.version, 0x10000)
>
> def test_name(self):
> self.assertEqual(self._device.name, "N-Trig-MultiTouch-Virtual-Device")
> diff --git a/src/evemu.c b/src/evemu.c
> index 4a05d2e..039038e 100644
> --- a/src/evemu.c
> +++ b/src/evemu.c
> @@ -556,6 +556,7 @@ int evemu_read(struct evemu_device *dev, FILE *fp)
> char *line = NULL;
>
> memset(dev, 0, sizeof(*dev));
> + dev->version = EVEMU_VERSION;
I would say that half of the job is done here. Shouldn't we also keep
track of the name of the device?
It seems that evemu_read() is called after "dev = evemu_new(name);"
in evemu-device.c, so I think we should also keep the name.
Cheers,
Benjamin
>
> /* first line _may_ be version */
> if (!first_line(fp, &line, &size)) {
> --
> 1.8.3.1
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools
More information about the Input-tools
mailing list