parser.c (4610e4a0) parser.c (d73ae94e)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29/*
30 * Descriptor parsing functions
31 */

--- 260 unchanged lines hidden (view full) ---

292 bcopy(&default_cfg_power, ret_descr, USBA_CFG_PWR_DESCR_SIZE);
293
294 return (ret_descr->bLength);
295
296}
297
298
299size_t
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28/*
29 * Descriptor parsing functions
30 */

--- 260 unchanged lines hidden (view full) ---

291 bcopy(&default_cfg_power, ret_descr, USBA_CFG_PWR_DESCR_SIZE);
292
293 return (ret_descr->bLength);
294
295}
296
297
298size_t
299usb_parse_ia_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */
300 size_t buflen,
301 size_t first_if,
302 usb_ia_descr_t *ret_descr,
303 size_t ret_buf_len)
304{
305 uchar_t *bufend = buf + buflen;
306
307 if ((buf == NULL) || (ret_descr == NULL)) {
308
309 return (USB_PARSE_ERROR);
310 }
311
312 while (buf + USB_IA_DESCR_SIZE <= bufend) {
313 if ((buf[1] == USB_DESCR_TYPE_IA) &&
314 (buf[2] == first_if)) {
315
316 return (usb_parse_data("cccccccc",
317 buf, bufend - buf, ret_descr, ret_buf_len));
318 }
319
320 /*
321 * Check for a bad buffer.
322 * If buf[0] is 0, then this will be an infinite loop
323 */
324 INCREMENT_BUF(buf);
325 }
326
327 return (USB_PARSE_ERROR);
328}
329
330
331size_t
300usb_parse_if_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */
301 size_t buflen,
302 uint_t if_number,
303 uint_t alt_if_setting,
304 usb_if_descr_t *ret_descr,
305 size_t ret_buf_len)
306{
307 uchar_t *bufend = buf + buflen;

--- 275 unchanged lines hidden ---
332usb_parse_if_descr(uchar_t *buf, /* from GET_DESCRIPTOR(CONFIGURATION) */
333 size_t buflen,
334 uint_t if_number,
335 uint_t alt_if_setting,
336 usb_if_descr_t *ret_descr,
337 size_t ret_buf_len)
338{
339 uchar_t *bufend = buf + buflen;

--- 275 unchanged lines hidden ---