File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/r3_test_runner/src/targets Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -132,21 +132,22 @@ async fn program_and_run_by_picoboot(exe: &std::path::Path) -> Result<()> {
132
132
Ok ( ( ) )
133
133
}
134
134
135
+ const DEFAULE_TIMEOUT : std:: time:: Duration = std:: time:: Duration :: from_secs ( 5 ) ;
136
+
135
137
async fn write_bulk_all (
136
138
device_handle : rusb:: DeviceHandle < rusb:: GlobalContext > ,
137
139
endpoint : u8 ,
138
140
buf : & [ u8 ] ,
139
141
) -> ( rusb:: Result < usize > , rusb:: DeviceHandle < rusb:: GlobalContext > ) {
140
142
let buf = buf. to_owned ( ) ; // sigh
141
143
spawn_blocking ( move || {
142
- let timeout = std:: time:: Duration :: from_secs ( 5 ) ;
143
144
let mut buf = & buf[ ..] ;
144
145
let mut num_bytes_written = 0 ;
145
146
146
147
log:: trace!( "write_bulk_all({})" , endpoint) ;
147
148
148
149
while buf. len ( ) > 0 {
149
- match device_handle. write_bulk ( endpoint, buf, timeout ) {
150
+ match device_handle. write_bulk ( endpoint, buf, DEFAULE_TIMEOUT ) {
150
151
Ok ( 0 ) => break ,
151
152
Ok ( num_bytes) => {
152
153
num_bytes_written += num_bytes;
@@ -167,11 +168,9 @@ async fn read_bulk_empty(
167
168
endpoint : u8 ,
168
169
) -> ( rusb:: Result < ( ) > , rusb:: DeviceHandle < rusb:: GlobalContext > ) {
169
170
spawn_blocking ( move || {
170
- let timeout = std:: time:: Duration :: from_secs ( 5 ) ;
171
-
172
171
log:: trace!( "read_bulk_empty({})" , endpoint) ;
173
172
174
- let result = match device_handle. read_bulk ( endpoint, & mut [ ] , timeout ) {
173
+ let result = match device_handle. read_bulk ( endpoint, & mut [ ] , DEFAULE_TIMEOUT ) {
175
174
Ok ( 0 ) => Ok ( ( ) ) ,
176
175
Ok ( _) => unreachable ! ( ) ,
177
176
Err ( e) => Err ( e) ,
You can’t perform that action at this time.
0 commit comments