Home | History | Annotate | Download | only in fastboot

Lines Matching full:handle

53     /// Handle to USB interface
56 /// Handle to USB read pipe (endpoint)
59 /// Handle to USB write pipe (endpoint)
71 int recognized_device(usb_handle* handle, ifc_match_func callback);
76 /// Writes data to the opened usb handle
77 int usb_write(usb_handle* handle, const void* data, int len);
79 /// Reads data using the opened usb handle
80 int usb_read(usb_handle *handle, void* data, int len);
82 /// Cleans up opened usb handle
83 void usb_cleanup_handle(usb_handle* handle);
85 /// Cleans up (but don't close) opened usb handle
86 void usb_kick(usb_handle* handle);
88 /// Closes opened usb handle
89 int usb_close(usb_handle* handle);
93 // Allocate our handle
155 int usb_write(usb_handle* handle, const void* data, int len) {
162 if (NULL != handle) {
166 ret = AdbWriteEndpointSync(handle->adb_write_pipe,
176 usb_kick(handle);
188 DBG("usb_write NULL handle\n");
197 int usb_read(usb_handle *handle, void* data, int len) {
203 if (NULL != handle) {
207 ret = AdbReadEndpointSync(handle->adb_read_pipe,
219 usb_kick(handle);
225 DBG("usb_read NULL handle\n");
234 void usb_cleanup_handle(usb_handle* handle) {
235 if (NULL != handle) {
236 if (NULL != handle->interface_name)
237 free(handle->interface_name);
238 if (NULL != handle->adb_write_pipe)
239 AdbCloseHandle(handle->adb_write_pipe);
240 if (NULL != handle->adb_read_pipe)
241 AdbCloseHandle(handle->adb_read_pipe);
242 if (NULL != handle->adb_interface)
243 AdbCloseHandle(handle->adb_interface);
245 handle->interface_name = NULL;
246 handle->adb_write_pipe = NULL;
247 handle->adb_read_pipe = NULL;
248 handle->adb_interface = NULL;
252 void usb_kick(usb_handle* handle) {
253 if (NULL != handle) {
254 usb_cleanup_handle(handle);
261 int usb_close(usb_handle* handle) {
264 if (NULL != handle) {
265 // Cleanup handle
266 usb_cleanup_handle(handle);
267 free(handle);
278 int recognized_device(usb_handle* handle, ifc_match_func callback) {
283 if (NULL == handle)
287 if (!AdbGetUsbDeviceDescriptor(handle->adb_interface,
293 if (!AdbGetUsbInterfaceDescriptor(handle->adb_interface,
315 if (!AdbGetSerialNumber(handle->adb_interface, info.serial_number,
330 usb_handle* handle = NULL;
356 handle = do_usb_open(next_interface->device_name);
357 if (NULL != handle) {
359 if (recognized_device(handle, callback)) {
363 usb_cleanup_handle(handle);
364 free(handle);
365 handle = NULL;
373 return handle;