Lines Matching refs:uh
100 usb_bulk_write(usb_handle *uh, const void *data, int len)
105 r = libusb_bulk_transfer(uh->devh, uh->end_point_address[1], (void *)data, len,
118 usb_bulk_read(usb_handle *uh, void *data, int len)
123 r = libusb_bulk_transfer(uh->devh, uh->end_point_address[0], data, len,
136 usb_write(struct usb_handle *uh, const void *_data, int len)
142 if (uh->zero_mask == 1) {
143 if (!(len & uh->zero_mask)) {
148 D("usb_write(): %p:%d -> transport %p\n", _data, len, uh);
153 n = usb_bulk_write(uh, data, xfer);
156 D("usb_write(): failed for transport %p (%d bytes left)\n", uh, len);
165 n = usb_bulk_write(uh, _data, 0);
168 D("usb_write(): failed to finish operation for transport %p\n", uh);
177 usb_read(struct usb_handle *uh, void *_data, int len)
182 D("usb_read(): %p:%d <- transport %p\n", _data, len, uh);
187 n = usb_bulk_read(uh, data, xfer);
196 D("usb_read(): failed for transport %p (%d bytes left)\n", uh, len);
251 struct usb_handle *uh)
277 uh->end_point_address[0] = edesc->bEndpointAddress;
279 uh->end_point_address[1] = edesc->bEndpointAddress;
283 uh->zero_mask = edesc->wMaxPacketSize - 1;
292 uh->end_point_address[0], uh->end_point_address[1]);
308 libusb_device_descriptor *desc, struct usb_handle *uh)
313 if (check_usb_interface(&config->interface[i], desc, uh) != -1) {
327 register_device(struct usb_handle *uh, const char *serial)
330 uh, serial);
335 memcpy(usb, uh, sizeof(struct usb_handle));
336 strcpy(usb->serial, uh->serial);
356 already_registered(usb_handle *uh)
364 if ((usb->dev_bus == uh->dev_bus) &&
365 (usb->dev_addr == uh->dev_addr))
380 struct usb_handle uh;
408 uh.dev_bus = libusb_get_bus_number(dev);
409 uh.dev_addr = libusb_get_device_address(dev);
411 if (already_registered(&uh)) {
413 "is already registered\n", uh.dev_bus, uh.dev_addr);
418 uh.dev_bus, uh.dev_addr);
441 found = check_usb_interfaces(config, &desc, &uh);
447 r = libusb_open(dev, &uh.devh);
448 uh.dev = dev;
476 uh.interface = found;
478 r = libusb_claim_interface(uh.devh, uh.interface);
482 uh.interface);
494 r = libusb_control_transfer(uh.devh,
509 r = libusb_control_transfer(uh.devh,
526 if (register_device(&uh, serial) == 0) {
538 libusb_release_interface(uh.devh, uh.interface);
541 libusb_close(uh.devh);
542 uh.devh = NULL;
546 check_device_connected(struct usb_handle *uh)
548 int r = libusb_kernel_driver_active(uh->devh, uh->interface);