Lines Matching defs:usb
50 static int check_response(usb_handle *usb, unsigned int size, char *response)
56 r = usb_read(usb, status, 64);
59 usb_close(usb);
66 usb_close(usb);
95 usb_close(usb);
102 usb_close(usb);
109 static int _command_start(usb_handle *usb, const char *cmd, unsigned size,
124 if(usb_write(usb, cmd, cmdsize) != cmdsize) {
126 usb_close(usb);
130 return check_response(usb, size, response);
133 static int _command_data(usb_handle *usb, const void *data, unsigned size)
137 r = usb_write(usb, data, size);
140 usb_close(usb);
145 usb_close(usb);
152 static int _command_end(usb_handle *usb)
155 r = check_response(usb, 0, 0);
162 static int _command_send(usb_handle *usb, const char *cmd,
171 r = _command_start(usb, cmd, size, response);
176 r = _command_data(usb, data, size);
181 r = _command_end(usb);
189 static int _command_send_no_data(usb_handle *usb, const char *cmd,
194 return _command_start(usb, cmd, 0, response);
197 int fb_command(usb_handle *usb, const char *cmd)
199 return _command_send_no_data(usb, cmd, 0);
202 int fb_command_response(usb_handle *usb, const char *cmd, char *response)
204 return _command_send_no_data(usb, cmd, response);
207 int fb_download_data(usb_handle *usb, const void *data, unsigned size)
213 r = _command_send(usb, cmd, data, size, 0);
229 usb_handle *usb = priv;
243 r = _command_data(usb, usb_buf, USB_BUF_SIZE);
256 r = _command_data(usb, ptr, to_write);
276 static int fb_download_data_sparse_flush(usb_handle *usb)
281 r = _command_data(usb, usb_buf, usb_buf_len);
291 int fb_download_data_sparse(usb_handle *usb, struct sparse_file *s)
301 r = _command_start(usb, cmd, size, 0);
306 r = sparse_file_callback(s, true, false, fb_download_data_sparse_write, usb);
311 fb_download_data_sparse_flush(usb);
313 return _command_end(usb);