\hypertarget{usb__handle__request_8c_source}{}\doxysection{usb\+\_\+handle\+\_\+request.\+c}
\label{usb__handle__request_8c_source}\index{dev/usb/usb\_handle\_request.c@{dev/usb/usb\_handle\_request.c}}
\mbox{\hyperlink{usb__handle__request_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00001}00001 \textcolor{comment}{/* \$FreeBSD\$ */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00002}00002 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00003}00003 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00004}00004 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00029}00029 \textcolor{preprocessor}{\#ifdef USB\_GLOBAL\_INCLUDE\_FILE}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00030}00030 \textcolor{preprocessor}{\#include USB\_GLOBAL\_INCLUDE\_FILE}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00031}00031 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/stdint.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/stddef.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/queue.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/types.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/bus.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/condvar.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/sx.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/unistd.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/callout.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/priv.h>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb_8h}{dev/usb/usb.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi_8h}{dev/usb/usbdi.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usbdi__util_8h}{dev/usb/usbdi\_util.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00054}00054 \textcolor{preprocessor}{\#include "{}usb\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00056}\mbox{\hyperlink{usb__handle__request_8c_a927dd6f59caf10a2991dfb564bcbb1e1}{00056}} \textcolor{preprocessor}{\#define USB\_DEBUG\_VAR usb\_debug}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00057}00057 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__core_8h}{dev/usb/usb\_core.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__process_8h}{dev/usb/usb\_process.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00060}00060 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__busdma_8h}{dev/usb/usb\_busdma.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00061}00061 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__transfer_8h}{dev/usb/usb\_transfer.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00062}00062 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__device_8h}{dev/usb/usb\_device.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__debug_8h}{dev/usb/usb\_debug.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00064}00064 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__dynamic_8h}{dev/usb/usb\_dynamic.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00065}00065 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__hub_8h}{dev/usb/usb\_hub.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00067}00067 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__controller_8h}{dev/usb/usb\_controller.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00068}00068 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{usb__bus_8h}{dev/usb/usb\_bus.h}}>}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00069}00069 \textcolor{preprocessor}{\#endif                  }\textcolor{comment}{/* USB\_GLOBAL\_INCLUDE\_FILE */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00071}00071 \textcolor{comment}{/* function prototypes */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00073}00073 \textcolor{keyword}{static} uint8\_t \mbox{\hyperlink{usb__handle__request_8c_a237fa4ab951e3672f4bc704b2c3dceac}{usb\_handle\_get\_stall}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device}{usb\_device}} *, uint8\_t);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00074}00074 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}    \mbox{\hyperlink{usb__handle__request_8c_a0bdb5b1818430bcc50a67f5f62bc6632}{usb\_handle\_remote\_wakeup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *, uint8\_t);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00075}00075 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}    \mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{usb\_handle\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00076}00076 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}    \mbox{\hyperlink{usb__handle__request_8c_a49bce512da7cbe3b77000bedd407cfd2}{usb\_handle\_set\_config}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *, uint8\_t);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00077}00077 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}    \mbox{\hyperlink{usb__handle__request_8c_aae8242393a914fddecf1608a5d6bd2e7}{usb\_handle\_set\_stall}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *, uint8\_t,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00078}00078                             uint8\_t);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00079}00079 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}    \mbox{\hyperlink{usb__handle__request_8c_ab41af7ca7d79f5e895cee03ddd74dc01}{usb\_handle\_iface\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *, \textcolor{keywordtype}{void} **,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00080}00080                             uint16\_t *, \textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device__request}{usb\_device\_request}}, uint16\_t,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00081}00081                             uint8\_t);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00082}00082 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00083}00083 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00084}00084 \textcolor{comment}{ *      usb\_handle\_request\_callback}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00085}00085 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00086}00086 \textcolor{comment}{ * This function is the USB callback for generic USB Device control}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00087}00087 \textcolor{comment}{ * transfers.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00088}00088 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00089}00089 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00090}\mbox{\hyperlink{usb__handle__request_8c_adf57afdcfb59ed15ec3b8fbe73d5e889}{00090}} \mbox{\hyperlink{usb__handle__request_8c_adf57afdcfb59ed15ec3b8fbe73d5e889}{usb\_handle\_request\_callback}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}})}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00091}00091 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00092}00092         \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} err;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00094}00094         \textcolor{comment}{/* check the current transfer state */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00096}00096         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00097}00097         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a3aa7120c3ecab31972b8fe219530f552}{USB\_ST\_SETUP}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00098}00098         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a8f0386217ba77be3e47721fae9aa9b3d}{USB\_ST\_TRANSFERRED}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00100}00100                 \textcolor{comment}{/* handle the request */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00101}00101                 err = \mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{usb\_handle\_request}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00103}00103                 \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00104}00104                         \textcolor{keywordflow}{if} (err == \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a75b7cd61ecd61273b6660a358743ff55}{USB\_ERR\_BAD\_CONTEXT}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00105}00105                                 \textcolor{comment}{/* we need to re-\/setup the control transfer */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00106}00106                                 \mbox{\hyperlink{usb__hub_8c_a8fae9cab59ff1492fce90b902e6679d6}{usb\_needs\_explore}}(xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_a870218d57253f00f1e9baa19401c9b0c}{bus}}, 0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00107}00107                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00108}00108                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00109}00109                         \textcolor{keywordflow}{goto} tr\_restart;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00110}00110                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00111}00111                 \mbox{\hyperlink{usb__transfer_8c_a10c440b0b97cac293b4df9d558f15bac}{usbd\_transfer\_submit}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00112}00112                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00114}00114         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00115}00115                 \textcolor{comment}{/* check if a control transfer is active */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00116}00116                 \textcolor{keywordflow}{if} (xfer-\/>\mbox{\hyperlink{structusb__xfer_a8fb7b6b5dbf36063d9b7e5d54d9e15ae}{flags\_int}}.\mbox{\hyperlink{structusb__xfer__flags__int_a6ca2ea02f3040d101af4d803964805e6}{control\_rem}} != 0xFFFF) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00117}00117                         \textcolor{comment}{/* handle the request */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00118}00118                         err = \mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{usb\_handle\_request}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00119}00119                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00120}00120                 \textcolor{keywordflow}{if} (xfer-\/>\mbox{\hyperlink{structusb__xfer_a85c5e7431b74a154e8313190f6d1d58f}{error}} != \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945abe72c3e4b6644141519a28f1ef97f717}{USB\_ERR\_CANCELLED}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00121}00121                         \textcolor{comment}{/* should not happen -\/ try stalling */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00122}00122                         \textcolor{keywordflow}{goto} tr\_restart;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00123}00123                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00124}00124                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00125}00125         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00126}00126         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00127}00127 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00128}00128 tr\_restart:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00129}00129         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00130}00130 \textcolor{comment}{         * If a control transfer is active, stall it, and wait for the}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00131}00131 \textcolor{comment}{         * next control transfer.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00132}00132 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00133}00133         \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device__request}{usb\_device\_request}}));}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00134}00134         xfer-\/>\mbox{\hyperlink{structusb__xfer_a0d60b7394e3ea099dc1c466efe87c6e2}{nframes}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00135}00135         xfer-\/>\mbox{\hyperlink{structusb__xfer_aa251db061296120bb15fd562088a1d9d}{flags}}.\mbox{\hyperlink{structusb__xfer__flags_a2df55489fc97240c42834151d9c8b8d0}{manual\_status}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00136}00136         xfer-\/>\mbox{\hyperlink{structusb__xfer_aa251db061296120bb15fd562088a1d9d}{flags}}.\mbox{\hyperlink{structusb__xfer__flags_a76816b701c58c22a9a78904b109c2e95}{force\_short\_xfer}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00137}00137         \mbox{\hyperlink{usb__transfer_8c_abadf9cb2f8e81a5133af0c8030039de3}{usbd\_xfer\_set\_stall}}(xfer);   \textcolor{comment}{/* cancel previous transfer, if any */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00138}00138         \mbox{\hyperlink{usb__transfer_8c_a10c440b0b97cac293b4df9d558f15bac}{usbd\_transfer\_submit}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00139}00139 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00140}00140 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00141}00141 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00142}00142 \textcolor{comment}{ *      usb\_handle\_set\_config}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00143}00143 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00144}00144 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00145}00145 \textcolor{comment}{ *    0: Success}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00146}00146 \textcolor{comment}{ * Else: Failure}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00147}00147 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00148}00148 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00149}\mbox{\hyperlink{usb__handle__request_8c_a49bce512da7cbe3b77000bedd407cfd2}{00149}} \mbox{\hyperlink{usb__handle__request_8c_a49bce512da7cbe3b77000bedd407cfd2}{usb\_handle\_set\_config}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, uint8\_t conf\_no)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00150}00150 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00151}00151         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}} *udev = xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_ad636fcdafa42c174cdf281bb144b1e67}{udev}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00152}00152         \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} err = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00153}00153         uint8\_t do\_unlock;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00155}00155         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00156}00156 \textcolor{comment}{         * We need to protect against other threads doing probe and}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00157}00157 \textcolor{comment}{         * attach:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00158}00158 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00159}00159         \mbox{\hyperlink{usb__core_8h_ac86c50e4e5676b0f635f424cf6a27946}{USB\_XFER\_UNLOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00160}00160 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00161}00161         \textcolor{comment}{/* Prevent re-\/enumeration */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00162}00162         do\_unlock = \mbox{\hyperlink{usb__device_8c_a4341ffb46e0007d162bbb22e9142fbf2}{usbd\_enum\_lock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00163}00163 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00164}00164         \textcolor{keywordflow}{if} (conf\_no == \mbox{\hyperlink{usb_8h_a48bb1db48ed517c9834826fa045908dd}{USB\_UNCONFIG\_NO}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00165}00165                 conf\_no = \mbox{\hyperlink{usb_8h_a62b706b8392cd51db650b220c9bbb9a0}{USB\_UNCONFIG\_INDEX}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00166}00166         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00167}00167                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00168}00168 \textcolor{comment}{                 * The relationship between config number and config index}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00169}00169 \textcolor{comment}{                 * is very simple in our case:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00170}00170 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00171}00171                 conf\_no-\/-\/;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00172}00172         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00173}00173 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00174}00174         \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__device_8c_a7f9c5039f20de3969212befeafd07e62}{usbd\_set\_config\_index}}(udev, conf\_no)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00175}00175                 \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}set config \%d failed\(\backslash\)n"{}}, conf\_no);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00176}00176                 err = \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a83258c6183686c303988db96e7f5713a}{USB\_ERR\_STALLED}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00177}00177                 \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00178}00178         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00179}00179         \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__device_8c_a5374feec38ebe0044bc1569bba22a8ab}{usb\_probe\_and\_attach}}(udev, \mbox{\hyperlink{usb_8h_a9636572ac5c1c52650546f843150aa29}{USB\_IFACE\_INDEX\_ANY}})) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00180}00180                 \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}probe and attach failed\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00181}00181                 err = \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a83258c6183686c303988db96e7f5713a}{USB\_ERR\_STALLED}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00182}00182                 \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00183}00183         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00184}00184 done:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00185}00185         \textcolor{keywordflow}{if} (do\_unlock)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00186}00186                 \mbox{\hyperlink{usb__device_8c_a9ee66f0c4e9929f36e743e8cefd47e80}{usbd\_enum\_unlock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00187}00187         \mbox{\hyperlink{usb__core_8h_a1cd58ed358781a31a4766bbe71099d21}{USB\_XFER\_LOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00188}00188         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00189}00189 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00191}00191 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00192}\mbox{\hyperlink{usb__handle__request_8c_ab85dd055db53941d4a58967968da5cd0}{00192}} \mbox{\hyperlink{usb__handle__request_8c_ab85dd055db53941d4a58967968da5cd0}{usb\_check\_alt\_setting}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device}{usb\_device}} *udev, }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00193}00193      \textcolor{keyword}{struct} \mbox{\hyperlink{structusb__interface}{usb\_interface}} *iface, uint8\_t alt\_index)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00194}00194 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00195}00195         uint8\_t do\_unlock;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00196}00196         \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} err = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00198}00198         \textcolor{comment}{/* Prevent re-\/enumeration */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00199}00199         do\_unlock = \mbox{\hyperlink{usb__device_8c_a4341ffb46e0007d162bbb22e9142fbf2}{usbd\_enum\_lock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00200}00200 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00201}00201         \textcolor{keywordflow}{if} (alt\_index >= \mbox{\hyperlink{usb__parse_8c_adc2bb0ce8388580b246c3d82c986cd84}{usbd\_get\_no\_alts}}(udev-\/>\mbox{\hyperlink{structusb__device_a01f45bba85920b182662484ab096f81a}{cdesc}}, iface-\/>\mbox{\hyperlink{structusb__interface_aa5cea795ac14467ffdbe70b7f59beaba}{idesc}}))}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00202}00202                 err = \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945ac568d752239d287fca75588222df1bdf}{USB\_ERR\_INVAL}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00204}00204         \textcolor{keywordflow}{if} (do\_unlock)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00205}00205                 \mbox{\hyperlink{usb__device_8c_a9ee66f0c4e9929f36e743e8cefd47e80}{usbd\_enum\_unlock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00206}00206 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00207}00207         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00208}00208 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00209}00209 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00210}00210 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00211}00211 \textcolor{comment}{ *      usb\_handle\_iface\_request}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00212}00212 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00213}00213 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00214}00214 \textcolor{comment}{ *    0: Success}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00215}00215 \textcolor{comment}{ * Else: Failure}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00216}00216 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00217}00217 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00218}\mbox{\hyperlink{usb__handle__request_8c_ab41af7ca7d79f5e895cee03ddd74dc01}{00218}} \mbox{\hyperlink{usb__handle__request_8c_ab41af7ca7d79f5e895cee03ddd74dc01}{usb\_handle\_iface\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00219}00219     \textcolor{keywordtype}{void} **ppdata, uint16\_t *\mbox{\hyperlink{usb__if_8m_aaba3806a5156b2c2a6d6f95f0d95ed03}{plen}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00220}00220     \textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device__request}{usb\_device\_request}} \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, uint16\_t off, uint8\_t \mbox{\hyperlink{structusb__device_a81fcb58d710319b9d1f97fb1537c0257}{state}})}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00221}00221 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00222}00222         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__interface}{usb\_interface}} *iface;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00223}00223         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__interface}{usb\_interface}} *iface\_parent;        \textcolor{comment}{/* parent interface */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00224}00224         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}} *udev = xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_ad636fcdafa42c174cdf281bb144b1e67}{udev}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00225}00225         \textcolor{keywordtype}{int} \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00226}00226         uint8\_t iface\_index;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00227}00227         uint8\_t temp\_state;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00228}00228         uint8\_t do\_unlock;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00229}00229 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00230}00230         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType \& 0x1F) == \mbox{\hyperlink{usb_8h_a677a5fc804ae2fadd8e1f4647f74899b}{UT\_INTERFACE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00231}00231                 iface\_index = \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wIndex[0]; \textcolor{comment}{/* unicast */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00232}00232         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00233}00233                 iface\_index = 0;        \textcolor{comment}{/* broadcast */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00234}00234         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00236}00236         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00237}00237 \textcolor{comment}{         * We need to protect against other threads doing probe and}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00238}00238 \textcolor{comment}{         * attach:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00239}00239 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00240}00240         \mbox{\hyperlink{usb__core_8h_ac86c50e4e5676b0f635f424cf6a27946}{USB\_XFER\_UNLOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00241}00241 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00242}00242         \textcolor{comment}{/* Prevent re-\/enumeration */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00243}00243         do\_unlock = \mbox{\hyperlink{usb__device_8c_a4341ffb46e0007d162bbb22e9142fbf2}{usbd\_enum\_lock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00244}00244 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00245}00245         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = ENXIO;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00247}00247 tr\_repeat:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00248}00248         iface = \mbox{\hyperlink{usb__device_8c_ad241549c2225f6ccb72345851d5b9ed8}{usbd\_get\_iface}}(udev, iface\_index);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00249}00249         \textcolor{keywordflow}{if} ((iface == NULL) ||}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00250}00250             (iface-\/>\mbox{\hyperlink{structusb__interface_aa5cea795ac14467ffdbe70b7f59beaba}{idesc}} == NULL)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00251}00251                 \textcolor{comment}{/* end of interfaces non-\/existing interface */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00252}00252                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00253}00253         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00254}00254         \textcolor{comment}{/* set initial state */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00256}00256         temp\_state = \mbox{\hyperlink{structusb__device_a81fcb58d710319b9d1f97fb1537c0257}{state}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00258}00258         \textcolor{comment}{/* forward request to interface, if any */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00259}00259 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00260}00260         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00261}00261             (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != ENOTTY) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00262}00262             (iface-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}} != NULL) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00263}00263             device\_is\_attached(iface-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}})) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00264}00264 \textcolor{preprocessor}{\#if 0}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00265}00265                 DEVMETHOD(\mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{usb\_handle\_request}}, NULL);  \textcolor{comment}{/* dummy */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00266}00266 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00267}00267                 \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = USB\_HANDLE\_REQUEST(iface-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00268}00268                     \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, ppdata, \mbox{\hyperlink{usb__if_8m_aaba3806a5156b2c2a6d6f95f0d95ed03}{plen}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00269}00269                     off, \&temp\_state);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00270}00270         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00271}00271         iface\_parent = \mbox{\hyperlink{usb__device_8c_ad241549c2225f6ccb72345851d5b9ed8}{usbd\_get\_iface}}(udev, iface-\/>\mbox{\hyperlink{structusb__interface_a4d85f85fbd0e08fe94c8ef40e5beea69}{parent\_iface\_index}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00272}00272 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00273}00273         \textcolor{keywordflow}{if} ((iface\_parent == NULL) ||}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00274}00274             (iface\_parent-\/>\mbox{\hyperlink{structusb__interface_aa5cea795ac14467ffdbe70b7f59beaba}{idesc}} == NULL)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00275}00275                 \textcolor{comment}{/* non-\/existing interface */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00276}00276                 iface\_parent = NULL;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00277}00277         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00278}00278         \textcolor{comment}{/* forward request to parent interface, if any */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00279}00279 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00280}00280         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != 0) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00281}00281             (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} != ENOTTY) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00282}00282             (iface\_parent != NULL) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00283}00283             (iface\_parent-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}} != NULL) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00284}00284             ((\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType \& 0x1F) == \mbox{\hyperlink{usb_8h_a677a5fc804ae2fadd8e1f4647f74899b}{UT\_INTERFACE}}) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00285}00285             (iface\_parent-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}} != iface-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}}) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00286}00286             device\_is\_attached(iface\_parent-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}})) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00287}00287                 \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = USB\_HANDLE\_REQUEST(iface\_parent-\/>\mbox{\hyperlink{structusb__interface_a30771ef505042d5d21771ce48c80e45a}{subdev}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00288}00288                     \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, ppdata, \mbox{\hyperlink{usb__if_8m_aaba3806a5156b2c2a6d6f95f0d95ed03}{plen}}, off, \&temp\_state);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00289}00289         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00290}00290         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} == 0) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00291}00291                 \textcolor{comment}{/* negativly adjust pointer and length */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00292}00292                 *ppdata = ((uint8\_t *)(*ppdata)) -\/ off;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00293}00293                 *\mbox{\hyperlink{usb__if_8m_aaba3806a5156b2c2a6d6f95f0d95ed03}{plen}} += off;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00294}00294 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00295}00295                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structusb__device_a81fcb58d710319b9d1f97fb1537c0257}{state}} == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \&\&}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00296}00296                     (temp\_state == \mbox{\hyperlink{usbdi_8h_a01056f98799a951db5cc018cd604d53e}{USB\_HR\_COMPLETE\_OK}}))}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00297}00297                         \textcolor{keywordflow}{goto} tr\_short;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00298}00298                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00299}00299                         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00300}00300         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} == ENOTTY) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00301}00301                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00302}00302         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00303}00303         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType \& 0x1F) != \mbox{\hyperlink{usb_8h_a677a5fc804ae2fadd8e1f4647f74899b}{UT\_INTERFACE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00304}00304                 iface\_index++;          \textcolor{comment}{/* iterate */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00305}00305                 \textcolor{keywordflow}{goto} tr\_repeat;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00306}00306         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00307}00307         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structusb__device_a81fcb58d710319b9d1f97fb1537c0257}{state}} != \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00308}00308                 \textcolor{comment}{/* we are complete */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00309}00309                 \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00310}00310         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00311}00311         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00312}00312         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a1c18aa69d1e986a87fcdbfbb624c954f}{UT\_WRITE\_INTERFACE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00313}00313                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00314}00314                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_ac158866f6b7f31946ace0216225b79cb}{UR\_SET\_INTERFACE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00315}00315                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00316}00316 \textcolor{comment}{                         * We assume that the endpoints are the same}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00317}00317 \textcolor{comment}{                         * across the alternate settings.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00318}00318 \textcolor{comment}{                         *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00319}00319 \textcolor{comment}{                         * Reset the endpoints, because re-\/attaching}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00320}00320 \textcolor{comment}{                         * only a part of the device is not possible.}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00321}00321 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00322}00322                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = \mbox{\hyperlink{usb__handle__request_8c_ab85dd055db53941d4a58967968da5cd0}{usb\_check\_alt\_setting}}(udev,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00323}00323                             iface, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wValue[0]);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00324}00324                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00325}00325                                 \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}alt setting does not exist \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00326}00326                                     \mbox{\hyperlink{usb__error_8c_a2391eb446dce3e4368cacf781857774e}{usbd\_errstr}}(\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}));}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00327}00327                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00328}00328                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00329}00329                         \mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}} = \mbox{\hyperlink{usb__device_8c_a76e3bc76d25eee08beff6f2a63d35f0a}{usb\_reset\_iface\_endpoints}}(udev, iface\_index);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00330}00330                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00331}00331                                 \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}alt setting failed \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00332}00332                                     \mbox{\hyperlink{usb__error_8c_a2391eb446dce3e4368cacf781857774e}{usbd\_errstr}}(\mbox{\hyperlink{if__runreg_8h_a9f8f252ecb5b3fb46dafe827231faf70}{error}}));}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00333}00333                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00334}00334                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00335}00335                         \textcolor{comment}{/* update the current alternate setting */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00336}00336                         iface-\/>\mbox{\hyperlink{structusb__interface_abe6dfd442aa844e892cf38426c0cf75c}{alt\_index}} = \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wValue[0];}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00337}00337                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00339}00339                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00340}00340                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00341}00341                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00342}00342                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00343}00343 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00344}00344         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_afc6a17fce8bdb62291274b83223eea65}{UT\_READ\_INTERFACE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00345}00345                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00346}00346                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a3654eeeab796d0863e7527e3aac772fe}{UR\_GET\_INTERFACE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00347}00347                         *ppdata = \&iface-\/>\mbox{\hyperlink{structusb__interface_abe6dfd442aa844e892cf38426c0cf75c}{alt\_index}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00348}00348                         *\mbox{\hyperlink{usb__if_8m_aaba3806a5156b2c2a6d6f95f0d95ed03}{plen}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00349}00349                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00350}00350 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00351}00351                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00352}00352                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00353}00353                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00354}00354                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00355}00355         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00356}00356                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00357}00357         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00358}00358 tr\_valid:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00359}00359         \textcolor{keywordflow}{if} (do\_unlock)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00360}00360                 \mbox{\hyperlink{usb__device_8c_a9ee66f0c4e9929f36e743e8cefd47e80}{usbd\_enum\_unlock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00361}00361         \mbox{\hyperlink{usb__core_8h_a1cd58ed358781a31a4766bbe71099d21}{USB\_XFER\_LOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00362}00362         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00363}00363 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00364}00364 tr\_short:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00365}00365         \textcolor{keywordflow}{if} (do\_unlock)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00366}00366                 \mbox{\hyperlink{usb__device_8c_a9ee66f0c4e9929f36e743e8cefd47e80}{usbd\_enum\_unlock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00367}00367         \mbox{\hyperlink{usb__core_8h_a1cd58ed358781a31a4766bbe71099d21}{USB\_XFER\_LOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00368}00368         \textcolor{keywordflow}{return} (\mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a70162ae58dd5e4923d325d67b196f281}{USB\_ERR\_SHORT\_XFER}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00369}00369 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00370}00370 tr\_stalled:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00371}00371         \textcolor{keywordflow}{if} (do\_unlock)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00372}00372                 \mbox{\hyperlink{usb__device_8c_a9ee66f0c4e9929f36e743e8cefd47e80}{usbd\_enum\_unlock}}(udev);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00373}00373         \mbox{\hyperlink{usb__core_8h_a1cd58ed358781a31a4766bbe71099d21}{USB\_XFER\_LOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00374}00374         \textcolor{keywordflow}{return} (\mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a83258c6183686c303988db96e7f5713a}{USB\_ERR\_STALLED}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00375}00375 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00376}00376 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00377}00377 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00378}00378 \textcolor{comment}{ *      usb\_handle\_stall}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00379}00379 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00380}00380 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00381}00381 \textcolor{comment}{ *    0: Success}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00382}00382 \textcolor{comment}{ * Else: Failure}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00383}00383 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00384}00384 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00385}\mbox{\hyperlink{usb__handle__request_8c_aae8242393a914fddecf1608a5d6bd2e7}{00385}} \mbox{\hyperlink{usb__handle__request_8c_aae8242393a914fddecf1608a5d6bd2e7}{usb\_handle\_set\_stall}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, uint8\_t ep, uint8\_t do\_stall)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00386}00386 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00387}00387         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}} *udev = xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_ad636fcdafa42c174cdf281bb144b1e67}{udev}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00388}00388         \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} err;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00389}00389 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00390}00390         \mbox{\hyperlink{usb__core_8h_ac86c50e4e5676b0f635f424cf6a27946}{USB\_XFER\_UNLOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00391}00391         err = \mbox{\hyperlink{usb__device_8c_a40b3bab65753f776071e827d5f738505}{usbd\_set\_endpoint\_stall}}(udev,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00392}00392             \mbox{\hyperlink{usb__device_8c_abb8c67ad52ff01e2b863cc2d7e3c7dbc}{usbd\_get\_ep\_by\_addr}}(udev, ep), do\_stall);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00393}00393         \mbox{\hyperlink{usb__core_8h_a1cd58ed358781a31a4766bbe71099d21}{USB\_XFER\_LOCK}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00394}00394         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00395}00395 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00397}00397 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00398}00398 \textcolor{comment}{ *      usb\_handle\_get\_stall}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00399}00399 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00400}00400 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00401}00401 \textcolor{comment}{ *    0: Success}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00402}00402 \textcolor{comment}{ * Else: Failure}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00403}00403 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00404}00404 \textcolor{keyword}{static} uint8\_t}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00405}\mbox{\hyperlink{usb__handle__request_8c_a237fa4ab951e3672f4bc704b2c3dceac}{00405}} \mbox{\hyperlink{usb__handle__request_8c_a237fa4ab951e3672f4bc704b2c3dceac}{usb\_handle\_get\_stall}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__device}{usb\_device}} *udev, uint8\_t ea\_val)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00406}00406 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00407}00407         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__endpoint}{usb\_endpoint}} *ep;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00408}00408         uint8\_t halted;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00409}00409 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00410}00410         ep = \mbox{\hyperlink{usb__device_8c_abb8c67ad52ff01e2b863cc2d7e3c7dbc}{usbd\_get\_ep\_by\_addr}}(udev, ea\_val);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00411}00411         \textcolor{keywordflow}{if} (ep == NULL) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00412}00412                 \textcolor{comment}{/* nothing to do */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00413}00413                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00414}00414         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00415}00415         \mbox{\hyperlink{usb__core_8h_a21dab1de8f52baf9fbf7617c6b1ec033}{USB\_BUS\_LOCK}}(udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00416}00416         halted = ep-\/>\mbox{\hyperlink{structusb__endpoint_a80bc696d02be9439a7f712c04372427f}{is\_stalled}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00417}00417         \mbox{\hyperlink{usb__core_8h_aadb0c32f6333b8a0715929ace5f550b2}{USB\_BUS\_UNLOCK}}(udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00418}00418 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00419}00419         \textcolor{keywordflow}{return} (halted);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00420}00420 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00422}00422 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00423}00423 \textcolor{comment}{ *      usb\_handle\_remote\_wakeup}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00424}00424 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00425}00425 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00426}00426 \textcolor{comment}{ *    0: Success}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00427}00427 \textcolor{comment}{ * Else: Failure}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00428}00428 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00429}00429 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00430}\mbox{\hyperlink{usb__handle__request_8c_a0bdb5b1818430bcc50a67f5f62bc6632}{00430}} \mbox{\hyperlink{usb__handle__request_8c_a0bdb5b1818430bcc50a67f5f62bc6632}{usb\_handle\_remote\_wakeup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer, uint8\_t is\_on)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00431}00431 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00432}00432         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}} *udev;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00433}00433         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__bus}{usb\_bus}} *bus;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00434}00434 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00435}00435         udev = xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_ad636fcdafa42c174cdf281bb144b1e67}{udev}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00436}00436         bus = udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00437}00437 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00438}00438         \mbox{\hyperlink{usb__core_8h_a21dab1de8f52baf9fbf7617c6b1ec033}{USB\_BUS\_LOCK}}(bus);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00439}00439 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00440}00440         \textcolor{keywordflow}{if} (is\_on) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00441}00441                 udev-\/>\mbox{\hyperlink{structusb__device_ae7b27fdcae02d49bee5c2f0a9130b633}{flags}}.\mbox{\hyperlink{structusb__device__flags_a63e95a66d1ec8e9a3a5968954f64ed78}{remote\_wakeup}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00442}00442         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00443}00443                 udev-\/>\mbox{\hyperlink{structusb__device_ae7b27fdcae02d49bee5c2f0a9130b633}{flags}}.\mbox{\hyperlink{structusb__device__flags_a63e95a66d1ec8e9a3a5968954f64ed78}{remote\_wakeup}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00444}00444         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00445}00445 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00446}00446         \mbox{\hyperlink{usb__core_8h_aadb0c32f6333b8a0715929ace5f550b2}{USB\_BUS\_UNLOCK}}(bus);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00447}00447 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00448}00448 \textcolor{preprocessor}{\#if USB\_HAVE\_POWERD}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00449}00449         \textcolor{comment}{/* In case we are out of sync, update the power state. */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00450}00450         \mbox{\hyperlink{usb__hub_8h_ae910ce81431cdd33f68f5241b53dfc04}{usb\_bus\_power\_update}}(udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00451}00451 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00452}00452         \textcolor{keywordflow}{return} (0);                     \textcolor{comment}{/* success */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00453}00453 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00455}00455 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00456}00456 \textcolor{comment}{ *      usb\_handle\_request}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00457}00457 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00458}00458 \textcolor{comment}{ * Internal state sequence:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00459}00459 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00460}00460 \textcolor{comment}{ * USB\_HR\_NOT\_COMPLETE -\/> USB\_HR\_COMPLETE\_OK v USB\_HR\_COMPLETE\_ERR}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00461}00461 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00462}00462 \textcolor{comment}{ * Returns:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00463}00463 \textcolor{comment}{ * 0: Ready to start hardware}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00464}00464 \textcolor{comment}{ * Else: Stall current transfer, if any}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00465}00465 \textcolor{comment}{ *-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00466}00466 \textcolor{keyword}{static} \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00467}\mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{00467}} \mbox{\hyperlink{usb__handle__request_8c_acd7ff252b93f3bd9e87d0f8b3eb3ffa5}{usb\_handle\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structusb__xfer}{usb\_xfer}} *xfer)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00468}00468 \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00469}00469         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device__request}{usb\_device\_request}} \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00470}00470         \textcolor{keyword}{struct }\mbox{\hyperlink{structusb__device}{usb\_device}} *udev;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00471}00471         \textcolor{keyword}{const} \textcolor{keywordtype}{void} *src\_zcopy;          \textcolor{comment}{/* zero-\/copy source pointer */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00472}00472         \textcolor{keyword}{const} \textcolor{keywordtype}{void} *src\_mcopy;          \textcolor{comment}{/* non zero-\/copy source pointer */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00473}00473         uint16\_t off;                   \textcolor{comment}{/* data offset */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00474}00474         uint16\_t rem;                   \textcolor{comment}{/* data remainder */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00475}00475         uint16\_t max\_len;               \textcolor{comment}{/* max fragment length */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00476}00476         uint16\_t wValue;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00477}00477         uint8\_t \mbox{\hyperlink{structusb__device_a81fcb58d710319b9d1f97fb1537c0257}{state}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00478}00478         uint8\_t is\_complete = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00479}00479         \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945}{usb\_error\_t}} err;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00480}00480         \textcolor{keyword}{union }\{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00481}00481                 \mbox{\hyperlink{usb__endian_8h_ad3086c1130ab6b88c53220166e3b5129}{uWord}}      wStatus;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00482}00482                 uint8\_t buf[2];}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00483}00483         \}     temp;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00484}00484 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00485}00485         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00486}00486 \textcolor{comment}{         * Filter the USB transfer state into}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00487}00487 \textcolor{comment}{         * something which we understand:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00488}00488 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00489}00489 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00490}00490         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usbdi_8h_adc2dd35bd0dd6a42d3abd4230796a7b0}{USB\_GET\_STATE}}(xfer)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00491}00491         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a3aa7120c3ecab31972b8fe219530f552}{USB\_ST\_SETUP}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00492}00492                 state = \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00493}00493 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00494}00494                 \textcolor{keywordflow}{if} (!xfer-\/>\mbox{\hyperlink{structusb__xfer_a8fb7b6b5dbf36063d9b7e5d54d9e15ae}{flags\_int}}.\mbox{\hyperlink{structusb__xfer__flags__int_a100da5a86a7ab85605683dc51d48ef86}{control\_act}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00495}00495                         \textcolor{comment}{/* nothing to do */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00496}00496                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00497}00497                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00498}00498                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00499}00499         \textcolor{keywordflow}{case} \mbox{\hyperlink{usbdi_8h_a8f0386217ba77be3e47721fae9aa9b3d}{USB\_ST\_TRANSFERRED}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00500}00500                 \textcolor{keywordflow}{if} (!xfer-\/>\mbox{\hyperlink{structusb__xfer_a8fb7b6b5dbf36063d9b7e5d54d9e15ae}{flags\_int}}.\mbox{\hyperlink{structusb__xfer__flags__int_a100da5a86a7ab85605683dc51d48ef86}{control\_act}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00501}00501                         state = \mbox{\hyperlink{usbdi_8h_a01056f98799a951db5cc018cd604d53e}{USB\_HR\_COMPLETE\_OK}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00502}00502                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00503}00503                         state = \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00504}00504                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00505}00505                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00506}00506         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00507}00507                 state = \mbox{\hyperlink{usbdi_8h_ab71be157ec76ec40786c2722785d0be0}{USB\_HR\_COMPLETE\_ERR}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00508}00508                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00509}00509         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00510}00510 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00511}00511         \textcolor{comment}{/* reset frame stuff */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00512}00512 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00513}00513         \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 0, 0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00514}00514 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00515}00515         \mbox{\hyperlink{usb__transfer_8c_aa9f706e03ede8468e81331de474aebb4}{usbd\_xfer\_set\_frame\_offset}}(xfer, 0, 0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00516}00516         \mbox{\hyperlink{usb__transfer_8c_aa9f706e03ede8468e81331de474aebb4}{usbd\_xfer\_set\_frame\_offset}}(xfer, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}), 1);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00517}00517 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00518}00518         \textcolor{comment}{/* get the current request, if any */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00519}00519 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00520}00520         \mbox{\hyperlink{usb__busdma_8c_af52eece45b7868dbf58386f4c9e4eb9a}{usbd\_copy\_out}}(xfer-\/>\mbox{\hyperlink{structusb__xfer_a5937368645458023af557e100989c64a}{frbuffers}}, 0, \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}));}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00521}00521 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00522}00522         \textcolor{keywordflow}{if} (xfer-\/>\mbox{\hyperlink{structusb__xfer_a8fb7b6b5dbf36063d9b7e5d54d9e15ae}{flags\_int}}.\mbox{\hyperlink{structusb__xfer__flags__int_a6ca2ea02f3040d101af4d803964805e6}{control\_rem}} == 0xFFFF) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00523}00523                 \textcolor{comment}{/* first time -\/ not initialised */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00524}00524                 rem = \mbox{\hyperlink{usb__endian_8h_aa3860f9452db3a5d865cc943e2f01829}{UGETW}}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wLength);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00525}00525                 off = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00526}00526         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00527}00527                 \textcolor{comment}{/* not first time -\/ initialised */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00528}00528                 rem = xfer-\/>\mbox{\hyperlink{structusb__xfer_a8fb7b6b5dbf36063d9b7e5d54d9e15ae}{flags\_int}}.\mbox{\hyperlink{structusb__xfer__flags__int_a6ca2ea02f3040d101af4d803964805e6}{control\_rem}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00529}00529                 off = \mbox{\hyperlink{usb__endian_8h_aa3860f9452db3a5d865cc943e2f01829}{UGETW}}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wLength) -\/ rem;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00530}00530         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00531}00531 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00532}00532         \textcolor{comment}{/* set some defaults */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00533}00533 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00534}00534         max\_len = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00535}00535         src\_zcopy = NULL;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00536}00536         src\_mcopy = NULL;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00537}00537         udev = xfer-\/>\mbox{\hyperlink{structusb__xfer_ad188b4cd79900e1cd04aba6c140e9ab3}{xroot}}-\/>\mbox{\hyperlink{structusb__xfer__root_ad636fcdafa42c174cdf281bb144b1e67}{udev}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00538}00538 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00539}00539         \textcolor{comment}{/* get some request fields decoded */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00540}00540 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00541}00541         wValue = \mbox{\hyperlink{usb__endian_8h_aa3860f9452db3a5d865cc943e2f01829}{UGETW}}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wValue);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00542}00542 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00543}00543         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}req 0x\%02x 0x\%02x 0x\%04x 0x\%04x "{}}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00544}00544             \textcolor{stringliteral}{"{}off=0x\%x rem=0x\%x, state=\%d\(\backslash\)n"{}}, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00545}00545             \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest, wValue, \mbox{\hyperlink{usb__endian_8h_aa3860f9452db3a5d865cc943e2f01829}{UGETW}}(\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wIndex), off, rem, state);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00546}00546 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00547}00547         \textcolor{comment}{/* demultiplex the control request */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00548}00548 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00549}00549         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bmRequestType) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00550}00550         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a760afaa5e388cb04e742b564e4c509f3}{UT\_READ\_DEVICE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00551}00551                 \textcolor{keywordflow}{if} (state != \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00552}00552                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00553}00553                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00554}00554                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00555}00555                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_afe0147b1f88f094b26142d372647bd01}{UR\_GET\_DESCRIPTOR}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00556}00556                         \textcolor{keywordflow}{goto} tr\_handle\_get\_descriptor;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00557}00557                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a27856773c79338192e9fc272942ffb2a}{UR\_GET\_CONFIG}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00558}00558                         \textcolor{keywordflow}{goto} tr\_handle\_get\_config;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00559}00559                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a473195030530e26d522d795311db634d}{UR\_GET\_STATUS}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00560}00560                         \textcolor{keywordflow}{goto} tr\_handle\_get\_status;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00561}00561                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00562}00562                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00563}00563                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00564}00564                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00565}00565 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00566}00566         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a33c2db425d10f85e7b405035bc015d32}{UT\_WRITE\_DEVICE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00567}00567                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00568}00568                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a2e5fb48757cb795a44b99af832d6cd7d}{UR\_SET\_ADDRESS}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00569}00569                         \textcolor{keywordflow}{goto} tr\_handle\_set\_address;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00570}00570                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a03842765b1d21adb3eb41b3d706ec1aa}{UR\_SET\_CONFIG}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00571}00571                         \textcolor{keywordflow}{goto} tr\_handle\_set\_config;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00572}00572                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a49bd676481c413d1ec4a527664ac02a9}{UR\_CLEAR\_FEATURE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00573}00573                         \textcolor{keywordflow}{switch} (wValue) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00574}00574                         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a62760efb62faf9c62861dd006121cde7}{UF\_DEVICE\_REMOTE\_WAKEUP}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00575}00575                                 \textcolor{keywordflow}{goto} tr\_handle\_clear\_wakeup;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00576}00576                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00577}00577                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00578}00578                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00579}00579                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00580}00580                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_af3188459f8546e34ce2d89aa28bc85f1}{UR\_SET\_FEATURE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00581}00581                         \textcolor{keywordflow}{switch} (wValue) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00582}00582                         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a62760efb62faf9c62861dd006121cde7}{UF\_DEVICE\_REMOTE\_WAKEUP}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00583}00583                                 \textcolor{keywordflow}{goto} tr\_handle\_set\_wakeup;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00584}00584                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00585}00585                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00586}00586                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00587}00587                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00588}00588                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00589}00589                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00590}00590                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00591}00591                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00592}00592 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00593}00593         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_ab592eead7baaa45331e0e4768c0259dd}{UT\_WRITE\_ENDPOINT}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00594}00594                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00595}00595                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a49bd676481c413d1ec4a527664ac02a9}{UR\_CLEAR\_FEATURE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00596}00596                         \textcolor{keywordflow}{switch} (wValue) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00597}00597                         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a26900a08e106a6bcb220fac754e1b815}{UF\_ENDPOINT\_HALT}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00598}00598                                 \textcolor{keywordflow}{goto} tr\_handle\_clear\_halt;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00599}00599                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00600}00600                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00601}00601                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00602}00602                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00603}00603                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_af3188459f8546e34ce2d89aa28bc85f1}{UR\_SET\_FEATURE}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00604}00604                         \textcolor{keywordflow}{switch} (wValue) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00605}00605                         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a26900a08e106a6bcb220fac754e1b815}{UF\_ENDPOINT\_HALT}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00606}00606                                 \textcolor{keywordflow}{goto} tr\_handle\_set\_halt;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00607}00607                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00608}00608                                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00609}00609                         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00610}00610                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00611}00611                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00612}00612                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00613}00613                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00614}00614                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00615}00615 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00616}00616         \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_acfdcbf0400459ac3c17c15f1ccc3794d}{UT\_READ\_ENDPOINT}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00617}00617                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.bRequest) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00618}00618                 \textcolor{keywordflow}{case} \mbox{\hyperlink{usb_8h_a473195030530e26d522d795311db634d}{UR\_GET\_STATUS}}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00619}00619                         \textcolor{keywordflow}{goto} tr\_handle\_get\_ep\_status;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00620}00620                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00621}00621                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00622}00622                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00623}00623                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00624}00624         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00625}00625                 \textcolor{comment}{/* we use "{}USB\_ADD\_BYTES"{} to de-\/const the src\_zcopy */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00626}00626                 err = \mbox{\hyperlink{usb__handle__request_8c_ab41af7ca7d79f5e895cee03ddd74dc01}{usb\_handle\_iface\_request}}(xfer,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00627}00627                     \mbox{\hyperlink{usb__core_8h_a68f3f7f9da01956353655ebb6678d641}{USB\_ADD\_BYTES}}(\&src\_zcopy, 0),}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00628}00628                     \&max\_len, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, off, state);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00629}00629                 \textcolor{keywordflow}{if} (err == 0) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00630}00630                         is\_complete = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00631}00631                         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00632}00632                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (err == \mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a70162ae58dd5e4923d325d67b196f281}{USB\_ERR\_SHORT\_XFER}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00633}00633                         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00634}00634                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00635}00635                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00636}00636 \textcolor{comment}{                 * Reset zero-\/copy pointer and max length}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00637}00637 \textcolor{comment}{                 * variable in case they were unintentionally}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00638}00638 \textcolor{comment}{                 * set:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00639}00639 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00640}00640                 src\_zcopy = NULL;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00641}00641                 max\_len = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00642}00642 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00643}00643                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00644}00644 \textcolor{comment}{                 * Check if we have a vendor specific}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00645}00645 \textcolor{comment}{                 * descriptor:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00646}00646 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00647}00647                 \textcolor{keywordflow}{goto} tr\_handle\_get\_descriptor;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00648}00648         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00649}00649         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00650}00650 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00651}00651 tr\_handle\_get\_descriptor:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00652}00652         err = (\mbox{\hyperlink{usb__dynamic_8c_a9b2789c56cd4d59f46ae5dfe4b3f75e8}{usb\_temp\_get\_desc\_p}}) (udev, \&\mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}, \&src\_zcopy, \&max\_len);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00653}00653         \textcolor{keywordflow}{if} (err)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00654}00654                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00655}00655         \textcolor{keywordflow}{if} (src\_zcopy == NULL)}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00656}00656                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00657}00657         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00658}00658 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00659}00659 tr\_handle\_get\_config:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00660}00660         temp.buf[0] = udev-\/>\mbox{\hyperlink{structusb__device_a2ee59cfa6a9fe9463edb0eb1533f8757}{curr\_config\_no}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00661}00661         src\_mcopy = temp.buf;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00662}00662         max\_len = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00663}00663         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00664}00664 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00665}00665 tr\_handle\_get\_status:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00666}00666 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00667}00667         wValue = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00668}00668 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00669}00669         \mbox{\hyperlink{usb__core_8h_a21dab1de8f52baf9fbf7617c6b1ec033}{USB\_BUS\_LOCK}}(udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00670}00670         \textcolor{keywordflow}{if} (udev-\/>\mbox{\hyperlink{structusb__device_ae7b27fdcae02d49bee5c2f0a9130b633}{flags}}.\mbox{\hyperlink{structusb__device__flags_a63e95a66d1ec8e9a3a5968954f64ed78}{remote\_wakeup}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00671}00671                 wValue |= \mbox{\hyperlink{usb_8h_a8996fa5f6f9c6af5ec2328c9303e94ef}{UDS\_REMOTE\_WAKEUP}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00672}00672         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00673}00673         \textcolor{keywordflow}{if} (udev-\/>\mbox{\hyperlink{structusb__device_ae7b27fdcae02d49bee5c2f0a9130b633}{flags}}.\mbox{\hyperlink{structusb__device__flags_a41252dd27c1f941416917504610e0257}{self\_powered}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00674}00674                 wValue |= \mbox{\hyperlink{usb_8h_a5df434c22d261f2fcdf9c54080ad0f48}{UDS\_SELF\_POWERED}};}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00675}00675         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00676}00676         \mbox{\hyperlink{usb__core_8h_aadb0c32f6333b8a0715929ace5f550b2}{USB\_BUS\_UNLOCK}}(udev-\/>\mbox{\hyperlink{structusb__device_a532e474ebc2a6bfa9512e6fa1aaedf3c}{bus}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00677}00677 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00678}00678         \mbox{\hyperlink{usb__endian_8h_a69f5ba903a605cb9dc7eed2ad905f2dc}{USETW}}(temp.wStatus, wValue);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00679}00679         src\_mcopy = temp.wStatus;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00680}00680         max\_len = \textcolor{keyword}{sizeof}(temp.wStatus);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00681}00681         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00682}00682 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00683}00683 tr\_handle\_set\_address:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00684}00684         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00685}00685                 \textcolor{keywordflow}{if} (wValue >= 0x80) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00686}00686                         \textcolor{comment}{/* invalid value */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00687}00687                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00688}00688                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (udev-\/>\mbox{\hyperlink{structusb__device_a2ee59cfa6a9fe9463edb0eb1533f8757}{curr\_config\_no}} != 0) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00689}00689                         \textcolor{comment}{/* we are configured ! */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00690}00690                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00691}00691                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00692}00692         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (state != \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00693}00693                 udev-\/>\mbox{\hyperlink{structusb__device_ab9873df4422a53f4fa2d7c17460b11a1}{address}} = (wValue \& 0x7F);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00694}00694                 \textcolor{keywordflow}{goto} tr\_bad\_context;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00695}00695         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00696}00696         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00697}00697 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00698}00698 tr\_handle\_set\_config:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00699}00699         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00700}00700                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__handle__request_8c_a49bce512da7cbe3b77000bedd407cfd2}{usb\_handle\_set\_config}}(xfer, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wValue[0])) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00701}00701                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00702}00702                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00703}00703         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00704}00704         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00705}00705 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00706}00706 tr\_handle\_clear\_halt:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00707}00707         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00708}00708                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__handle__request_8c_aae8242393a914fddecf1608a5d6bd2e7}{usb\_handle\_set\_stall}}(xfer, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wIndex[0], 0)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00709}00709                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00710}00710                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00711}00711         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00712}00712         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00713}00713 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00714}00714 tr\_handle\_clear\_wakeup:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00715}00715         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00716}00716                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__handle__request_8c_a0bdb5b1818430bcc50a67f5f62bc6632}{usb\_handle\_remote\_wakeup}}(xfer, 0)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00717}00717                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00718}00718                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00719}00719         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00720}00720         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00721}00721 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00722}00722 tr\_handle\_set\_halt:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00723}00723         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00724}00724                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__handle__request_8c_aae8242393a914fddecf1608a5d6bd2e7}{usb\_handle\_set\_stall}}(xfer, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wIndex[0], 1)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00725}00725                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00726}00726                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00727}00727         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00728}00728         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00729}00729 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00730}00730 tr\_handle\_set\_wakeup:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00731}00731         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00732}00732                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{usb__handle__request_8c_a0bdb5b1818430bcc50a67f5f62bc6632}{usb\_handle\_remote\_wakeup}}(xfer, 1)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00733}00733                         \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00734}00734                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00735}00735         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00736}00736         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00737}00737 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00738}00738 tr\_handle\_get\_ep\_status:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00739}00739         \textcolor{keywordflow}{if} (state == \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00740}00740                 temp.wStatus[0] =}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00741}00741                     \mbox{\hyperlink{usb__handle__request_8c_a237fa4ab951e3672f4bc704b2c3dceac}{usb\_handle\_get\_stall}}(udev, \mbox{\hyperlink{usb__if_8m_accfb270fc1884a0d1e4b9a0fb6234f14}{req}}.wIndex[0]);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00742}00742                 temp.wStatus[1] = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00743}00743                 src\_mcopy = temp.wStatus;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00744}00744                 max\_len = \textcolor{keyword}{sizeof}(temp.wStatus);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00745}00745         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00746}00746         \textcolor{keywordflow}{goto} tr\_valid;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00747}00747 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00748}00748 tr\_valid:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00749}00749         \textcolor{keywordflow}{if} (state != \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00750}00750                 \textcolor{keywordflow}{goto} tr\_stalled;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00751}00751         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00752}00752         \textcolor{comment}{/* subtract offset from length */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00753}00753 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00754}00754         max\_len -\/= off;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00755}00755 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00756}00756         \textcolor{comment}{/* Compute the real maximum data length */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00757}00757 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00758}00758         \textcolor{keywordflow}{if} (max\_len > xfer-\/>\mbox{\hyperlink{structusb__xfer_a3ece1de738e7c3ca20f0bfdbd827fd16}{max\_data\_length}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00759}00759                 max\_len = \mbox{\hyperlink{usb__transfer_8c_ae34a7cc2f01c6dfb68bca6fd0b72647e}{usbd\_xfer\_max\_len}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00760}00760         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00761}00761         \textcolor{keywordflow}{if} (max\_len > rem) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00762}00762                 max\_len = rem;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00763}00763         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00764}00764         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00765}00765 \textcolor{comment}{         * If the remainder is greater than the maximum data length,}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00766}00766 \textcolor{comment}{         * we need to truncate the value for the sake of the}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00767}00767 \textcolor{comment}{         * comparison below:}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00768}00768 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00769}00769         \textcolor{keywordflow}{if} (rem > xfer-\/>\mbox{\hyperlink{structusb__xfer_a3ece1de738e7c3ca20f0bfdbd827fd16}{max\_data\_length}}) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00770}00770                 rem = \mbox{\hyperlink{usb__transfer_8c_ae34a7cc2f01c6dfb68bca6fd0b72647e}{usbd\_xfer\_max\_len}}(xfer);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00771}00771         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00772}00772         \textcolor{keywordflow}{if} ((rem != max\_len) \&\& (is\_complete != 0)) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00773}00773                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00774}00774 \textcolor{comment}{                 * If we don't transfer the data we can transfer, then}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00775}00775 \textcolor{comment}{                 * the transfer is short !}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00776}00776 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00777}00777                 xfer-\/>\mbox{\hyperlink{structusb__xfer_aa251db061296120bb15fd562088a1d9d}{flags}}.\mbox{\hyperlink{structusb__xfer__flags_a76816b701c58c22a9a78904b109c2e95}{force\_short\_xfer}} = 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00778}00778                 xfer-\/>\mbox{\hyperlink{structusb__xfer_a0d60b7394e3ea099dc1c466efe87c6e2}{nframes}} = 2;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00779}00779         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00780}00780                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00781}00781 \textcolor{comment}{                 * Default case}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00782}00782 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00783}00783                 xfer-\/>\mbox{\hyperlink{structusb__xfer_aa251db061296120bb15fd562088a1d9d}{flags}}.\mbox{\hyperlink{structusb__xfer__flags_a76816b701c58c22a9a78904b109c2e95}{force\_short\_xfer}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00784}00784                 xfer-\/>\mbox{\hyperlink{structusb__xfer_a0d60b7394e3ea099dc1c466efe87c6e2}{nframes}} = max\_len ? 2 : 1;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00785}00785         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00786}00786         \textcolor{keywordflow}{if} (max\_len > 0) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00787}00787                 \textcolor{keywordflow}{if} (src\_mcopy) \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00788}00788                         src\_mcopy = \mbox{\hyperlink{usb__core_8h_a68f3f7f9da01956353655ebb6678d641}{USB\_ADD\_BYTES}}(src\_mcopy, off);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00789}00789                         \mbox{\hyperlink{usb__busdma_8c_accb7cd85c3477e50c1ba1b1489226d09}{usbd\_copy\_in}}(xfer-\/>\mbox{\hyperlink{structusb__xfer_a5937368645458023af557e100989c64a}{frbuffers}} + 1, 0,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00790}00790                             src\_mcopy, max\_len);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00791}00791                         \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 1, max\_len);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00792}00792                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00793}00793                         \mbox{\hyperlink{usb__transfer_8c_a30d239cbfe3c02ec7da6e6dfe5055762}{usbd\_xfer\_set\_frame\_data}}(xfer, 1,}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00794}00794                             \mbox{\hyperlink{usb__core_8h_a68f3f7f9da01956353655ebb6678d641}{USB\_ADD\_BYTES}}(src\_zcopy, off), max\_len);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00795}00795                 \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00796}00796         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00797}00797                 \textcolor{comment}{/* the end is reached, send status */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00798}00798                 xfer-\/>\mbox{\hyperlink{structusb__xfer_aa251db061296120bb15fd562088a1d9d}{flags}}.\mbox{\hyperlink{structusb__xfer__flags_a2df55489fc97240c42834151d9c8b8d0}{manual\_status}} = 0;}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00799}00799                 \mbox{\hyperlink{usb__transfer_8c_a31786497f0f4222203b1e993d52af753}{usbd\_xfer\_set\_frame\_len}}(xfer, 1, 0);}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00800}00800         \}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00801}00801         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}success\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00802}00802         \textcolor{keywordflow}{return} (0);                     \textcolor{comment}{/* success */}}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00803}00803 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00804}00804 tr\_stalled:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00805}00805         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, (state != \mbox{\hyperlink{usbdi_8h_a2539d3945aa5ae5e58e3eced63ab5b16}{USB\_HR\_NOT\_COMPLETE}}) ?}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00806}00806             \textcolor{stringliteral}{"{}complete"{}} : \textcolor{stringliteral}{"{}stalled"{}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00807}00807         \textcolor{keywordflow}{return} (\mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a83258c6183686c303988db96e7f5713a}{USB\_ERR\_STALLED}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00808}00808 }
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00809}00809 tr\_bad\_context:}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00810}00810         \mbox{\hyperlink{umass_8c_aa786fc43d4857c3ab9f2c777b4e6f9c5}{DPRINTF}}(\textcolor{stringliteral}{"{}bad context\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00811}00811         \textcolor{keywordflow}{return} (\mbox{\hyperlink{usbdi_8h_a5daf16538c7ea36dad2de85182c72945a75b7cd61ecd61273b6660a358743ff55}{USB\_ERR\_BAD\_CONTEXT}});}
\DoxyCodeLine{\Hypertarget{usb__handle__request_8c_source_l00812}00812 \}}

\end{DoxyCode}
