Let hid_locate() return the item flags as well as the position.

This commit is contained in:
augustss 1998-07-24 20:57:46 +00:00
parent 1ca186e04d
commit b79d954aac
2 changed files with 10 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hid.c,v 1.1 1998/07/12 19:51:59 augustss Exp $ */
/* $NetBSD: hid.c,v 1.2 1998/07/24 20:57:46 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -389,19 +389,23 @@ hid_report_size(buf, len, k, idp)
}
int
hid_locate(desc, size, u, k, loc)
hid_locate(desc, size, u, k, loc, flags)
void *desc;
int size;
u_int32_t u;
enum hid_kind k;
struct hid_location *loc;
u_int32_t *flags;
{
struct hid_data *d;
struct hid_item h;
for (d = hid_start_parse(desc, size, 1<<k); hid_get_item(d, &h); ) {
if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) {
*loc = h.loc;
if (loc)
*loc = h.loc;
if (flags)
*flags = h.flags;
hid_end_parse(d);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hid.h,v 1.1 1998/07/12 19:51:59 augustss Exp $ */
/* $NetBSD: hid.h,v 1.2 1998/07/24 20:57:46 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -83,6 +83,7 @@ void hid_end_parse __P((struct hid_data *s));
int hid_get_item __P((struct hid_data *s, struct hid_item *h));
int hid_report_size __P((void *buf, int len, enum hid_kind k, u_int8_t *id));
int hid_locate __P((void *desc, int size, u_int32_t usage,
enum hid_kind kind, struct hid_location *loc));
enum hid_kind kind, struct hid_location *loc,
u_int32_t *flags));
u_long hid_get_data __P((u_char *buf, struct hid_location *loc));
int hid_is_collection __P((void *desc, int size, u_int32_t usage));