Lines Matching refs:usb
102 for (usb_handle* usb : g_usb_handles) { in is_known_device()
103 if (usb->path == dev_name) { in is_known_device()
105 usb->mark = true; in is_known_device()
115 for (usb_handle* usb : g_usb_handles) { in kick_disconnected_devices()
116 if (!usb->mark) { in kick_disconnected_devices()
117 usb_kick(usb); in kick_disconnected_devices()
119 usb->mark = false; in kick_disconnected_devices()
574 for (usb_handle* usb: g_usb_handles) { in register_device()
575 if (usb->path == dev_name) { in register_device()
582 std::unique_ptr<usb_handle> usb(new usb_handle); in register_device() local
583 usb->path = dev_name; in register_device()
584 usb->ep_in = ep_in; in register_device()
585 usb->ep_out = ep_out; in register_device()
586 usb->zero_mask = zero_mask; in register_device()
587 usb->max_packet_size = max_packet_size; in register_device()
590 usb->mark = true; in register_device()
592 usb->fd = unix_open(usb->path, O_RDWR | O_CLOEXEC); in register_device()
593 if (usb->fd == -1) { in register_device()
595 usb->fd = unix_open(usb->path, O_RDONLY | O_CLOEXEC); in register_device()
596 if (usb->fd == -1) { in register_device()
597 D("[ usb open %s failed: %s]", usb->path.c_str(), strerror(errno)); in register_device()
600 usb->writeable = 0; in register_device()
604 usb->path.c_str(), (usb->writeable ? "" : " (read-only)"), usb->fd); in register_device()
606 if (usb->writeable) { in register_device()
607 if (ioctl(usb->fd, USBDEVFS_CLAIMINTERFACE, &interface) != 0) { in register_device()
608 D("[ usb ioctl(%d, USBDEVFS_CLAIMINTERFACE) failed: %s]", usb->fd, strerror(errno)); in register_device()
614 usb_handle* done_usb = usb.release(); in register_device()