FreeCalypso > hg > fc-usbser-tools
comparison libuwrap/claim_if.c @ 40:f5847be43d35
fc-duart28-conf: bump off both ttyUSB devices on set operation
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 10 Sep 2023 21:13:58 +0000 |
parents | libuwrap/open_close.c@80e521d6609c |
children | 5160f6717903 |
comparison
equal
deleted
inserted
replaced
39:b9ecfa54fe2b | 40:f5847be43d35 |
---|---|
1 /* | |
2 * When we are reprogramming the EEPROM on DUART28 or possibly other devices | |
3 * in the future where we know that we are operating on a multichannel FTDI | |
4 * chip (or perhaps a multichannel chip from some other vendor), it is most | |
5 * philosophically correct to bump off ftdi_sio from both interfaces, | |
6 * removing both ttyUSB devices. Here we implement a function for claiming | |
7 * one interface, easily callable for multiple interfaces in a row. | |
8 */ | |
9 | |
10 #include <stdio.h> | |
11 #include <stdlib.h> | |
12 #include <usb.h> | |
13 #include "open_close.h" | |
14 | |
15 void usbwrap_claim_interface(usb_dev_handle *usbh, int ifnum, int detach) | |
16 { | |
17 if (detach) | |
18 usb_detach_kernel_driver_np(usbh, ifnum); | |
19 if (usb_claim_interface(usbh, ifnum) != 0) { | |
20 fprintf(stderr, "error: usb_claim_interface() failed\n"); | |
21 exit(1); | |
22 } | |
23 } |