X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-core.c;h=62e21cc739381e314908bbd0d6e971a303a11c56;hb=019a67555857d33b34b105774acb3d2f59553424;hp=1cca32f46947e0675ea7b77ea28b043393ef3f75;hpb=8da7d1bae512aee155ef02f7ab1266358842e1fd;p=powerpc.git diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 1cca32f469..62e21cc739 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -4,7 +4,7 @@ * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2005 Vojtech Pavlik * Copyright (c) 2005 Michael Haboustak for Concept2, Inc - * Copyright (c) 2006 Jiri Kosina + * Copyright (c) 2006-2007 Jiri Kosina */ /* @@ -37,7 +37,7 @@ */ #define DRIVER_VERSION "v2.6" -#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik" +#define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik, Jiri Kosina" #define DRIVER_DESC "HID core driver" #define DRIVER_LICENSE "GPL" @@ -872,8 +872,13 @@ static void hid_output_field(struct hid_field *field, __u8 *data) unsigned count = field->report_count; unsigned offset = field->report_offset; unsigned size = field->report_size; + unsigned bitsused = offset + count * size; unsigned n; + /* make sure the unused bits in the last byte are zeros */ + if (count > 0 && size > 0 && (bitsused % 8) != 0) + data[(bitsused-1)/8] &= (1 << (bitsused % 8)) - 1; + for (n = 0; n < count; n++) { if (field->logical_minimum < 0) /* signed values */ implement(data, offset + n * size, size, s32ton(field->value[n], size));