Lines Matching refs:handle

71     OsxUsbTransport(std::unique_ptr<usb_handle> handle, uint32_t ms_timeout = 0)  in OsxUsbTransport()  argument
72 : handle_(std::move(handle)), ms_timeout_(ms_timeout) {} in OsxUsbTransport()
89 static int try_interfaces(IOUSBDeviceInterface500** dev, usb_handle* handle) { in try_interfaces() argument
181 if ((*interface)->GetInterfaceClass(interface, &handle->info.ifc_class) != 0 || in try_interfaces()
182 (*interface)->GetInterfaceSubClass(interface, &handle->info.ifc_subclass) != 0 || in try_interfaces()
183 (*interface)->GetInterfaceProtocol(interface, &handle->info.ifc_protocol) != 0) in try_interfaces()
189 handle->info.has_bulk_in = 0; in try_interfaces()
190 handle->info.has_bulk_out = 0; in try_interfaces()
225 handle->info.has_bulk_in = 1; in try_interfaces()
226 handle->bulkIn = endpoint; in try_interfaces()
228 handle->info.has_bulk_out = 1; in try_interfaces()
229 handle->bulkOut = endpoint; in try_interfaces()
232 if (handle->info.ifc_protocol == 0x01) { in try_interfaces()
233 handle->zero_mask = (endPointMaxPacketSize == 0) ? in try_interfaces()
240 if (handle->info.has_bulk_in && handle->info.has_bulk_out) { in try_interfaces()
245 if (handle->callback(&handle->info) == 0) { in try_interfaces()
246 handle->interface = interface; in try_interfaces()
247 handle->success = 1; in try_interfaces()
255 if (handle->info.has_bulk_in) { in try_interfaces()
257 handle->bulkIn); in try_interfaces()
263 if (handle->info.has_bulk_out) { in try_interfaces()
265 handle->bulkOut); in try_interfaces()
285 static int try_device(io_service_t device, usb_handle *handle) { in try_device() argument
320 kr = (*dev)->GetDeviceVendor(dev, &handle->info.dev_vendor); in try_device()
326 kr = (*dev)->GetDeviceProduct(dev, &handle->info.dev_product); in try_device()
332 kr = (*dev)->GetDeviceClass(dev, &handle->info.dev_class); in try_device()
338 kr = (*dev)->GetDeviceSubClass(dev, &handle->info.dev_subclass); in try_device()
344 kr = (*dev)->GetDeviceProtocol(dev, &handle->info.dev_protocol); in try_device()
355 snprintf(handle->info.device_path, sizeof(handle->info.device_path), in try_device()
379 handle->info.serial_number[i] = buffer[i + 1]; in try_device()
380 handle->info.serial_number[i] = 0; in try_device()
384 handle->info.serial_number[0] = 0; in try_device()
386 handle->info.interface[0] = 0; in try_device()
387 handle->info.writable = 1; in try_device()
389 if (try_interfaces(dev, handle)) { in try_device()
407 static int init_usb(ifc_match_func callback, std::unique_ptr<usb_handle>* handle) { in init_usb() argument
459 handle->reset(new usb_handle(h)); in init_usb()
479 std::unique_ptr<usb_handle> handle; in usb_open() local
481 if (init_usb(callback, &handle) < 0) { in usb_open()
486 return new OsxUsbTransport(std::move(handle), timeout_ms); in usb_open()