Skip to content

Commit

Permalink
HID: fix bug in zeroing the last field byte in output reports
Browse files Browse the repository at this point in the history
d4ae650 introduced zeroing of the
last field byte in output reports in order to make sure the unused
bits are set to 0. This is done in a wrong way, resulting in a
wrong bits being zeroed out (not properly shifted by the field offset
in the report). Fix this.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Jiri Kosina committed Mar 1, 2007
1 parent fdc9c56 commit 4237081
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ static void hid_output_field(struct hid_field *field, __u8 *data)

/* make sure the unused bits in the last byte are zeros */
if (count > 0 && size > 0)
data[(count*size-1)/8] = 0;
data[(offset+count*size-1)/8] = 0;

for (n = 0; n < count; n++) {
if (field->logical_minimum < 0) /* signed values */
Expand Down

0 comments on commit 4237081

Please sign in to comment.