memcpy instead of invidual bittoggle
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 29 Aug 2013 05:52:54 +0000 (15:52 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 30 Aug 2013 23:40:17 +0000 (09:40 +1000)
commit4417a6a1c1e2202741f6ed7dffc1b092ee57ed96
treed64b342677ebda3b58a644ff23f4d17a7b18f0e3
parente372c4a6bd82026aecf615062871818e989c6484
memcpy instead of invidual bittoggle

The ioctls return the number of bytes copied into the destination, so just
copy them into the device state instead of individually flipping bits.

For easier review: rc is the return value of the EVIOCG* ioctl, which is
the number of bytes copied.

state variables must be initialized to 0 now, in case the kernel's FOO_MAX
is smaller than libevdev's FOO_MAX. If not initialized to 0, the bytes
between the two max values is undefined and we may end up generating bogus
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
libevdev/libevdev.c