summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/io/usb/usba/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/io/usb/usba/parser.c')
-rw-r--r--usr/src/uts/common/io/usb/usba/parser.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/usr/src/uts/common/io/usb/usba/parser.c b/usr/src/uts/common/io/usb/usba/parser.c
index e6d1893ebe..f4e0af84e5 100644
--- a/usr/src/uts/common/io/usb/usba/parser.c
+++ b/usr/src/uts/common/io/usb/usba/parser.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -297,6 +296,39 @@ usba_parse_cfg_pwr_descr(
size_t
+usb_parse_ia_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */
+ size_t buflen,
+ size_t first_if,
+ usb_ia_descr_t *ret_descr,
+ size_t ret_buf_len)
+{
+ uchar_t *bufend = buf + buflen;
+
+ if ((buf == NULL) || (ret_descr == NULL)) {
+
+ return (USB_PARSE_ERROR);
+ }
+
+ while (buf + USB_IA_DESCR_SIZE <= bufend) {
+ if ((buf[1] == USB_DESCR_TYPE_IA) &&
+ (buf[2] == first_if)) {
+
+ return (usb_parse_data("cccccccc",
+ buf, bufend - buf, ret_descr, ret_buf_len));
+ }
+
+ /*
+ * Check for a bad buffer.
+ * If buf[0] is 0, then this will be an infinite loop
+ */
+ INCREMENT_BUF(buf);
+ }
+
+ return (USB_PARSE_ERROR);
+}
+
+
+size_t
usb_parse_if_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */
size_t buflen,
uint_t if_number,