FreeCalypso > hg > fc-usbser-tools
view libuwrap/claim_if.c @ 43:dbaf239436cf
doc/DUART28-EEPROM-config: update for fc-duart28-conf
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 11 Sep 2023 01:06:03 +0000 |
parents | f5847be43d35 |
children | 5160f6717903 |
line wrap: on
line source
/* * When we are reprogramming the EEPROM on DUART28 or possibly other devices * in the future where we know that we are operating on a multichannel FTDI * chip (or perhaps a multichannel chip from some other vendor), it is most * philosophically correct to bump off ftdi_sio from both interfaces, * removing both ttyUSB devices. Here we implement a function for claiming * one interface, easily callable for multiple interfaces in a row. */ #include <stdio.h> #include <stdlib.h> #include <usb.h> #include "open_close.h" void usbwrap_claim_interface(usb_dev_handle *usbh, int ifnum, int detach) { if (detach) usb_detach_kernel_driver_np(usbh, ifnum); if (usb_claim_interface(usbh, ifnum) != 0) { fprintf(stderr, "error: usb_claim_interface() failed\n"); exit(1); } }