-/* $OpenBSD: descr.c,v 1.7 2019/06/28 13:32:42 deraadt Exp $ */
+/* $OpenBSD: descr.c,v 1.8 2021/05/30 19:54:52 jcs Exp $ */
/* $NetBSD: descr.c,v 1.2 2002/02/20 20:31:07 christos Exp $ */
/*
free(r);
}
+
+void
+hid_get_report_desc_data(report_desc_t d, uint8_t **data, uint32_t *size)
+{
+ *data = d->data;
+ *size = d->size;
+}
-.\" $OpenBSD: usbhid.3,v 1.21 2020/10/24 10:33:44 jmc Exp $
+.\" $OpenBSD: usbhid.3,v 1.22 2021/05/30 19:54:52 jcs Exp $
.\" $NetBSD: usbhid.3,v 1.5 2002/02/07 07:00:52 ross Exp $
.\"
.\" Copyright (c) 1999, 2001 Lennart Augustsson <augustss@netbsd.org>
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 24 2020 $
+.Dd $Mdocdate: May 30 2021 $
.Dt USBHID 3
.Os
.Sh NAME
.Nm hid_get_report_desc ,
.Nm hid_use_report_desc ,
.Nm hid_dispose_report_desc ,
+.Nm hid_get_report_desc_data ,
.Nm hid_start_parse ,
.Nm hid_end_parse ,
.Nm hid_get_item ,
.Fn hid_use_report_desc "unsigned char *data" "unsigned int size"
.Ft void
.Fn hid_dispose_report_desc "report_desc_t d"
+.Ft void
+.Fn hid_get_report_desc_data "report_desc_t d" "uint8_t **data" "uint32_t *size"
.Ft hid_data_t
.Fn hid_start_parse "report_desc_t d" "int kindset" "int id"
.Ft void
device.
Alternatively a data buffer containing the report descriptor can be passed into
.Fn hid_use_report_desc .
-The data is copied into an internal structure.
+The data is copied into an internal structure which can be accessed with
+.Fn hid_get_report_desc_data .
When the report descriptor is no longer needed it should be freed by calling
.Fn hid_dispose_report_desc .
The type
-/* $OpenBSD: usbhid.h,v 1.8 2016/01/09 04:14:42 jcs Exp $ */
+/* $OpenBSD: usbhid.h,v 1.9 2021/05/30 19:54:52 jcs Exp $ */
/* $NetBSD: usbhid.h,v 1.1 2001/12/28 17:45:27 augustss Exp $ */
/*
report_desc_t hid_get_report_desc(int file);
report_desc_t hid_use_report_desc(unsigned char *data, unsigned int size);
void hid_dispose_report_desc(report_desc_t);
+void hid_get_report_desc_data(report_desc_t, uint8_t **, uint32_t *);
/* Parsing of a HID report descriptor, parse.c: */
hid_data_t hid_start_parse(report_desc_t d, int kindset, int id);