diff --git a/lib/libusbhid/data.c b/lib/libusbhid/data.c index 158e5016be5b..527871afd22f 100644 --- a/lib/libusbhid/data.c +++ b/lib/libusbhid/data.c @@ -1,4 +1,4 @@ -/* $NetBSD: data.c,v 1.6 2010/05/12 18:28:20 plunky Exp $ */ +/* $NetBSD: data.c,v 1.7 2016/01/01 22:59:12 jakllsch Exp $ */ /* * Copyright (c) 1999 Lennart Augustsson @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: data.c,v 1.6 2010/05/12 18:28:20 plunky Exp $"); +__RCSID("$NetBSD: data.c,v 1.7 2016/01/01 22:59:12 jakllsch Exp $"); #include #include @@ -57,10 +57,12 @@ hid_get_data(const void *p, const hid_item_t *h) for (i = 0; i < end; i++) data |= buf[offs + i] << (i*8); data >>= hpos % 8; - data &= (1 << hsize) - 1; - if (h->logical_minimum < 0 && (data & (1<<(hsize-1)))) { - /* Need to sign extend */ - data |= 0xffffffff & ~((1<logical_minimum < 0 && (data & (1<<(hsize-1)))) { + /* Need to sign extend */ + data |= 0xffffffff & ~((1< -__RCSID("$NetBSD: t_usbhid.c,v 1.2 2016/01/01 22:47:34 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.3 2016/01/01 22:59:12 jakllsch Exp $"); #include @@ -326,9 +326,6 @@ ATF_TC_BODY(check_hid_get_data, tc) int32_t data; uint32_t udat; - atf_tc_expect_fail("all negative data doesn't work, " - "all 32-bit data doesn't work"); - ATF_REQUIRE((hrd = hid_use_report_desc( range_test_report_descriptor, __arraycount(range_test_report_descriptor))) != NULL);