Ticket #13185: report-edf6bb.html

File report-edf6bb.html, 113.9 KB (added by mt, 8 years ago)

Report by Clang Static Analyzer

Line 
1<!doctype html>
2<html>
3<head>
4<title>/home/haiku/haiku/haiku/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp</title>
5<style type="text/css">
6 body { color:#000000; background-color:#ffffff }
7 body { font-family:Helvetica, sans-serif; font-size:10pt }
8 h1 { font-size:14pt }
9 .code { border-collapse:collapse; width:100%; }
10 .code { font-family: "Monospace", monospace; font-size:10pt }
11 .code { line-height: 1.2em }
12 .comment { color: green; font-style: oblique }
13 .keyword { color: blue }
14 .string_literal { color: red }
15 .directive { color: darkmagenta }
16 .expansion { display: none; }
17 .macro:hover .expansion { display: block; border: 2px solid #FF0000; padding: 2px; background-color:#FFF0F0; font-weight: normal; -webkit-border-radius:5px; -webkit-box-shadow:1px 1px 7px #000; border-radius:5px; box-shadow:1px 1px 7px #000; position: absolute; top: -1em; left:10em; z-index: 1 }
18 .macro { color: darkmagenta; background-color:LemonChiffon; position: relative }
19 .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }
20 .num { text-align:right; font-size:8pt }
21 .num { color:#444444 }
22 .line { padding-left: 1ex; border-left: 3px solid #ccc }
23 .line { white-space: pre }
24 .msg { -webkit-box-shadow:1px 1px 7px #000 }
25 .msg { box-shadow:1px 1px 7px #000 }
26 .msg { -webkit-border-radius:5px }
27 .msg { border-radius:5px }
28 .msg { font-family:Helvetica, sans-serif; font-size:8pt }
29 .msg { float:left }
30 .msg { padding:0.25em 1ex 0.25em 1ex }
31 .msg { margin-top:10px; margin-bottom:10px }
32 .msg { font-weight:bold }
33 .msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap }
34 .msgT { padding:0x; spacing:0x }
35 .msgEvent { background-color:#fff8b4; color:#000000 }
36 .msgControl { background-color:#bbbbbb; color:#000000 }
37 .msgNote { background-color:#ddeeff; color:#000000 }
38 .mrange { background-color:#dfddf3 }
39 .mrange { border-bottom:1px solid #6F9DBE }
40 .PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; }
41 .PathIndex { -webkit-border-radius:8px }
42 .PathIndex { border-radius:8px }
43 .PathIndexEvent { background-color:#bfba87 }
44 .PathIndexControl { background-color:#8c8c8c }
45 .PathNav a { text-decoration:none; font-size: larger }
46 .CodeInsertionHint { font-weight: bold; background-color: #10dd10 }
47 .CodeRemovalHint { background-color:#de1010 }
48 .CodeRemovalHint { border-bottom:1px solid #6F9DBE }
49 table.simpletable {
50 padding: 5px;
51 font-size:12pt;
52 margin:20px;
53 border-collapse: collapse; border-spacing: 0px;
54 }
55 td.rowname {
56 text-align: right;
57 vertical-align: top;
58 font-weight: bold;
59 color:#444444;
60 padding-right:2ex;
61 }
62</style>
63</head>
64<body>
65<!-- BUGDESC Use of memory after it is freed -->
66
67<!-- BUGTYPE Use-after-free -->
68
69<!-- BUGCATEGORY Memory Error -->
70
71<!-- BUGFILE /home/haiku/haiku/haiku/src/add-ons/kernel/drivers/common/usb_modeswitch.cpp -->
72
73<!-- FILENAME usb_modeswitch.cpp -->
74
75<!-- FUNCTIONNAME my_device_added -->
76
77<!-- ISSUEHASHCONTENTOFLINEINCONTEXT 26a46c7329eb0bc655ba2200c4a8241d -->
78
79<!-- BUGLINE 538 -->
80
81<!-- BUGCOLUMN 10 -->
82
83<!-- BUGPATHLENGTH 56 -->
84
85<!-- BUGMETAEND -->
86<!-- REPORTHEADER -->
87<h3>Bug Summary</h3>
88<table class="simpletable">
89<tr><td class="rowname">File:</td><td>src/add-ons/kernel/drivers/common/usb_modeswitch.cpp</td></tr>
90<tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 538, column 10</a><br />Use of memory after it is freed</td></tr>
91</table>
92<!-- REPORTSUMMARYEXTRA -->
93<h3>Annotated Source Code</h3>
94<table class="code">
95<tr><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr>
96<tr><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright 2010, Haiku Inc. All rights reserved.</span></td></tr>
97<tr><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Distributed under the terms of the MIT License.</span></td></tr>
98<tr><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr>
99<tr><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* Authors:</span></td></tr>
100<tr><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* Jérôme Duval, korli@users.berlios.de</span></td></tr>
101<tr><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>*/</span></td></tr>
102<tr><td class="num" id="LN8">8</td><td class="line"> </td></tr>
103<tr><td class="num" id="LN9">9</td><td class="line"><span class='comment'>/*</span></td></tr>
104<tr><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>Devices and messages reference: usb-modeswitch-data-20100826</span></td></tr>
105<tr><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>Huawei devices updated to usb-modeswitch-data-20150115</span></td></tr>
106<tr><td class="num" id="LN12">12</td><td class="line"><span class='comment'>*/</span></td></tr>
107<tr><td class="num" id="LN13">13</td><td class="line"> </td></tr>
108<tr><td class="num" id="LN14">14</td><td class="line"><span class='directive'>#include &lt;ByteOrder.h&gt;</span></td></tr>
109<tr><td class="num" id="LN15">15</td><td class="line"><span class='directive'>#include &lt;Drivers.h&gt;</span></td></tr>
110<tr><td class="num" id="LN16">16</td><td class="line"><span class='directive'>#include &lt;KernelExport.h&gt;</span></td></tr>
111<tr><td class="num" id="LN17">17</td><td class="line"><span class='directive'>#include &lt;lock.h&gt;</span></td></tr>
112<tr><td class="num" id="LN18">18</td><td class="line"><span class='directive'>#include &lt;USB3.h&gt;</span></td></tr>
113<tr><td class="num" id="LN19">19</td><td class="line"> </td></tr>
114<tr><td class="num" id="LN20">20</td><td class="line"><span class='directive'>#include &lt;malloc.h&gt;</span></td></tr>
115<tr><td class="num" id="LN21">21</td><td class="line"><span class='directive'>#include &lt;stdio.h&gt;</span></td></tr>
116<tr><td class="num" id="LN22">22</td><td class="line"><span class='directive'>#include &lt;string.h&gt;</span></td></tr>
117<tr><td class="num" id="LN23">23</td><td class="line"> </td></tr>
118<tr><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#define <span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> "usb_modeswitch"</span></td></tr>
119<tr><td class="num" id="LN25">25</td><td class="line"> </td></tr>
120<tr><td class="num" id="LN26">26</td><td class="line"><span class='directive'>#define <span class='macro'>TRACE_USB_MODESWITCH<span class='expansion'>1</span></span> 1</span></td></tr>
121<tr><td class="num" id="LN27">27</td><td class="line"><span class='directive'>#ifdef <span class='macro'>TRACE_USB_MODESWITCH<span class='expansion'>1</span></span></span></td></tr>
122<tr><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#define <span class='macro'>TRACE(x...)<span class='expansion'>dprintf("usb_modeswitch" ": " x...)</span></span> dprintf(<span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> ": " x)</span></td></tr>
123<tr><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#else</span></td></tr>
124<tr><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#define <span class='macro'>TRACE(x...)<span class='expansion'>dprintf("usb_modeswitch" ": " x...)</span></span> /* nothing */</span></td></tr>
125<tr><td class="num" id="LN31">31</td><td class="line"><span class='directive'>#endif</span></td></tr>
126<tr><td class="num" id="LN32">32</td><td class="line"><span class='directive'>#define <span class='macro'>TRACE_ALWAYS(x...)<span class='expansion'>dprintf("usb_modeswitch" ": " x...)</span></span> dprintf(<span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> ": " x)</span></td></tr>
127<tr><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#define <span class='macro'>ENTER()<span class='expansion'>dprintf("usb_modeswitch" ": " "%s", __FUNCTION__)</span></span> <span class='macro'>TRACE("%s", __FUNCTION__)<span class='expansion'>dprintf("usb_modeswitch" ": " "%s", __FUNCTION__)</span></span></span></td></tr>
128<tr><td class="num" id="LN34">34</td><td class="line"> </td></tr>
129<tr><td class="num" id="LN35">35</td><td class="line"> </td></tr>
130<tr><td class="num" id="LN36">36</td><td class="line"><span class='keyword'>enum</span> msgType {</td></tr>
131<tr><td class="num" id="LN37">37</td><td class="line"> MSG_HUAWEI_1 = 0,</td></tr>
132<tr><td class="num" id="LN38">38</td><td class="line"> MSG_HUAWEI_2,</td></tr>
133<tr><td class="num" id="LN39">39</td><td class="line"> MSG_HUAWEI_3,</td></tr>
134<tr><td class="num" id="LN40">40</td><td class="line"> MSG_NOKIA_1,</td></tr>
135<tr><td class="num" id="LN41">41</td><td class="line"> MSG_OLIVETTI_1,</td></tr>
136<tr><td class="num" id="LN42">42</td><td class="line"> MSG_OLIVETTI_2,</td></tr>
137<tr><td class="num" id="LN43">43</td><td class="line"> MSG_OPTION_1,</td></tr>
138<tr><td class="num" id="LN44">44</td><td class="line"> MSG_ATHEROS_1,</td></tr>
139<tr><td class="num" id="LN45">45</td><td class="line"> MSG_ZTE_1,</td></tr>
140<tr><td class="num" id="LN46">46</td><td class="line"> MSG_ZTE_2,</td></tr>
141<tr><td class="num" id="LN47">47</td><td class="line"> MSG_ZTE_3,</td></tr>
142<tr><td class="num" id="LN48">48</td><td class="line"> MSG_NONE</td></tr>
143<tr><td class="num" id="LN49">49</td><td class="line">};</td></tr>
144<tr><td class="num" id="LN50">50</td><td class="line"> </td></tr>
145<tr><td class="num" id="LN51">51</td><td class="line"> </td></tr>
146<tr><td class="num" id="LN52">52</td><td class="line"><span class='keyword'>unsigned</span> <span class='keyword'>char</span> kDevicesMsg[][31] = {</td></tr>
147<tr><td class="num" id="LN53">53</td><td class="line"> { <span class='comment'>/* MSG_HUAWEI_1 */</span></td></tr>
148<tr><td class="num" id="LN54">54</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
149<tr><td class="num" id="LN55">55</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,</td></tr>
150<tr><td class="num" id="LN56">56</td><td class="line"> 0x06, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,</td></tr>
151<tr><td class="num" id="LN57">57</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
152<tr><td class="num" id="LN58">58</td><td class="line"> },</td></tr>
153<tr><td class="num" id="LN59">59</td><td class="line"> { <span class='comment'>/* MSG_HUAWEI_2 */</span></td></tr>
154<tr><td class="num" id="LN60">60</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
155<tr><td class="num" id="LN61">61</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x0a, 0x11,</td></tr>
156<tr><td class="num" id="LN62">62</td><td class="line"> 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,</td></tr>
157<tr><td class="num" id="LN63">63</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
158<tr><td class="num" id="LN64">64</td><td class="line"> },</td></tr>
159<tr><td class="num" id="LN65">65</td><td class="line"> { <span class='comment'>/* MSG_HUAWEI_3 */</span></td></tr>
160<tr><td class="num" id="LN66">66</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
161<tr><td class="num" id="LN67">67</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,</td></tr>
162<tr><td class="num" id="LN68">68</td><td class="line"> 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,</td></tr>
163<tr><td class="num" id="LN69">69</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
164<tr><td class="num" id="LN70">70</td><td class="line"> },</td></tr>
165<tr><td class="num" id="LN71">71</td><td class="line"> { <span class='comment'>/* MSG_NOKIA_1 */</span></td></tr>
166<tr><td class="num" id="LN72">72</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
167<tr><td class="num" id="LN73">73</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1b,</td></tr>
168<tr><td class="num" id="LN74">74</td><td class="line"> 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,</td></tr>
169<tr><td class="num" id="LN75">75</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
170<tr><td class="num" id="LN76">76</td><td class="line"> },</td></tr>
171<tr><td class="num" id="LN77">77</td><td class="line"> { <span class='comment'>/* MSG_OLIVETTI_1 */</span></td></tr>
172<tr><td class="num" id="LN78">78</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
173<tr><td class="num" id="LN79">79</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1b,</td></tr>
174<tr><td class="num" id="LN80">80</td><td class="line"> 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,</td></tr>
175<tr><td class="num" id="LN81">81</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
176<tr><td class="num" id="LN82">82</td><td class="line"> },</td></tr>
177<tr><td class="num" id="LN83">83</td><td class="line"> { <span class='comment'>/* MSG_OLIVETTI_2 */</span></td></tr>
178<tr><td class="num" id="LN84">84</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
179<tr><td class="num" id="LN85">85</td><td class="line"> 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x06, 0x06,</td></tr>
180<tr><td class="num" id="LN86">86</td><td class="line"> 0xf5, 0x04, 0x02, 0x52, 0x70, 0x00, 0x00, 0x00,</td></tr>
181<tr><td class="num" id="LN87">87</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
182<tr><td class="num" id="LN88">88</td><td class="line"> },</td></tr>
183<tr><td class="num" id="LN89">89</td><td class="line"> { <span class='comment'>/* MSG_OPTION_1 */</span></td></tr>
184<tr><td class="num" id="LN90">90</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12,</td></tr>
185<tr><td class="num" id="LN91">91</td><td class="line"> 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x10,</td></tr>
186<tr><td class="num" id="LN92">92</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,</td></tr>
187<tr><td class="num" id="LN93">93</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
188<tr><td class="num" id="LN94">94</td><td class="line"> },</td></tr>
189<tr><td class="num" id="LN95">95</td><td class="line"> { <span class='comment'>/* MSG_ATHEROS_1 */</span></td></tr>
190<tr><td class="num" id="LN96">96</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x29, 0x00, 0x00, 0x00,</td></tr>
191<tr><td class="num" id="LN97">97</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1b,</td></tr>
192<tr><td class="num" id="LN98">98</td><td class="line"> 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,</td></tr>
193<tr><td class="num" id="LN99">99</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
194<tr><td class="num" id="LN100">100</td><td class="line"> },</td></tr>
195<tr><td class="num" id="LN101">101</td><td class="line"> { <span class='comment'>/* MSG_ZTE_1 */</span></td></tr>
196<tr><td class="num" id="LN102">102</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,</td></tr>
197<tr><td class="num" id="LN103">103</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1e,</td></tr>
198<tr><td class="num" id="LN104">104</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,</td></tr>
199<tr><td class="num" id="LN105">105</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
200<tr><td class="num" id="LN106">106</td><td class="line"> },</td></tr>
201<tr><td class="num" id="LN107">107</td><td class="line"> { <span class='comment'>/* MSG_ZTE_2 */</span></td></tr>
202<tr><td class="num" id="LN108">108</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x79,</td></tr>
203<tr><td class="num" id="LN109">109</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1b,</td></tr>
204<tr><td class="num" id="LN110">110</td><td class="line"> 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,</td></tr>
205<tr><td class="num" id="LN111">111</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
206<tr><td class="num" id="LN112">112</td><td class="line"> },</td></tr>
207<tr><td class="num" id="LN113">113</td><td class="line"> { <span class='comment'>/* MSG_ZTE_3 */</span></td></tr>
208<tr><td class="num" id="LN114">114</td><td class="line"> 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x70,</td></tr>
209<tr><td class="num" id="LN115">115</td><td class="line"> 0x20, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0c, 0x85,</td></tr>
210<tr><td class="num" id="LN116">116</td><td class="line"> 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,</td></tr>
211<tr><td class="num" id="LN117">117</td><td class="line"> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00</td></tr>
212<tr><td class="num" id="LN118">118</td><td class="line"> }</td></tr>
213<tr><td class="num" id="LN119">119</td><td class="line">};</td></tr>
214<tr><td class="num" id="LN120">120</td><td class="line"> </td></tr>
215<tr><td class="num" id="LN121">121</td><td class="line"> </td></tr>
216<tr><td class="num" id="LN122">122</td><td class="line"><span class='directive'>#define <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span> 0x12d1</span></td></tr>
217<tr><td class="num" id="LN123">123</td><td class="line"><span class='directive'>#define <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span> 0x0421</span></td></tr>
218<tr><td class="num" id="LN124">124</td><td class="line"><span class='directive'>#define <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span> 0x1410</span></td></tr>
219<tr><td class="num" id="LN125">125</td><td class="line"><span class='directive'>#define <span class='macro'>ZYDAS_VENDOR<span class='expansion'>0x0ace</span></span> 0x0ace</span></td></tr>
220<tr><td class="num" id="LN126">126</td><td class="line"><span class='directive'>#define <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span> 0x19d2</span></td></tr>
221<tr><td class="num" id="LN127">127</td><td class="line"><span class='directive'>#define <span class='macro'>OLIVETTI_VENDOR<span class='expansion'>0x0b3c</span></span> 0x0b3c</span></td></tr>
222<tr><td class="num" id="LN128">128</td><td class="line"><span class='directive'>#define <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span> 0x0af0</span></td></tr>
223<tr><td class="num" id="LN129">129</td><td class="line"><span class='directive'>#define <span class='macro'>ATHEROS_VENDOR<span class='expansion'>0x0cf3</span></span> 0x0cf3</span></td></tr>
224<tr><td class="num" id="LN130">130</td><td class="line"> </td></tr>
225<tr><td class="num" id="LN131">131</td><td class="line"> </td></tr>
226<tr><td class="num" id="LN132">132</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> <span class='keyword'>struct</span> {</td></tr>
227<tr><td class="num" id="LN133">133</td><td class="line"> usb_support_descriptor desc;</td></tr>
228<tr><td class="num" id="LN134">134</td><td class="line"> msgType type, type2, type3;</td></tr>
229<tr><td class="num" id="LN135">135</td><td class="line">} kDevices[] = {</td></tr>
230<tr><td class="num" id="LN136">136</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x101e}, MSG_HUAWEI_1},</td></tr>
231<tr><td class="num" id="LN137">137</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1030}, MSG_HUAWEI_2},</td></tr>
232<tr><td class="num" id="LN138">138</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1031}, MSG_HUAWEI_2},</td></tr>
233<tr><td class="num" id="LN139">139</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1446}, MSG_HUAWEI_3},</td></tr>
234<tr><td class="num" id="LN140">140</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1449}, MSG_HUAWEI_3},</td></tr>
235<tr><td class="num" id="LN141">141</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14ad}, MSG_HUAWEI_3},</td></tr>
236<tr><td class="num" id="LN142">142</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14b5}, MSG_HUAWEI_3},</td></tr>
237<tr><td class="num" id="LN143">143</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14b7}, MSG_HUAWEI_3},</td></tr>
238<tr><td class="num" id="LN144">144</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14ba}, MSG_HUAWEI_3},</td></tr>
239<tr><td class="num" id="LN145">145</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14c1}, MSG_HUAWEI_3},</td></tr>
240<tr><td class="num" id="LN146">146</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14c3}, MSG_HUAWEI_3},</td></tr>
241<tr><td class="num" id="LN147">147</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14c4}, MSG_HUAWEI_3},</td></tr>
242<tr><td class="num" id="LN148">148</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14c5}, MSG_HUAWEI_3},</td></tr>
243<tr><td class="num" id="LN149">149</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14d1}, MSG_HUAWEI_3},</td></tr>
244<tr><td class="num" id="LN150">150</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x14fe}, MSG_HUAWEI_3},</td></tr>
245<tr><td class="num" id="LN151">151</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1505}, MSG_HUAWEI_3},</td></tr>
246<tr><td class="num" id="LN152">152</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x151a}, MSG_HUAWEI_3},</td></tr>
247<tr><td class="num" id="LN153">153</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1520}, MSG_HUAWEI_3},</td></tr>
248<tr><td class="num" id="LN154">154</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1521}, MSG_HUAWEI_3},</td></tr>
249<tr><td class="num" id="LN155">155</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1523}, MSG_HUAWEI_3},</td></tr>
250<tr><td class="num" id="LN156">156</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1526}, MSG_HUAWEI_3},</td></tr>
251<tr><td class="num" id="LN157">157</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1553}, MSG_HUAWEI_3},</td></tr>
252<tr><td class="num" id="LN158">158</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1557}, MSG_HUAWEI_3},</td></tr>
253<tr><td class="num" id="LN159">159</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x155b}, MSG_HUAWEI_3},</td></tr>
254<tr><td class="num" id="LN160">160</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x156a}, MSG_HUAWEI_3},</td></tr>
255<tr><td class="num" id="LN161">161</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1576}, MSG_HUAWEI_3},</td></tr>
256<tr><td class="num" id="LN162">162</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x157d}, MSG_HUAWEI_3},</td></tr>
257<tr><td class="num" id="LN163">163</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1583}, MSG_HUAWEI_3},</td></tr>
258<tr><td class="num" id="LN164">164</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x15ca}, MSG_HUAWEI_3},</td></tr>
259<tr><td class="num" id="LN165">165</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x15e7}, MSG_HUAWEI_3},</td></tr>
260<tr><td class="num" id="LN166">166</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1c0b}, MSG_HUAWEI_3},</td></tr>
261<tr><td class="num" id="LN167">167</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1c1b}, MSG_HUAWEI_3},</td></tr>
262<tr><td class="num" id="LN168">168</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1c24}, MSG_HUAWEI_3},</td></tr>
263<tr><td class="num" id="LN169">169</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1da1}, MSG_HUAWEI_3},</td></tr>
264<tr><td class="num" id="LN170">170</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f01}, MSG_HUAWEI_3},</td></tr>
265<tr><td class="num" id="LN171">171</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f02}, MSG_HUAWEI_3},</td></tr>
266<tr><td class="num" id="LN172">172</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f03}, MSG_HUAWEI_3},</td></tr>
267<tr><td class="num" id="LN173">173</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f11}, MSG_HUAWEI_3},</td></tr>
268<tr><td class="num" id="LN174">174</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f15}, MSG_HUAWEI_3},</td></tr>
269<tr><td class="num" id="LN175">175</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f16}, MSG_HUAWEI_3},</td></tr>
270<tr><td class="num" id="LN176">176</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f17}, MSG_HUAWEI_3},</td></tr>
271<tr><td class="num" id="LN177">177</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f18}, MSG_HUAWEI_3},</td></tr>
272<tr><td class="num" id="LN178">178</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f19}, MSG_HUAWEI_3},</td></tr>
273<tr><td class="num" id="LN179">179</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f1b}, MSG_HUAWEI_3},</td></tr>
274<tr><td class="num" id="LN180">180</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f1c}, MSG_HUAWEI_3},</td></tr>
275<tr><td class="num" id="LN181">181</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f1d}, MSG_HUAWEI_3},</td></tr>
276<tr><td class="num" id="LN182">182</td><td class="line"> {{ 0, 0, 0, <span class='macro'>HUAWEI_VENDOR<span class='expansion'>0x12d1</span></span>, 0x1f1e}, MSG_HUAWEI_3},</td></tr>
277<tr><td class="num" id="LN183">183</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x060c}, MSG_NOKIA_1},</td></tr>
278<tr><td class="num" id="LN184">184</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x0610}, MSG_NOKIA_1},</td></tr>
279<tr><td class="num" id="LN185">185</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x061d}, MSG_NOKIA_1},</td></tr>
280<tr><td class="num" id="LN186">186</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x0622}, MSG_NOKIA_1},</td></tr>
281<tr><td class="num" id="LN187">187</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x0627}, MSG_NOKIA_1},</td></tr>
282<tr><td class="num" id="LN188">188</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x062c}, MSG_NOKIA_1},</td></tr>
283<tr><td class="num" id="LN189">189</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x0632}, MSG_NOKIA_1},</td></tr>
284<tr><td class="num" id="LN190">190</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOKIA_VENDOR<span class='expansion'>0x0421</span></span>, 0x0637}, MSG_NOKIA_1},</td></tr>
285<tr><td class="num" id="LN191">191</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5010}, MSG_NOKIA_1},</td></tr>
286<tr><td class="num" id="LN192">192</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5020}, MSG_NOKIA_1},</td></tr>
287<tr><td class="num" id="LN193">193</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5030}, MSG_NOKIA_1},</td></tr>
288<tr><td class="num" id="LN194">194</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5031}, MSG_NOKIA_1},</td></tr>
289<tr><td class="num" id="LN195">195</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5041}, MSG_NOKIA_1},</td></tr>
290<tr><td class="num" id="LN196">196</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x5059}, MSG_NOKIA_1},</td></tr>
291<tr><td class="num" id="LN197">197</td><td class="line"> {{ 0, 0, 0, <span class='macro'>NOVATEL_VENDOR<span class='expansion'>0x1410</span></span>, 0x7001}, MSG_NOKIA_1},</td></tr>
292<tr><td class="num" id="LN198">198</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZYDAS_VENDOR<span class='expansion'>0x0ace</span></span>, 0x2011}, MSG_NOKIA_1},</td></tr>
293<tr><td class="num" id="LN199">199</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZYDAS_VENDOR<span class='expansion'>0x0ace</span></span>, 0x20ff}, MSG_NOKIA_1},</td></tr>
294<tr><td class="num" id="LN200">200</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0013}, MSG_NOKIA_1},</td></tr>
295<tr><td class="num" id="LN201">201</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0026}, MSG_NOKIA_1},</td></tr>
296<tr><td class="num" id="LN202">202</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0031}, MSG_NOKIA_1},</td></tr>
297<tr><td class="num" id="LN203">203</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0083}, MSG_NOKIA_1},</td></tr>
298<tr><td class="num" id="LN204">204</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0101}, MSG_NOKIA_1},</td></tr>
299<tr><td class="num" id="LN205">205</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0115}, MSG_NOKIA_1},</td></tr>
300<tr><td class="num" id="LN206">206</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0120}, MSG_NOKIA_1},</td></tr>
301<tr><td class="num" id="LN207">207</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0169}, MSG_NOKIA_1},</td></tr>
302<tr><td class="num" id="LN208">208</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0325}, MSG_NOKIA_1},</td></tr>
303<tr><td class="num" id="LN209">209</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1001}, MSG_NOKIA_1},</td></tr>
304<tr><td class="num" id="LN210">210</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1007}, MSG_NOKIA_1},</td></tr>
305<tr><td class="num" id="LN211">211</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1009}, MSG_NOKIA_1},</td></tr>
306<tr><td class="num" id="LN212">212</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1013}, MSG_NOKIA_1},</td></tr>
307<tr><td class="num" id="LN213">213</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1017}, MSG_NOKIA_1},</td></tr>
308<tr><td class="num" id="LN214">214</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1171}, MSG_NOKIA_1},</td></tr>
309<tr><td class="num" id="LN215">215</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1175}, MSG_NOKIA_1},</td></tr>
310<tr><td class="num" id="LN216">216</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1179}, MSG_NOKIA_1},</td></tr>
311<tr><td class="num" id="LN217">217</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1201}, MSG_NOKIA_1},</td></tr>
312<tr><td class="num" id="LN218">218</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1523}, MSG_NOKIA_1},</td></tr>
313<tr><td class="num" id="LN219">219</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0xffde}, MSG_NOKIA_1},</td></tr>
314<tr><td class="num" id="LN220">220</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0003}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
315<tr><td class="num" id="LN221">221</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0053}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
316<tr><td class="num" id="LN222">222</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0103}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
317<tr><td class="num" id="LN223">223</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0154}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
318<tr><td class="num" id="LN224">224</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1224}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
319<tr><td class="num" id="LN225">225</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1517}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
320<tr><td class="num" id="LN226">226</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x1542}, MSG_ZTE_1, MSG_ZTE_2},</td></tr>
321<tr><td class="num" id="LN227">227</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x0149}, MSG_ZTE_1, MSG_ZTE_2, MSG_ZTE_3},</td></tr>
322<tr><td class="num" id="LN228">228</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ZTE_VENDOR<span class='expansion'>0x19d2</span></span>, 0x2000}, MSG_ZTE_1, MSG_ZTE_2, MSG_ZTE_3},</td></tr>
323<tr><td class="num" id="LN229">229</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OLIVETTI_VENDOR<span class='expansion'>0x0b3c</span></span>, 0xc700}, MSG_OLIVETTI_1},</td></tr>
324<tr><td class="num" id="LN230">230</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OLIVETTI_VENDOR<span class='expansion'>0x0b3c</span></span>, 0xf000}, MSG_OLIVETTI_2},</td></tr>
325<tr><td class="num" id="LN231">231</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6711}, MSG_OPTION_1},</td></tr>
326<tr><td class="num" id="LN232">232</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6731}, MSG_OPTION_1},</td></tr>
327<tr><td class="num" id="LN233">233</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6751}, MSG_OPTION_1},</td></tr>
328<tr><td class="num" id="LN234">234</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6771}, MSG_OPTION_1},</td></tr>
329<tr><td class="num" id="LN235">235</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6791}, MSG_OPTION_1},</td></tr>
330<tr><td class="num" id="LN236">236</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6811}, MSG_OPTION_1},</td></tr>
331<tr><td class="num" id="LN237">237</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6911}, MSG_OPTION_1},</td></tr>
332<tr><td class="num" id="LN238">238</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6951}, MSG_OPTION_1},</td></tr>
333<tr><td class="num" id="LN239">239</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x6971}, MSG_OPTION_1},</td></tr>
334<tr><td class="num" id="LN240">240</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7011}, MSG_OPTION_1},</td></tr>
335<tr><td class="num" id="LN241">241</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7031}, MSG_OPTION_1},</td></tr>
336<tr><td class="num" id="LN242">242</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7051}, MSG_OPTION_1},</td></tr>
337<tr><td class="num" id="LN243">243</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7071}, MSG_OPTION_1},</td></tr>
338<tr><td class="num" id="LN244">244</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7111}, MSG_OPTION_1},</td></tr>
339<tr><td class="num" id="LN245">245</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7211}, MSG_OPTION_1},</td></tr>
340<tr><td class="num" id="LN246">246</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7251}, MSG_OPTION_1},</td></tr>
341<tr><td class="num" id="LN247">247</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7271}, MSG_OPTION_1},</td></tr>
342<tr><td class="num" id="LN248">248</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7301}, MSG_OPTION_1},</td></tr>
343<tr><td class="num" id="LN249">249</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7311}, MSG_OPTION_1},</td></tr>
344<tr><td class="num" id="LN250">250</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7361}, MSG_OPTION_1},</td></tr>
345<tr><td class="num" id="LN251">251</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7381}, MSG_OPTION_1},</td></tr>
346<tr><td class="num" id="LN252">252</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7401}, MSG_OPTION_1},</td></tr>
347<tr><td class="num" id="LN253">253</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7501}, MSG_OPTION_1},</td></tr>
348<tr><td class="num" id="LN254">254</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7601}, MSG_OPTION_1},</td></tr>
349<tr><td class="num" id="LN255">255</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7701}, MSG_OPTION_1},</td></tr>
350<tr><td class="num" id="LN256">256</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7706}, MSG_OPTION_1},</td></tr>
351<tr><td class="num" id="LN257">257</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7801}, MSG_OPTION_1},</td></tr>
352<tr><td class="num" id="LN258">258</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x7901}, MSG_OPTION_1},</td></tr>
353<tr><td class="num" id="LN259">259</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8006}, MSG_OPTION_1},</td></tr>
354<tr><td class="num" id="LN260">260</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8200}, MSG_OPTION_1},</td></tr>
355<tr><td class="num" id="LN261">261</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8201}, MSG_OPTION_1},</td></tr>
356<tr><td class="num" id="LN262">262</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8300}, MSG_OPTION_1},</td></tr>
357<tr><td class="num" id="LN263">263</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8302}, MSG_OPTION_1},</td></tr>
358<tr><td class="num" id="LN264">264</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8304}, MSG_OPTION_1},</td></tr>
359<tr><td class="num" id="LN265">265</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8400}, MSG_OPTION_1},</td></tr>
360<tr><td class="num" id="LN266">266</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8600}, MSG_OPTION_1},</td></tr>
361<tr><td class="num" id="LN267">267</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8800}, MSG_OPTION_1},</td></tr>
362<tr><td class="num" id="LN268">268</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x8900}, MSG_OPTION_1},</td></tr>
363<tr><td class="num" id="LN269">269</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0x9000}, MSG_OPTION_1},</td></tr>
364<tr><td class="num" id="LN270">270</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xc031}, MSG_OPTION_1},</td></tr>
365<tr><td class="num" id="LN271">271</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xc100}, MSG_OPTION_1},</td></tr>
366<tr><td class="num" id="LN272">272</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xc031}, MSG_OPTION_1},</td></tr>
367<tr><td class="num" id="LN273">273</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd013}, MSG_OPTION_1},</td></tr>
368<tr><td class="num" id="LN274">274</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd031}, MSG_OPTION_1},</td></tr>
369<tr><td class="num" id="LN275">275</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd033}, MSG_OPTION_1},</td></tr>
370<tr><td class="num" id="LN276">276</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd035}, MSG_OPTION_1},</td></tr>
371<tr><td class="num" id="LN277">277</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd055}, MSG_OPTION_1},</td></tr>
372<tr><td class="num" id="LN278">278</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd057}, MSG_OPTION_1},</td></tr>
373<tr><td class="num" id="LN279">279</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd058}, MSG_OPTION_1},</td></tr>
374<tr><td class="num" id="LN280">280</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd155}, MSG_OPTION_1},</td></tr>
375<tr><td class="num" id="LN281">281</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd157}, MSG_OPTION_1},</td></tr>
376<tr><td class="num" id="LN282">282</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd255}, MSG_OPTION_1},</td></tr>
377<tr><td class="num" id="LN283">283</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd257}, MSG_OPTION_1},</td></tr>
378<tr><td class="num" id="LN284">284</td><td class="line"> {{ 0, 0, 0, <span class='macro'>OPTION_VENDOR<span class='expansion'>0x0af0</span></span>, 0xd357}, MSG_OPTION_1},</td></tr>
379<tr><td class="num" id="LN285">285</td><td class="line"> {{ 0, 0, 0, <span class='macro'>ATHEROS_VENDOR<span class='expansion'>0x0cf3</span></span>, 0x20ff}, MSG_ATHEROS_1},</td></tr>
380<tr><td class="num" id="LN286">286</td><td class="line">};</td></tr>
381<tr><td class="num" id="LN287">287</td><td class="line"><span class='keyword'>static</span> uint32 kDevicesCount = <span class='keyword'>sizeof</span>(kDevices) / <span class='keyword'>sizeof</span>(kDevices[0]);</td></tr>
382<tr><td class="num" id="LN288">288</td><td class="line"> </td></tr>
383<tr><td class="num" id="LN289">289</td><td class="line"> </td></tr>
384<tr><td class="num" id="LN290">290</td><td class="line"><span class='keyword'>typedef</span> <span class='keyword'>struct</span> _my_device {</td></tr>
385<tr><td class="num" id="LN291">291</td><td class="line"> usb_device device;</td></tr>
386<tr><td class="num" id="LN292">292</td><td class="line"> <span class='keyword'>bool</span> removed;</td></tr>
387<tr><td class="num" id="LN293">293</td><td class="line"> mutex lock;</td></tr>
388<tr><td class="num" id="LN294">294</td><td class="line"> <span class='keyword'>struct</span> _my_device *link;</td></tr>
389<tr><td class="num" id="LN295">295</td><td class="line"> </td></tr>
390<tr><td class="num" id="LN296">296</td><td class="line"> <span class='comment'>// device state</span></td></tr>
391<tr><td class="num" id="LN297">297</td><td class="line"> usb_pipe bulk_in;</td></tr>
392<tr><td class="num" id="LN298">298</td><td class="line"> usb_pipe bulk_out;</td></tr>
393<tr><td class="num" id="LN299">299</td><td class="line"> uint8 interface;</td></tr>
394<tr><td class="num" id="LN300">300</td><td class="line"> uint8 alternate_setting;</td></tr>
395<tr><td class="num" id="LN301">301</td><td class="line"> </td></tr>
396<tr><td class="num" id="LN302">302</td><td class="line"> <span class='comment'>// used to store callback information</span></td></tr>
397<tr><td class="num" id="LN303">303</td><td class="line"> sem_id notify;</td></tr>
398<tr><td class="num" id="LN304">304</td><td class="line"> status_t status;</td></tr>
399<tr><td class="num" id="LN305">305</td><td class="line"> size_t actual_length;</td></tr>
400<tr><td class="num" id="LN306">306</td><td class="line"> </td></tr>
401<tr><td class="num" id="LN307">307</td><td class="line"> msgType type[3];</td></tr>
402<tr><td class="num" id="LN308">308</td><td class="line">} my_device;</td></tr>
403<tr><td class="num" id="LN309">309</td><td class="line"> </td></tr>
404<tr><td class="num" id="LN310">310</td><td class="line"> </td></tr>
405<tr><td class="num" id="LN311">311</td><td class="line">int32 api_version = <span class='macro'>B_CUR_DRIVER_API_VERSION<span class='expansion'>2</span></span>;</td></tr>
406<tr><td class="num" id="LN312">312</td><td class="line"><span class='keyword'>static</span> usb_module_info *gUSBModule = <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
407<tr><td class="num" id="LN313">313</td><td class="line"><span class='keyword'>static</span> my_device *gDeviceList = <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
408<tr><td class="num" id="LN314">314</td><td class="line"><span class='keyword'>static</span> uint32 gDeviceCount = 0;</td></tr>
409<tr><td class="num" id="LN315">315</td><td class="line"><span class='keyword'>static</span> mutex gDeviceListLock;</td></tr>
410<tr><td class="num" id="LN316">316</td><td class="line"> </td></tr>
411<tr><td class="num" id="LN317">317</td><td class="line"> </td></tr>
412<tr><td class="num" id="LN318">318</td><td class="line"><span class='comment'>//</span></td></tr>
413<tr><td class="num" id="LN319">319</td><td class="line"><span class='comment'>//#pragma mark - Device Allocation Helper Functions</span></td></tr>
414<tr><td class="num" id="LN320">320</td><td class="line"><span class='comment'>//</span></td></tr>
415<tr><td class="num" id="LN321">321</td><td class="line"> </td></tr>
416<tr><td class="num" id="LN322">322</td><td class="line"> </td></tr>
417<tr><td class="num" id="LN323">323</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span></td></tr>
418<tr><td class="num" id="LN324">324</td><td class="line">my_free_device(my_device *device)</td></tr>
419<tr><td class="num" id="LN325">325</td><td class="line">{</td></tr>
420<tr><td class="num" id="LN326">326</td><td class="line"> mutex_lock(&amp;device-&gt;lock);</td></tr>
421<tr><td class="num" id="LN327">327</td><td class="line"> mutex_destroy(&amp;device-&gt;lock);</td></tr>
422<tr><td class="num" id="LN328">328</td><td class="line"> delete_sem(device-&gt;notify);</td></tr>
423<tr><td class="num" id="LN329">329</td><td class="line"> free(device);</td></tr>
424<tr><td class="num" id="LN330">330</td><td class="line">}</td></tr>
425<tr><td class="num" id="LN331">331</td><td class="line"> </td></tr>
426<tr><td class="num" id="LN332">332</td><td class="line"> </td></tr>
427<tr><td class="num" id="LN333">333</td><td class="line"><span class='comment'>//</span></td></tr>
428<tr><td class="num" id="LN334">334</td><td class="line"><span class='comment'>//#pragma mark - Bulk-only Functions</span></td></tr>
429<tr><td class="num" id="LN335">335</td><td class="line"><span class='comment'>//</span></td></tr>
430<tr><td class="num" id="LN336">336</td><td class="line"> </td></tr>
431<tr><td class="num" id="LN337">337</td><td class="line"> </td></tr>
432<tr><td class="num" id="LN338">338</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>void</span></td></tr>
433<tr><td class="num" id="LN339">339</td><td class="line">my_callback(<span class='keyword'>void</span> *cookie, status_t status, <span class='keyword'>void</span> *data,</td></tr>
434<tr><td class="num" id="LN340">340</td><td class="line"> size_t actualLength)</td></tr>
435<tr><td class="num" id="LN341">341</td><td class="line">{</td></tr>
436<tr><td class="num" id="LN342">342</td><td class="line"> my_device *device = (my_device *)cookie;</td></tr>
437<tr><td class="num" id="LN343">343</td><td class="line"> device-&gt;status = status;</td></tr>
438<tr><td class="num" id="LN344">344</td><td class="line"> device-&gt;actual_length = actualLength;</td></tr>
439<tr><td class="num" id="LN345">345</td><td class="line"> release_sem(device-&gt;notify);</td></tr>
440<tr><td class="num" id="LN346">346</td><td class="line">}</td></tr>
441<tr><td class="num" id="LN347">347</td><td class="line"> </td></tr>
442<tr><td class="num" id="LN348">348</td><td class="line"> </td></tr>
443<tr><td class="num" id="LN349">349</td><td class="line"><span class='keyword'>static</span> status_t</td></tr>
444<tr><td class="num" id="LN350">350</td><td class="line">my_transfer_data(my_device *device, <span class='keyword'>bool</span> directionIn, <span class='keyword'>void</span> *data,</td></tr>
445<tr><td class="num" id="LN351">351</td><td class="line"> size_t dataLength)</td></tr>
446<tr><td class="num" id="LN352">352</td><td class="line">{</td></tr>
447<tr><td class="num" id="LN353">353</td><td class="line"> status_t result = gUSBModule-&gt;queue_bulk(directionIn ? device-&gt;bulk_in</td></tr>
448<tr><td class="num" id="LN354">354</td><td class="line"> : device-&gt;bulk_out, data, dataLength, my_callback, device);</td></tr>
449<tr><td class="num" id="LN355">355</td><td class="line"> <span class='keyword'>if</span> (result != <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>) {</td></tr>
450<tr><td class="num" id="LN356">356</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"failed to queue data transfer\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "failed to queue data transfer\n"<br>)</span></span>;</td></tr>
451<tr><td class="num" id="LN357">357</td><td class="line"> <span class='keyword'>return</span> result;</td></tr>
452<tr><td class="num" id="LN358">358</td><td class="line"> }</td></tr>
453<tr><td class="num" id="LN359">359</td><td class="line"> </td></tr>
454<tr><td class="num" id="LN360">360</td><td class="line"> <span class='keyword'>do</span> {</td></tr>
455<tr><td class="num" id="LN361">361</td><td class="line"> bigtime_t timeout = directionIn ? 500000 : 500000;</td></tr>
456<tr><td class="num" id="LN362">362</td><td class="line"> result = acquire_sem_etc(device-&gt;notify, 1, B_RELATIVE_TIMEOUT,</td></tr>
457<tr><td class="num" id="LN363">363</td><td class="line"> timeout);</td></tr>
458<tr><td class="num" id="LN364">364</td><td class="line"> <span class='keyword'>if</span> (result == <span class='macro'>B_TIMED_OUT<span class='expansion'>((-2147483647 - 1) + 9)</span></span>) {</td></tr>
459<tr><td class="num" id="LN365">365</td><td class="line"> <span class='comment'>// Cancel the transfer and collect the sem that should now be</span></td></tr>
460<tr><td class="num" id="LN366">366</td><td class="line"> <span class='comment'>// released through the callback on cancel. Handling of device</span></td></tr>
461<tr><td class="num" id="LN367">367</td><td class="line"> <span class='comment'>// reset is done in usb_printer_operation() when it detects that</span></td></tr>
462<tr><td class="num" id="LN368">368</td><td class="line"> <span class='comment'>// the transfer failed.</span></td></tr>
463<tr><td class="num" id="LN369">369</td><td class="line"> gUSBModule-&gt;cancel_queued_transfers(directionIn ? device-&gt;bulk_in</td></tr>
464<tr><td class="num" id="LN370">370</td><td class="line"> : device-&gt;bulk_out);</td></tr>
465<tr><td class="num" id="LN371">371</td><td class="line"> acquire_sem_etc(device-&gt;notify, 1, B_RELATIVE_TIMEOUT, 0);</td></tr>
466<tr><td class="num" id="LN372">372</td><td class="line"> }</td></tr>
467<tr><td class="num" id="LN373">373</td><td class="line"> } <span class='keyword'>while</span> (result == <span class='macro'>B_INTERRUPTED<span class='expansion'>((-2147483647 - 1) + 10)</span></span>);</td></tr>
468<tr><td class="num" id="LN374">374</td><td class="line"> </td></tr>
469<tr><td class="num" id="LN375">375</td><td class="line"> <span class='keyword'>if</span> (result != <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>) {</td></tr>
470<tr><td class="num" id="LN376">376</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"acquire_sem failed while waiting for data transfer\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "acquire_sem failed while waiting for data transfer\n"<br>)</span></span>;</td></tr>
471<tr><td class="num" id="LN377">377</td><td class="line"> <span class='keyword'>return</span> result;</td></tr>
472<tr><td class="num" id="LN378">378</td><td class="line"> }</td></tr>
473<tr><td class="num" id="LN379">379</td><td class="line"> </td></tr>
474<tr><td class="num" id="LN380">380</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
475<tr><td class="num" id="LN381">381</td><td class="line">}</td></tr>
476<tr><td class="num" id="LN382">382</td><td class="line"> </td></tr>
477<tr><td class="num" id="LN383">383</td><td class="line"> </td></tr>
478<tr><td class="num" id="LN384">384</td><td class="line"><span class='keyword'>enum</span> msgType</td></tr>
479<tr><td class="num" id="LN385">385</td><td class="line">my_get_msg_type(<span class='keyword'>const</span> usb_device_descriptor *desc, <span class='keyword'>int</span> index)</td></tr>
480<tr><td class="num" id="LN386">386</td><td class="line">{</td></tr>
481<tr><td class="num" id="LN387">387</td><td class="line"> <span class='keyword'>for</span> (uint32 i = 0; i &lt; kDevicesCount; i++) {</td></tr>
482<tr><td class="num" id="LN388">388</td><td class="line"> <span class='keyword'>if</span> (kDevices[i].desc.dev_class != 0x0</td></tr>
483<tr><td class="num" id="LN389">389</td><td class="line"> &amp;&amp; kDevices[i].desc.dev_class != desc-&gt;device_class)</td></tr>
484<tr><td class="num" id="LN390">390</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
485<tr><td class="num" id="LN391">391</td><td class="line"> <span class='keyword'>if</span> (kDevices[i].desc.dev_subclass != 0x0</td></tr>
486<tr><td class="num" id="LN392">392</td><td class="line"> &amp;&amp; kDevices[i].desc.dev_subclass != desc-&gt;device_subclass)</td></tr>
487<tr><td class="num" id="LN393">393</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
488<tr><td class="num" id="LN394">394</td><td class="line"> <span class='keyword'>if</span> (kDevices[i].desc.dev_protocol != 0x0</td></tr>
489<tr><td class="num" id="LN395">395</td><td class="line"> &amp;&amp; kDevices[i].desc.dev_protocol != desc-&gt;device_protocol)</td></tr>
490<tr><td class="num" id="LN396">396</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
491<tr><td class="num" id="LN397">397</td><td class="line"> <span class='keyword'>if</span> (kDevices[i].desc.vendor != 0x0</td></tr>
492<tr><td class="num" id="LN398">398</td><td class="line"> &amp;&amp; kDevices[i].desc.vendor != desc-&gt;vendor_id)</td></tr>
493<tr><td class="num" id="LN399">399</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
494<tr><td class="num" id="LN400">400</td><td class="line"> <span class='keyword'>if</span> (kDevices[i].desc.product != 0x0</td></tr>
495<tr><td class="num" id="LN401">401</td><td class="line"> &amp;&amp; kDevices[i].desc.product != desc-&gt;product_id)</td></tr>
496<tr><td class="num" id="LN402">402</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
497<tr><td class="num" id="LN403">403</td><td class="line"> <span class='keyword'>switch</span> (index) {</td></tr>
498<tr><td class="num" id="LN404">404</td><td class="line"> <span class='keyword'>case</span> 0:</td></tr>
499<tr><td class="num" id="LN405">405</td><td class="line"> <span class='keyword'>return</span> kDevices[i].type;</td></tr>
500<tr><td class="num" id="LN406">406</td><td class="line"> <span class='keyword'>case</span> 1:</td></tr>
501<tr><td class="num" id="LN407">407</td><td class="line"> <span class='keyword'>return</span> kDevices[i].type2;</td></tr>
502<tr><td class="num" id="LN408">408</td><td class="line"> <span class='keyword'>case</span> 2:</td></tr>
503<tr><td class="num" id="LN409">409</td><td class="line"> <span class='keyword'>return</span> kDevices[i].type3;</td></tr>
504<tr><td class="num" id="LN410">410</td><td class="line"> }</td></tr>
505<tr><td class="num" id="LN411">411</td><td class="line"> </td></tr>
506<tr><td class="num" id="LN412">412</td><td class="line"> }</td></tr>
507<tr><td class="num" id="LN413">413</td><td class="line"> </td></tr>
508<tr><td class="num" id="LN414">414</td><td class="line"> <span class='keyword'>return</span> MSG_NONE;</td></tr>
509<tr><td class="num" id="LN415">415</td><td class="line">}</td></tr>
510<tr><td class="num" id="LN416">416</td><td class="line"> </td></tr>
511<tr><td class="num" id="LN417">417</td><td class="line"> </td></tr>
512<tr><td class="num" id="LN418">418</td><td class="line"> </td></tr>
513<tr><td class="num" id="LN419">419</td><td class="line">status_t</td></tr>
514<tr><td class="num" id="LN420">420</td><td class="line">my_modeswitch(my_device* device)</td></tr>
515<tr><td class="num" id="LN421">421</td><td class="line">{</td></tr>
516<tr><td class="num" id="LN422">422</td><td class="line"> status_t err = <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
517<tr><td class="num" id="LN423">423</td><td class="line"> <span class='keyword'>if</span> (device-&gt;type[0] == MSG_NONE)</td></tr>
518<tr><td class="num" id="LN424">424</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
519<tr><td class="num" id="LN425">425</td><td class="line"> <span class='keyword'>for</span> (<span class='keyword'>int</span> i = 0; i &lt; 3; i++) {</td></tr>
520<tr><td class="num" id="LN426">426</td><td class="line"> <span class='keyword'>if</span> (device-&gt;type[i] == MSG_NONE)</td></tr>
521<tr><td class="num" id="LN427">427</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
522<tr><td class="num" id="LN428">428</td><td class="line"> </td></tr>
523<tr><td class="num" id="LN429">429</td><td class="line"> err = my_transfer_data(device, <span class='keyword'>false</span>, kDevicesMsg[device-&gt;type[i]],</td></tr>
524<tr><td class="num" id="LN430">430</td><td class="line"> <span class='keyword'>sizeof</span>(kDevicesMsg[device-&gt;type[i]]));</td></tr>
525<tr><td class="num" id="LN431">431</td><td class="line"> <span class='keyword'>if</span> (err != <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>) {</td></tr>
526<tr><td class="num" id="LN432">432</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"send message %d failed\n"</span>, i + 1)<span class='expansion'>dprintf("usb_modeswitch" ": " "send message %d failed\n", i +<br> 1)</span></span>;</td></tr>
527<tr><td class="num" id="LN433">433</td><td class="line"> <span class='keyword'>return</span> err;</td></tr>
528<tr><td class="num" id="LN434">434</td><td class="line"> }</td></tr>
529<tr><td class="num" id="LN435">435</td><td class="line"> </td></tr>
530<tr><td class="num" id="LN436">436</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"device switched: %p\n"</span>, device)<span class='expansion'>dprintf("usb_modeswitch" ": " "device switched: %p\n", device<br>)</span></span>;</td></tr>
531<tr><td class="num" id="LN437">437</td><td class="line"> </td></tr>
532<tr><td class="num" id="LN438">438</td><td class="line"> <span class='keyword'>char</span> data[36];</td></tr>
533<tr><td class="num" id="LN439">439</td><td class="line"> err = my_transfer_data(device, <span class='keyword'>true</span>, data, <span class='keyword'>sizeof</span>(data));</td></tr>
534<tr><td class="num" id="LN440">440</td><td class="line"> <span class='keyword'>if</span> (err != <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>) {</td></tr>
535<tr><td class="num" id="LN441">441</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"receive response %d failed 0x%"</span> B_PRIx32 <span class='string_literal'>"\n"</span>,<span class='expansion'>dprintf("usb_modeswitch" ": " "receive response %d failed 0x%"<br> "" "x" "\n", i + 1, device-&gt;status)</span></span></td></tr>
536<tr><td class="num" id="LN442">442</td><td class="line"> <span class='macro'>i + 1, device-&gt;status)<span class='expansion'>dprintf("usb_modeswitch" ": " "receive response %d failed 0x%"<br> "" "x" "\n", i + 1, device-&gt;status)</span></span>;</td></tr>
537<tr><td class="num" id="LN443">443</td><td class="line"> <span class='keyword'>return</span> err;</td></tr>
538<tr><td class="num" id="LN444">444</td><td class="line"> }</td></tr>
539<tr><td class="num" id="LN445">445</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"device switched (response length %ld)\n"</span>, device-&gt;actual_length)<span class='expansion'>dprintf("usb_modeswitch" ": " "device switched (response length %ld)\n"<br>, device-&gt;actual_length)</span></span>;</td></tr>
540<tr><td class="num" id="LN446">446</td><td class="line"> }</td></tr>
541<tr><td class="num" id="LN447">447</td><td class="line"> </td></tr>
542<tr><td class="num" id="LN448">448</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"device switched: %p\n"</span>, device)<span class='expansion'>dprintf("usb_modeswitch" ": " "device switched: %p\n", device<br>)</span></span>;</td></tr>
543<tr><td class="num" id="LN449">449</td><td class="line"> </td></tr>
544<tr><td class="num" id="LN450">450</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
545<tr><td class="num" id="LN451">451</td><td class="line">}</td></tr>
546<tr><td class="num" id="LN452">452</td><td class="line"> </td></tr>
547<tr><td class="num" id="LN453">453</td><td class="line"> </td></tr>
548<tr><td class="num" id="LN454">454</td><td class="line"><span class='comment'>//</span></td></tr>
549<tr><td class="num" id="LN455">455</td><td class="line"><span class='comment'>//#pragma mark - Device Attach/Detach Notifications and Callback</span></td></tr>
550<tr><td class="num" id="LN456">456</td><td class="line"><span class='comment'>//</span></td></tr>
551<tr><td class="num" id="LN457">457</td><td class="line"> </td></tr>
552<tr><td class="num" id="LN458">458</td><td class="line"> </td></tr>
553<tr><td class="num" id="LN459">459</td><td class="line"><span class='keyword'>static</span> status_t</td></tr>
554<tr><td class="num" id="LN460">460</td><td class="line">my_device_added(usb_device newDevice, <span class='keyword'>void</span> **cookie)</td></tr>
555<tr><td class="num" id="LN461">461</td><td class="line">{</td></tr>
556<tr><td class="num" id="LN462">462</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"device_added(0x%08"</span> B_PRIx32 <span class='string_literal'>")\n"</span>, newDevice)<span class='expansion'>dprintf("usb_modeswitch" ": " "device_added(0x%08" "" "x" ")\n"<br>, newDevice)</span></span>;</td></tr>
557<tr><td class="num" id="LN463">463</td><td class="line"> my_device *device = (my_device *)<span class="mrange">malloc(<span class='keyword'>sizeof</span>(my_device))</span>;</td></tr>
558<tr><td class="num"></td><td class="line"><div id="Path1" class="msg msgEvent" style="margin-left:42ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">1</div></td><td>Memory is allocated</td><td><div class="PathNav"><a href="#Path2" title="Next event (2)">&#x2192;</a></div></td></tr></table></div></td></tr>
559<tr><td class="num" id="LN464">464</td><td class="line"> device-&gt;device = newDevice;</td></tr>
560<tr><td class="num" id="LN465">465</td><td class="line"> device-&gt;removed = <span class='keyword'>false</span>;</td></tr>
561<tr><td class="num" id="LN466">466</td><td class="line"> device-&gt;interface = 0xff;</td></tr>
562<tr><td class="num" id="LN467">467</td><td class="line"> device-&gt;alternate_setting = 0;</td></tr>
563<tr><td class="num" id="LN468">468</td><td class="line"> </td></tr>
564<tr><td class="num" id="LN469">469</td><td class="line"> <span class='comment'>// scan through the interfaces to find our bulk-only data interface</span></td></tr>
565<tr><td class="num" id="LN470">470</td><td class="line"> <span class='keyword'>const</span> usb_configuration_info *configuration =</td></tr>
566<tr><td class="num" id="LN471">471</td><td class="line"> gUSBModule-&gt;get_configuration(newDevice);</td></tr>
567<tr><td class="num" id="LN472">472</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">configuration == <span class='macro'>NULL<span class='expansion'>__null</span></span></span>) {</td></tr>
568<tr><td class="num"></td><td class="line"><div id="Path2" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">2</div></td><td><div class="PathNav"><a href="#Path1" title="Previous event (1)">&#x2190;</a></div></td></td><td>Assuming 'configuration' is not equal to NULL</td><td><div class="PathNav"><a href="#Path3" title="Next event (3)">&#x2192;</a></div></td></tr></table></div></td></tr>
569<tr><td class="num"></td><td class="line"><div id="Path3" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">3</div></td><td><div class="PathNav"><a href="#Path2" title="Previous event (2)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path4" title="Next event (4)">&#x2192;</a></div></td></tr></table></div></td></tr>
570<tr><td class="num" id="LN473">473</td><td class="line"> free(device);</td></tr>
571<tr><td class="num" id="LN474">474</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_ERROR<span class='expansion'>(-1)</span></span>;</td></tr>
572<tr><td class="num" id="LN475">475</td><td class="line"> }</td></tr>
573<tr><td class="num" id="LN476">476</td><td class="line"> </td></tr>
574<tr><td class="num" id="LN477">477</td><td class="line"> <span class='keyword'>for</span> (size_t i = 0; <span class="mrange"><span class="mrange"><span class="mrange">i &lt; configuration-&gt;interface_count</span></span></span>; i++) {</td></tr>
575<tr><td class="num"></td><td class="line"><div id="Path4" class="msg msgEvent" style="margin-left:28ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">4</div></td><td><div class="PathNav"><a href="#Path3" title="Previous event (3)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path5" title="Next event (5)">&#x2192;</a></div></td></tr></table></div></td></tr>
576<tr><td class="num"></td><td class="line"><div id="Path5" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">5</div></td><td><div class="PathNav"><a href="#Path4" title="Previous event (4)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path6" title="Next event (6)">&#x2192;</a></div></td></tr></table></div></td></tr>
577<tr><td class="num"></td><td class="line"><div id="Path13" class="msg msgEvent" style="margin-left:28ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">13</div></td><td><div class="PathNav"><a href="#Path12" title="Previous event (12)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path14" title="Next event (14)">&#x2192;</a></div></td></tr></table></div></td></tr>
578<tr><td class="num"></td><td class="line"><div id="Path14" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">14</div></td><td><div class="PathNav"><a href="#Path13" title="Previous event (13)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path15" title="Next event (15)">&#x2192;</a></div></td></tr></table></div></td></tr>
579<tr><td class="num"></td><td class="line"><div id="Path22" class="msg msgEvent" style="margin-left:28ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">22</div></td><td><div class="PathNav"><a href="#Path21" title="Previous event (21)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path23" title="Next event (23)">&#x2192;</a></div></td></tr></table></div></td></tr>
580<tr><td class="num"></td><td class="line"><div id="Path23" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">23</div></td><td><div class="PathNav"><a href="#Path22" title="Previous event (22)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path24" title="Next event (24)">&#x2192;</a></div></td></tr></table></div></td></tr>
581<tr><td class="num" id="LN478">478</td><td class="line"> usb_interface_info *interface = configuration-&gt;interface[i].active;</td></tr>
582<tr><td class="num" id="LN479">479</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange"><span class="mrange"><span class="mrange">interface == <span class='macro'>NULL<span class='expansion'>__null</span></span></span></span></span>)</td></tr>
583<tr><td class="num"></td><td class="line"><div id="Path6" class="msg msgEvent" style="margin-left:21ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">6</div></td><td><div class="PathNav"><a href="#Path5" title="Previous event (5)">&#x2190;</a></div></td></td><td>Assuming 'interface' is not equal to NULL</td><td><div class="PathNav"><a href="#Path7" title="Next event (7)">&#x2192;</a></div></td></tr></table></div></td></tr>
584<tr><td class="num"></td><td class="line"><div id="Path7" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">7</div></td><td><div class="PathNav"><a href="#Path6" title="Previous event (6)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path8" title="Next event (8)">&#x2192;</a></div></td></tr></table></div></td></tr>
585<tr><td class="num"></td><td class="line"><div id="Path15" class="msg msgEvent" style="margin-left:21ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">15</div></td><td><div class="PathNav"><a href="#Path14" title="Previous event (14)">&#x2190;</a></div></td></td><td>Assuming 'interface' is not equal to NULL</td><td><div class="PathNav"><a href="#Path16" title="Next event (16)">&#x2192;</a></div></td></tr></table></div></td></tr>
586<tr><td class="num"></td><td class="line"><div id="Path16" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">16</div></td><td><div class="PathNav"><a href="#Path15" title="Previous event (15)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path17" title="Next event (17)">&#x2192;</a></div></td></tr></table></div></td></tr>
587<tr><td class="num"></td><td class="line"><div id="Path24" class="msg msgEvent" style="margin-left:21ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">24</div></td><td><div class="PathNav"><a href="#Path23" title="Previous event (23)">&#x2190;</a></div></td></td><td>Assuming 'interface' is not equal to NULL</td><td><div class="PathNav"><a href="#Path25" title="Next event (25)">&#x2192;</a></div></td></tr></table></div></td></tr>
588<tr><td class="num"></td><td class="line"><div id="Path25" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">25</div></td><td><div class="PathNav"><a href="#Path24" title="Previous event (24)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path26" title="Next event (26)">&#x2192;</a></div></td></tr></table></div></td></tr>
589<tr><td class="num" id="LN480">480</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
590<tr><td class="num" id="LN481">481</td><td class="line"> </td></tr>
591<tr><td class="num" id="LN482">482</td><td class="line"> <span class='keyword'>if</span> (<span class='keyword'>true</span>) {</td></tr>
592<tr><td class="num"></td><td class="line"><div id="Path8" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">8</div></td><td><div class="PathNav"><a href="#Path7" title="Previous event (7)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path9" title="Next event (9)">&#x2192;</a></div></td></tr></table></div></td></tr>
593<tr><td class="num"></td><td class="line"><div id="Path17" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">17</div></td><td><div class="PathNav"><a href="#Path16" title="Previous event (16)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path18" title="Next event (18)">&#x2192;</a></div></td></tr></table></div></td></tr>
594<tr><td class="num"></td><td class="line"><div id="Path26" class="msg msgControl" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">26</div></td><td><div class="PathNav"><a href="#Path25" title="Previous event (25)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path27" title="Next event (27)">&#x2192;</a></div></td></tr></table></div></td></tr>
595<tr><td class="num" id="LN483">483</td><td class="line"> </td></tr>
596<tr><td class="num" id="LN484">484</td><td class="line"> <span class='keyword'>bool</span> hasIn = <span class='keyword'>false</span>;</td></tr>
597<tr><td class="num" id="LN485">485</td><td class="line"> <span class='keyword'>bool</span> hasOut = <span class='keyword'>false</span>;</td></tr>
598<tr><td class="num" id="LN486">486</td><td class="line"> <span class='keyword'>for</span> (size_t j = 0; <span class="mrange"><span class="mrange"><span class="mrange"><span class="mrange">j &lt; interface-&gt;endpoint_count</span></span></span></span>; j++) {</td></tr>
599<tr><td class="num"></td><td class="line"><div id="Path9" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">9</div></td><td><div class="PathNav"><a href="#Path8" title="Previous event (8)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path10" title="Next event (10)">&#x2192;</a></div></td></tr></table></div></td></tr>
600<tr><td class="num"></td><td class="line"><div id="Path10" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">10</div></td><td><div class="PathNav"><a href="#Path9" title="Previous event (9)">&#x2190;</a></div></td></td><td>Loop condition is false. Execution continues on line 506</td><td><div class="PathNav"><a href="#Path11" title="Next event (11)">&#x2192;</a></div></td></tr></table></div></td></tr>
601<tr><td class="num"></td><td class="line"><div id="Path18" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">18</div></td><td><div class="PathNav"><a href="#Path17" title="Previous event (17)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path19" title="Next event (19)">&#x2192;</a></div></td></tr></table></div></td></tr>
602<tr><td class="num"></td><td class="line"><div id="Path19" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">19</div></td><td><div class="PathNav"><a href="#Path18" title="Previous event (18)">&#x2190;</a></div></td></td><td>Loop condition is false. Execution continues on line 506</td><td><div class="PathNav"><a href="#Path20" title="Next event (20)">&#x2192;</a></div></td></tr></table></div></td></tr>
603<tr><td class="num"></td><td class="line"><div id="Path27" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">27</div></td><td><div class="PathNav"><a href="#Path26" title="Previous event (26)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path28" title="Next event (28)">&#x2192;</a></div></td></tr></table></div></td></tr>
604<tr><td class="num"></td><td class="line"><div id="Path28" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">28</div></td><td><div class="PathNav"><a href="#Path27" title="Previous event (27)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path29" title="Next event (29)">&#x2192;</a></div></td></tr></table></div></td></tr>
605<tr><td class="num"></td><td class="line"><div id="Path35" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">35</div></td><td><div class="PathNav"><a href="#Path34" title="Previous event (34)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path36" title="Next event (36)">&#x2192;</a></div></td></tr></table></div></td></tr>
606<tr><td class="num"></td><td class="line"><div id="Path36" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">36</div></td><td><div class="PathNav"><a href="#Path35" title="Previous event (35)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path37" title="Next event (37)">&#x2192;</a></div></td></tr></table></div></td></tr>
607<tr><td class="num" id="LN487">487</td><td class="line"> usb_endpoint_info *endpoint = &amp;interface-&gt;endpoint[j];</td></tr>
608<tr><td class="num" id="LN488">488</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">endpoint == <span class='macro'>NULL<span class='expansion'>__null</span></span></td></tr></span>
609<tr><td class="num"></td><td class="line"><div id="Path29" class="msg msgEvent" style="margin-left:37ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">29</div></td><td><div class="PathNav"><a href="#Path28" title="Previous event (28)">&#x2190;</a></div></td></td><td>Assuming 'endpoint' is not equal to NULL</td><td><div class="PathNav"><a href="#Path30" title="Next event (30)">&#x2192;</a></div></td></tr></table></div></td></tr>
610<tr><td class="num"></td><td class="line"><div id="Path31" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">31</div></td><td><div class="PathNav"><a href="#Path30" title="Previous event (30)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path32" title="Next event (32)">&#x2192;</a></div></td></tr></table></div></td></tr>
611<tr><td class="num"></td><td class="line"><div id="Path38" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">38</div></td><td><div class="PathNav"><a href="#Path37" title="Previous event (37)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path39" title="Next event (39)">&#x2192;</a></div></td></tr></table></div></td></tr>
612<tr><td class="num" id="LN489">489</td><td class="line"> || <span class="mrange"><span class="mrange">endpoint-&gt;descr-&gt;attributes != <span class='macro'>USB_ENDPOINT_ATTR_BULK<span class='expansion'>0x02</span></span></span></span>)</td></tr>
613<tr><td class="num"></td><td class="line"><div id="Path30" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">30</div></td><td><div class="PathNav"><a href="#Path29" title="Previous event (29)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path31" title="Next event (31)">&#x2192;</a></div></td></tr></table></div></td></tr>
614<tr><td class="num"></td><td class="line"><div id="Path37" class="msg msgEvent" style="margin-left:44ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">37</div></td><td><div class="PathNav"><a href="#Path36" title="Previous event (36)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path38" title="Next event (38)">&#x2192;</a></div></td></tr></table></div></td></tr>
615<tr><td class="num" id="LN490">490</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
616<tr><td class="num" id="LN491">491</td><td class="line"> </td></tr>
617<tr><td class="num" id="LN492">492</td><td class="line"> <span class='keyword'>if</span> (!hasIn &amp;&amp; <span class="mrange"><span class="mrange">(endpoint-&gt;descr-&gt;endpoint_address</td></tr></span>
618<tr><td class="num"></td><td class="line"><div id="Path32" class="msg msgEvent" style="margin-left:47ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">32</div></td><td><div class="PathNav"><a href="#Path31" title="Previous event (31)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path33" title="Next event (33)">&#x2192;</a></div></td></tr></table></div></td></tr>
619<tr><td class="num"></td><td class="line"><div id="Path33" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">33</div></td><td><div class="PathNav"><a href="#Path32" title="Previous event (32)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path34" title="Next event (34)">&#x2192;</a></div></td></tr></table></div></td></tr></span>
620<tr><td class="num"></td><td class="line"><div id="Path39" class="msg msgEvent" style="margin-left:47ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">39</div></td><td><div class="PathNav"><a href="#Path38" title="Previous event (38)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path40" title="Next event (40)">&#x2192;</a></div></td></tr></table></div></td></tr>
621<tr><td class="num"></td><td class="line"><div id="Path40" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">40</div></td><td><div class="PathNav"><a href="#Path39" title="Previous event (39)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path41" title="Next event (41)">&#x2192;</a></div></td></tr></table></div></td></tr>
622<tr><td class="num" id="LN493">493</td><td class="line"> <span class="mrange"><span class="mrange">&amp; <span class='macro'>USB_ENDPOINT_ADDR_DIR_IN<span class='expansion'>0x80</span></span>)</span></span>) {</td></tr>
623<tr><td class="num" id="LN494">494</td><td class="line"> device-&gt;bulk_in = endpoint-&gt;handle;</td></tr>
624<tr><td class="num" id="LN495">495</td><td class="line"> hasIn = <span class='keyword'>true</span>;</td></tr>
625<tr><td class="num" id="LN496">496</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (!hasOut &amp;&amp; (endpoint-&gt;descr-&gt;endpoint_address</td></tr>
626<tr><td class="num"></td><td class="line"><div id="Path34" class="msg msgControl" style="margin-left:40ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">34</div></td><td><div class="PathNav"><a href="#Path33" title="Previous event (33)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path35" title="Next event (35)">&#x2192;</a></div></td></tr></table></div></td></tr>
627<tr><td class="num" id="LN497">497</td><td class="line"> &amp; <span class='macro'>USB_ENDPOINT_ADDR_DIR_IN<span class='expansion'>0x80</span></span>) == 0) {</td></tr>
628<tr><td class="num" id="LN498">498</td><td class="line"> device-&gt;bulk_out = endpoint-&gt;handle;</td></tr>
629<tr><td class="num" id="LN499">499</td><td class="line"> hasOut = <span class='keyword'>true</span>;</td></tr>
630<tr><td class="num" id="LN500">500</td><td class="line"> }</td></tr>
631<tr><td class="num" id="LN501">501</td><td class="line"> </td></tr>
632<tr><td class="num" id="LN502">502</td><td class="line"> <span class='keyword'>if</span> (hasIn &amp;&amp; hasOut)</td></tr>
633<tr><td class="num"></td><td class="line"><div id="Path41" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">41</div></td><td><div class="PathNav"><a href="#Path40" title="Previous event (40)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path42" title="Next event (42)">&#x2192;</a></div></td></tr></table></div></td></tr>
634<tr><td class="num" id="LN503">503</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
635<tr><td class="num"></td><td class="line"><div id="Path42" class="msg msgControl" style="margin-left:41ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">42</div></td><td><div class="PathNav"><a href="#Path41" title="Previous event (41)">&#x2190;</a></div></td></td><td> Execution continues on line 506</td><td><div class="PathNav"><a href="#Path43" title="Next event (43)">&#x2192;</a></div></td></tr></table></div></td></tr>
636<tr><td class="num" id="LN504">504</td><td class="line"> }</td></tr>
637<tr><td class="num" id="LN505">505</td><td class="line"> </td></tr>
638<tr><td class="num" id="LN506">506</td><td class="line"> <span class='keyword'>if</span> (!(hasIn &amp;&amp; hasOut))</td></tr>
639<tr><td class="num"></td><td class="line"><div id="Path11" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">11</div></td><td><div class="PathNav"><a href="#Path10" title="Previous event (10)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path12" title="Next event (12)">&#x2192;</a></div></td></tr></table></div></td></tr>
640<tr><td class="num"></td><td class="line"><div id="Path20" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">20</div></td><td><div class="PathNav"><a href="#Path19" title="Previous event (19)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path21" title="Next event (21)">&#x2192;</a></div></td></tr></table></div></td></tr>
641<tr><td class="num"></td><td class="line"><div id="Path43" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">43</div></td><td><div class="PathNav"><a href="#Path42" title="Previous event (42)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path44" title="Next event (44)">&#x2192;</a></div></td></tr></table></div></td></tr>
642<tr><td class="num" id="LN507">507</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
643<tr><td class="num"></td><td class="line"><div id="Path12" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">12</div></td><td><div class="PathNav"><a href="#Path11" title="Previous event (11)">&#x2190;</a></div></td></td><td> Execution continues on line 477</td><td><div class="PathNav"><a href="#Path13" title="Next event (13)">&#x2192;</a></div></td></tr></table></div></td></tr>
644<tr><td class="num"></td><td class="line"><div id="Path21" class="msg msgControl" style="margin-left:33ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">21</div></td><td><div class="PathNav"><a href="#Path20" title="Previous event (20)">&#x2190;</a></div></td></td><td> Execution continues on line 477</td><td><div class="PathNav"><a href="#Path22" title="Next event (22)">&#x2192;</a></div></td></tr></table></div></td></tr>
645<tr><td class="num" id="LN508">508</td><td class="line"> </td></tr>
646<tr><td class="num" id="LN509">509</td><td class="line"> device-&gt;interface = interface-&gt;descr-&gt;interface_number;</td></tr>
647<tr><td class="num" id="LN510">510</td><td class="line"> device-&gt;alternate_setting = interface-&gt;descr-&gt;alternate_setting;</td></tr>
648<tr><td class="num" id="LN511">511</td><td class="line"> </td></tr>
649<tr><td class="num" id="LN512">512</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
650<tr><td class="num"></td><td class="line"><div id="Path44" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">44</div></td><td><div class="PathNav"><a href="#Path43" title="Previous event (43)">&#x2190;</a></div></td></td><td> Execution continues on line 516</td><td><div class="PathNav"><a href="#Path45" title="Next event (45)">&#x2192;</a></div></td></tr></table></div></td></tr>
651<tr><td class="num" id="LN513">513</td><td class="line"> }</td></tr>
652<tr><td class="num" id="LN514">514</td><td class="line"> }</td></tr>
653<tr><td class="num" id="LN515">515</td><td class="line"> </td></tr>
654<tr><td class="num" id="LN516">516</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">device-&gt;interface == 0xff</span>) {</td></tr>
655<tr><td class="num"></td><td class="line"><div id="Path45" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">45</div></td><td><div class="PathNav"><a href="#Path44" title="Previous event (44)">&#x2190;</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path46" title="Next event (46)">&#x2192;</a></div></td></tr></table></div></td></tr>
656<tr><td class="num"></td><td class="line"><div id="Path46" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">46</div></td><td><div class="PathNav"><a href="#Path45" title="Previous event (45)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path47" title="Next event (47)">&#x2192;</a></div></td></tr></table></div></td></tr>
657<tr><td class="num" id="LN517">517</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"no valid interface found\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "no valid interface found\n")</span></span>;</td></tr>
658<tr><td class="num" id="LN518">518</td><td class="line"> free(device);</td></tr>
659<tr><td class="num" id="LN519">519</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_ERROR<span class='expansion'>(-1)</span></span>;</td></tr>
660<tr><td class="num" id="LN520">520</td><td class="line"> }</td></tr>
661<tr><td class="num" id="LN521">521</td><td class="line"> </td></tr>
662<tr><td class="num" id="LN522">522</td><td class="line"> <span class='keyword'>const</span> usb_device_descriptor *descriptor</td></tr>
663<tr><td class="num" id="LN523">523</td><td class="line"> = gUSBModule-&gt;get_device_descriptor(newDevice);</td></tr>
664<tr><td class="num" id="LN524">524</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">descriptor == <span class='macro'>NULL<span class='expansion'>__null</span></span></span>) {</td></tr>
665<tr><td class="num"></td><td class="line"><div id="Path47" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">47</div></td><td><div class="PathNav"><a href="#Path46" title="Previous event (46)">&#x2190;</a></div></td></td><td>Assuming 'descriptor' is not equal to NULL</td><td><div class="PathNav"><a href="#Path48" title="Next event (48)">&#x2192;</a></div></td></tr></table></div></td></tr>
666<tr><td class="num"></td><td class="line"><div id="Path48" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">48</div></td><td><div class="PathNav"><a href="#Path47" title="Previous event (47)">&#x2190;</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path49" title="Next event (49)">&#x2192;</a></div></td></tr></table></div></td></tr>
667<tr><td class="num" id="LN525">525</td><td class="line"> free(device);</td></tr>
668<tr><td class="num" id="LN526">526</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_ERROR<span class='expansion'>(-1)</span></span>;</td></tr>
669<tr><td class="num" id="LN527">527</td><td class="line"> }</td></tr>
670<tr><td class="num" id="LN528">528</td><td class="line"> <span class='keyword'>for</span> (<span class='keyword'>int</span> i = 0; i &lt; 3; i++) {</td></tr>
671<tr><td class="num"></td><td class="line"><div id="Path49" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">49</div></td><td><div class="PathNav"><a href="#Path48" title="Previous event (48)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path50" title="Next event (50)">&#x2192;</a></div></td></tr></table></div></td></tr>
672<tr><td class="num"></td><td class="line"><div id="Path50" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">50</div></td><td><div class="PathNav"><a href="#Path49" title="Previous event (49)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path51" title="Next event (51)">&#x2192;</a></div></td></tr></table></div></td></tr>
673<tr><td class="num"></td><td class="line"><div id="Path51" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">51</div></td><td><div class="PathNav"><a href="#Path50" title="Previous event (50)">&#x2190;</a></div></td></td><td>Loop condition is true. Entering loop body</td><td><div class="PathNav"><a href="#Path52" title="Next event (52)">&#x2192;</a></div></td></tr></table></div></td></tr>
674<tr><td class="num"></td><td class="line"><div id="Path52" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">52</div></td><td><div class="PathNav"><a href="#Path51" title="Previous event (51)">&#x2190;</a></div></td></td><td>Loop condition is false. Execution continues on line 532</td><td><div class="PathNav"><a href="#Path53" title="Next event (53)">&#x2192;</a></div></td></tr></table></div></td></tr>
675<tr><td class="num" id="LN529">529</td><td class="line"> device-&gt;type[i] = my_get_msg_type(descriptor, i);</td></tr>
676<tr><td class="num" id="LN530">530</td><td class="line"> }</td></tr>
677<tr><td class="num" id="LN531">531</td><td class="line"> </td></tr>
678<tr><td class="num" id="LN532">532</td><td class="line"> mutex_init(&amp;device-&gt;lock, <span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> <span class='string_literal'>" device lock"</span>);</td></tr>
679<tr><td class="num" id="LN533">533</td><td class="line"> </td></tr>
680<tr><td class="num" id="LN534">534</td><td class="line"> device-&gt;notify = create_sem(0, <span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> <span class='string_literal'>" callback notify"</span>);</td></tr>
681<tr><td class="num" id="LN535">535</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">device-&gt;notify &lt; <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span></span>) {</td></tr>
682<tr><td class="num"></td><td class="line"><div id="Path53" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">53</div></td><td><div class="PathNav"><a href="#Path52" title="Previous event (52)">&#x2190;</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path54" title="Next event (54)">&#x2192;</a></div></td></tr></table></div></td></tr>
683<tr><td class="num"></td><td class="line"><div id="Path54" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">54</div></td><td><div class="PathNav"><a href="#Path53" title="Previous event (53)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path55" title="Next event (55)">&#x2192;</a></div></td></tr></table></div></td></tr>
684<tr><td class="num" id="LN536">536</td><td class="line"> mutex_destroy(&amp;device-&gt;lock);</td></tr>
685<tr><td class="num" id="LN537">537</td><td class="line"> <span class="mrange">free(device)</span>;</td></tr>
686<tr><td class="num"></td><td class="line"><div id="Path55" class="msg msgEvent" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">55</div></td><td><div class="PathNav"><a href="#Path54" title="Previous event (54)">&#x2190;</a></div></td></td><td>Memory is released</td><td><div class="PathNav"><a href="#EndPath" title="Next event (56)">&#x2192;</a></div></td></tr></table></div></td></tr>
687<tr><td class="num" id="LN538">538</td><td class="line"> <span class='keyword'>return</span> <span class="mrange">device-&gt;notify</span>;</td></tr>
688<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:24ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">56</div></td><td><div class="PathNav"><a href="#Path55" title="Previous event (55)">&#x2190;</a></div></td></td><td>Use of memory after it is freed</td></tr></table></div></td></tr>
689<tr><td class="num" id="LN539">539</td><td class="line"> }</td></tr>
690<tr><td class="num" id="LN540">540</td><td class="line"> </td></tr>
691<tr><td class="num" id="LN541">541</td><td class="line"> mutex_lock(&amp;gDeviceListLock);</td></tr>
692<tr><td class="num" id="LN542">542</td><td class="line"> device-&gt;link = gDeviceList;</td></tr>
693<tr><td class="num" id="LN543">543</td><td class="line"> gDeviceList = device;</td></tr>
694<tr><td class="num" id="LN544">544</td><td class="line"> mutex_unlock(&amp;gDeviceListLock);</td></tr>
695<tr><td class="num" id="LN545">545</td><td class="line"> </td></tr>
696<tr><td class="num" id="LN546">546</td><td class="line"> *cookie = device;</td></tr>
697<tr><td class="num" id="LN547">547</td><td class="line"> </td></tr>
698<tr><td class="num" id="LN548">548</td><td class="line"> <span class='keyword'>return</span> my_modeswitch(device);</td></tr>
699<tr><td class="num" id="LN549">549</td><td class="line">}</td></tr>
700<tr><td class="num" id="LN550">550</td><td class="line"> </td></tr>
701<tr><td class="num" id="LN551">551</td><td class="line"> </td></tr>
702<tr><td class="num" id="LN552">552</td><td class="line"><span class='keyword'>static</span> status_t</td></tr>
703<tr><td class="num" id="LN553">553</td><td class="line">my_device_removed(<span class='keyword'>void</span> *cookie)</td></tr>
704<tr><td class="num" id="LN554">554</td><td class="line">{</td></tr>
705<tr><td class="num" id="LN555">555</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"device_removed(%p)\n"</span>, cookie)<span class='expansion'>dprintf("usb_modeswitch" ": " "device_removed(%p)\n", cookie)</span></span>;</td></tr>
706<tr><td class="num" id="LN556">556</td><td class="line"> my_device *device = (my_device *)cookie;</td></tr>
707<tr><td class="num" id="LN557">557</td><td class="line"> </td></tr>
708<tr><td class="num" id="LN558">558</td><td class="line"> mutex_lock(&amp;gDeviceListLock);</td></tr>
709<tr><td class="num" id="LN559">559</td><td class="line"> <span class='keyword'>if</span> (gDeviceList == device) {</td></tr>
710<tr><td class="num" id="LN560">560</td><td class="line"> gDeviceList = device-&gt;link;</td></tr>
711<tr><td class="num" id="LN561">561</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
712<tr><td class="num" id="LN562">562</td><td class="line"> my_device *element = gDeviceList;</td></tr>
713<tr><td class="num" id="LN563">563</td><td class="line"> <span class='keyword'>while</span> (element) {</td></tr>
714<tr><td class="num" id="LN564">564</td><td class="line"> <span class='keyword'>if</span> (element-&gt;link == device) {</td></tr>
715<tr><td class="num" id="LN565">565</td><td class="line"> element-&gt;link = device-&gt;link;</td></tr>
716<tr><td class="num" id="LN566">566</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
717<tr><td class="num" id="LN567">567</td><td class="line"> }</td></tr>
718<tr><td class="num" id="LN568">568</td><td class="line"> </td></tr>
719<tr><td class="num" id="LN569">569</td><td class="line"> element = element-&gt;link;</td></tr>
720<tr><td class="num" id="LN570">570</td><td class="line"> }</td></tr>
721<tr><td class="num" id="LN571">571</td><td class="line"> }</td></tr>
722<tr><td class="num" id="LN572">572</td><td class="line"> gDeviceCount--;</td></tr>
723<tr><td class="num" id="LN573">573</td><td class="line"> </td></tr>
724<tr><td class="num" id="LN574">574</td><td class="line"> device-&gt;removed = <span class='keyword'>true</span>;</td></tr>
725<tr><td class="num" id="LN575">575</td><td class="line"> gUSBModule-&gt;cancel_queued_transfers(device-&gt;bulk_in);</td></tr>
726<tr><td class="num" id="LN576">576</td><td class="line"> gUSBModule-&gt;cancel_queued_transfers(device-&gt;bulk_out);</td></tr>
727<tr><td class="num" id="LN577">577</td><td class="line"> my_free_device(device);</td></tr>
728<tr><td class="num" id="LN578">578</td><td class="line"> </td></tr>
729<tr><td class="num" id="LN579">579</td><td class="line"> mutex_unlock(&amp;gDeviceListLock);</td></tr>
730<tr><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
731<tr><td class="num" id="LN581">581</td><td class="line">}</td></tr>
732<tr><td class="num" id="LN582">582</td><td class="line"> </td></tr>
733<tr><td class="num" id="LN583">583</td><td class="line"> </td></tr>
734<tr><td class="num" id="LN584">584</td><td class="line"><span class='comment'>//</span></td></tr>
735<tr><td class="num" id="LN585">585</td><td class="line"><span class='comment'>//#pragma mark - Driver Entry Points</span></td></tr>
736<tr><td class="num" id="LN586">586</td><td class="line"><span class='comment'>//</span></td></tr>
737<tr><td class="num" id="LN587">587</td><td class="line"> </td></tr>
738<tr><td class="num" id="LN588">588</td><td class="line"> </td></tr>
739<tr><td class="num" id="LN589">589</td><td class="line">status_t</td></tr>
740<tr><td class="num" id="LN590">590</td><td class="line">init_hardware()</td></tr>
741<tr><td class="num" id="LN591">591</td><td class="line">{</td></tr>
742<tr><td class="num" id="LN592">592</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"init_hardware()\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "init_hardware()\n")</span></span>;</td></tr>
743<tr><td class="num" id="LN593">593</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
744<tr><td class="num" id="LN594">594</td><td class="line">}</td></tr>
745<tr><td class="num" id="LN595">595</td><td class="line"> </td></tr>
746<tr><td class="num" id="LN596">596</td><td class="line"> </td></tr>
747<tr><td class="num" id="LN597">597</td><td class="line">status_t</td></tr>
748<tr><td class="num" id="LN598">598</td><td class="line">init_driver()</td></tr>
749<tr><td class="num" id="LN599">599</td><td class="line">{</td></tr>
750<tr><td class="num" id="LN600">600</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"init_driver()\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "init_driver()\n")</span></span>;</td></tr>
751<tr><td class="num" id="LN601">601</td><td class="line"> <span class='keyword'>static</span> usb_notify_hooks notifyHooks = {</td></tr>
752<tr><td class="num" id="LN602">602</td><td class="line"> &amp;my_device_added,</td></tr>
753<tr><td class="num" id="LN603">603</td><td class="line"> &amp;my_device_removed</td></tr>
754<tr><td class="num" id="LN604">604</td><td class="line"> };</td></tr>
755<tr><td class="num" id="LN605">605</td><td class="line"> </td></tr>
756<tr><td class="num" id="LN606">606</td><td class="line"> gDeviceList = <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
757<tr><td class="num" id="LN607">607</td><td class="line"> gDeviceCount = 0;</td></tr>
758<tr><td class="num" id="LN608">608</td><td class="line"> mutex_init(&amp;gDeviceListLock, <span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span> <span class='string_literal'>" device list lock"</span>);</td></tr>
759<tr><td class="num" id="LN609">609</td><td class="line"> </td></tr>
760<tr><td class="num" id="LN610">610</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"trying module %s\n"</span>, B_USB_MODULE_NAME)<span class='expansion'>dprintf("usb_modeswitch" ": " "trying module %s\n", "bus_managers/usb/v3"<br>)</span></span>;</td></tr>
761<tr><td class="num" id="LN611">611</td><td class="line"> status_t result = get_module(<span class='macro'>B_USB_MODULE_NAME<span class='expansion'>"bus_managers/usb/v3"</span></span>,</td></tr>
762<tr><td class="num" id="LN612">612</td><td class="line"> (module_info **)&amp;gUSBModule);</td></tr>
763<tr><td class="num" id="LN613">613</td><td class="line"> <span class='keyword'>if</span> (result &lt; <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>) {</td></tr>
764<tr><td class="num" id="LN614">614</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"getting module failed 0x%08"</span> B_PRIx32 <span class='string_literal'>"\n"</span>, result)<span class='expansion'>dprintf("usb_modeswitch" ": " "getting module failed 0x%08" ""<br> "x" "\n", result)</span></span>;</td></tr>
765<tr><td class="num" id="LN615">615</td><td class="line"> mutex_destroy(&amp;gDeviceListLock);</td></tr>
766<tr><td class="num" id="LN616">616</td><td class="line"> <span class='keyword'>return</span> result;</td></tr>
767<tr><td class="num" id="LN617">617</td><td class="line"> }</td></tr>
768<tr><td class="num" id="LN618">618</td><td class="line"> </td></tr>
769<tr><td class="num" id="LN619">619</td><td class="line"> size_t descriptorsSize = kDevicesCount * <span class='keyword'>sizeof</span>(usb_support_descriptor);</td></tr>
770<tr><td class="num" id="LN620">620</td><td class="line"> usb_support_descriptor *supportedDevices =</td></tr>
771<tr><td class="num" id="LN621">621</td><td class="line"> (usb_support_descriptor *)malloc(descriptorsSize);</td></tr>
772<tr><td class="num" id="LN622">622</td><td class="line"> <span class='keyword'>if</span> (supportedDevices == <span class='macro'>NULL<span class='expansion'>__null</span></span>) {</td></tr>
773<tr><td class="num" id="LN623">623</td><td class="line"> <span class='macro'>TRACE_ALWAYS(<span class='string_literal'>"descriptor allocation failed\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "descriptor allocation failed\n"<br>)</span></span>;</td></tr>
774<tr><td class="num" id="LN624">624</td><td class="line"> put_module(<span class='macro'>B_USB_MODULE_NAME<span class='expansion'>"bus_managers/usb/v3"</span></span>);</td></tr>
775<tr><td class="num" id="LN625">625</td><td class="line"> mutex_destroy(&amp;gDeviceListLock);</td></tr>
776<tr><td class="num" id="LN626">626</td><td class="line"> <span class='keyword'>return</span> result;</td></tr>
777<tr><td class="num" id="LN627">627</td><td class="line"> }</td></tr>
778<tr><td class="num" id="LN628">628</td><td class="line"> </td></tr>
779<tr><td class="num" id="LN629">629</td><td class="line"> <span class='keyword'>for</span> (uint32 i = 0; i &lt; kDevicesCount; i++)</td></tr>
780<tr><td class="num" id="LN630">630</td><td class="line"> supportedDevices[i] = kDevices[i].desc;</td></tr>
781<tr><td class="num" id="LN631">631</td><td class="line"> </td></tr>
782<tr><td class="num" id="LN632">632</td><td class="line"> gUSBModule-&gt;register_driver(<span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span>, supportedDevices, kDevicesCount,</td></tr>
783<tr><td class="num" id="LN633">633</td><td class="line"> <span class='macro'>NULL<span class='expansion'>__null</span></span>);</td></tr>
784<tr><td class="num" id="LN634">634</td><td class="line"> gUSBModule-&gt;install_notify(<span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span>, &amp;notifyHooks);</td></tr>
785<tr><td class="num" id="LN635">635</td><td class="line"> free(supportedDevices);</td></tr>
786<tr><td class="num" id="LN636">636</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>;</td></tr>
787<tr><td class="num" id="LN637">637</td><td class="line">}</td></tr>
788<tr><td class="num" id="LN638">638</td><td class="line"> </td></tr>
789<tr><td class="num" id="LN639">639</td><td class="line"> </td></tr>
790<tr><td class="num" id="LN640">640</td><td class="line"><span class='keyword'>void</span></td></tr>
791<tr><td class="num" id="LN641">641</td><td class="line">uninit_driver()</td></tr>
792<tr><td class="num" id="LN642">642</td><td class="line">{</td></tr>
793<tr><td class="num" id="LN643">643</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"uninit_driver()\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "uninit_driver()\n")</span></span>;</td></tr>
794<tr><td class="num" id="LN644">644</td><td class="line"> gUSBModule-&gt;uninstall_notify(<span class='macro'>DRIVER_NAME<span class='expansion'>"usb_modeswitch"</span></span>);</td></tr>
795<tr><td class="num" id="LN645">645</td><td class="line"> mutex_lock(&amp;gDeviceListLock);</td></tr>
796<tr><td class="num" id="LN646">646</td><td class="line"> mutex_destroy(&amp;gDeviceListLock);</td></tr>
797<tr><td class="num" id="LN647">647</td><td class="line"> put_module(<span class='macro'>B_USB_MODULE_NAME<span class='expansion'>"bus_managers/usb/v3"</span></span>);</td></tr>
798<tr><td class="num" id="LN648">648</td><td class="line">}</td></tr>
799<tr><td class="num" id="LN649">649</td><td class="line"> </td></tr>
800<tr><td class="num" id="LN650">650</td><td class="line"> </td></tr>
801<tr><td class="num" id="LN651">651</td><td class="line"><span class='keyword'>const</span> <span class='keyword'>char</span> **</td></tr>
802<tr><td class="num" id="LN652">652</td><td class="line">publish_devices()</td></tr>
803<tr><td class="num" id="LN653">653</td><td class="line">{</td></tr>
804<tr><td class="num" id="LN654">654</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"publish_devices()\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "publish_devices()\n")</span></span>;</td></tr>
805<tr><td class="num" id="LN655">655</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
806<tr><td class="num" id="LN656">656</td><td class="line">}</td></tr>
807<tr><td class="num" id="LN657">657</td><td class="line"> </td></tr>
808<tr><td class="num" id="LN658">658</td><td class="line"> </td></tr>
809<tr><td class="num" id="LN659">659</td><td class="line">device_hooks *</td></tr>
810<tr><td class="num" id="LN660">660</td><td class="line">find_device(<span class='keyword'>const</span> <span class='keyword'>char</span> *name)</td></tr>
811<tr><td class="num" id="LN661">661</td><td class="line">{</td></tr>
812<tr><td class="num" id="LN662">662</td><td class="line"> <span class='macro'>TRACE(<span class='string_literal'>"find_device()\n"</span>)<span class='expansion'>dprintf("usb_modeswitch" ": " "find_device()\n")</span></span>;</td></tr>
813<tr><td class="num" id="LN663">663</td><td class="line"> <span class='keyword'>return</span> <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
814<tr><td class="num" id="LN664">664</td><td class="line">}</td></tr>
815</table></body></html>