Deleted Added
full compact
usb_template.c (190749) usb_template.c (191402)
1/* $FreeBSD: head/sys/dev/usb/template/usb_template.c 190749 2009-04-05 21:24:15Z piso $ */
1/* $FreeBSD: head/sys/dev/usb/template/usb_template.c 191402 2009-04-22 17:08:16Z thompsa $ */
2/*-
3 * Copyright (c) 2007 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

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

76static void *usb2_temp_get_qualifier_desc(struct usb2_device *);
77static void *usb2_temp_get_config_desc(struct usb2_device *, uint16_t *,
78 uint8_t);
79static const void *usb2_temp_get_string_desc(struct usb2_device *, uint16_t,
80 uint8_t);
81static const void *usb2_temp_get_vendor_desc(struct usb2_device *,
82 const struct usb2_device_request *);
83static const void *usb2_temp_get_hub_desc(struct usb2_device *);
2/*-
3 * Copyright (c) 2007 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

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

76static void *usb2_temp_get_qualifier_desc(struct usb2_device *);
77static void *usb2_temp_get_config_desc(struct usb2_device *, uint16_t *,
78 uint8_t);
79static const void *usb2_temp_get_string_desc(struct usb2_device *, uint16_t,
80 uint8_t);
81static const void *usb2_temp_get_vendor_desc(struct usb2_device *,
82 const struct usb2_device_request *);
83static const void *usb2_temp_get_hub_desc(struct usb2_device *);
84static void usb2_temp_get_desc(struct usb2_device *,
84static usb2_error_t usb2_temp_get_desc(struct usb2_device *,
85 struct usb2_device_request *, const void **, uint16_t *);
86static usb2_error_t usb2_temp_setup(struct usb2_device *,
87 const struct usb2_temp_device_desc *);
88static void usb2_temp_unsetup(struct usb2_device *);
89static usb2_error_t usb2_temp_setup_by_index(struct usb2_device *,
90 uint16_t index);
91static void usb2_temp_init(void *);
92

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

1067}
1068
1069/*------------------------------------------------------------------------*
1070 * usb2_temp_get_desc
1071 *
1072 * This function is a demultiplexer for local USB device side control
1073 * endpoint requests.
1074 *------------------------------------------------------------------------*/
85 struct usb2_device_request *, const void **, uint16_t *);
86static usb2_error_t usb2_temp_setup(struct usb2_device *,
87 const struct usb2_temp_device_desc *);
88static void usb2_temp_unsetup(struct usb2_device *);
89static usb2_error_t usb2_temp_setup_by_index(struct usb2_device *,
90 uint16_t index);
91static void usb2_temp_init(void *);
92

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

1067}
1068
1069/*------------------------------------------------------------------------*
1070 * usb2_temp_get_desc
1071 *
1072 * This function is a demultiplexer for local USB device side control
1073 * endpoint requests.
1074 *------------------------------------------------------------------------*/
1075static void
1075static usb2_error_t
1076usb2_temp_get_desc(struct usb2_device *udev, struct usb2_device_request *req,
1077 const void **pPtr, uint16_t *pLength)
1078{
1079 const uint8_t *buf;
1080 uint16_t len;
1081
1082 buf = NULL;
1083 len = 0;

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

1152 if (buf == NULL) {
1153 goto tr_stalled;
1154 }
1155 if (len == 0) {
1156 len = buf[0];
1157 }
1158 *pPtr = buf;
1159 *pLength = len;
1076usb2_temp_get_desc(struct usb2_device *udev, struct usb2_device_request *req,
1077 const void **pPtr, uint16_t *pLength)
1078{
1079 const uint8_t *buf;
1080 uint16_t len;
1081
1082 buf = NULL;
1083 len = 0;

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

1152 if (buf == NULL) {
1153 goto tr_stalled;
1154 }
1155 if (len == 0) {
1156 len = buf[0];
1157 }
1158 *pPtr = buf;
1159 *pLength = len;
1160 return;
1160 return (0); /* success */
1161
1162tr_stalled:
1163 *pPtr = NULL;
1164 *pLength = 0;
1161
1162tr_stalled:
1163 *pPtr = NULL;
1164 *pLength = 0;
1165 return (0); /* we ignore failures */
1165}
1166
1167/*------------------------------------------------------------------------*
1168 * usb2_temp_setup
1169 *
1170 * This function generates USB descriptors according to the given USB
1171 * template device descriptor. It will also try to figure out the best
1172 * matching endpoint addresses using the hardware endpoint profiles.

--- 139 unchanged lines hidden ---
1166}
1167
1168/*------------------------------------------------------------------------*
1169 * usb2_temp_setup
1170 *
1171 * This function generates USB descriptors according to the given USB
1172 * template device descriptor. It will also try to figure out the best
1173 * matching endpoint addresses using the hardware endpoint profiles.

--- 139 unchanged lines hidden ---