diff duart28/main.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 b9ecfa54fe2b
children
line wrap: on
line diff
--- a/duart28/main.c	Sun Sep 10 19:21:20 2023 +0000
+++ b/duart28/main.c	Sun Sep 10 21:13:58 2023 +0000
@@ -52,18 +52,24 @@
 		fprintf(stderr, "error: no DUART28 adapter found\n");
 		exit(1);
 	}
-	usbh = usbwrap_open_dev(dev, 1);
+	usbh = usb_open(dev);
+	if (!usbh) {
+		fprintf(stderr, "error: usb_open() failed\n");
+		exit(1);
+	}
+	usbwrap_claim_interface(usbh, 0, 1);
+	usbwrap_claim_interface(usbh, 1, 1);
 	read_eeprom(usbh);
 	prev = analyze_eeprom();
 	if (prev == newconf) {
 	printf("EEPROM is already in the right state, nothing to program\n");
-		usbwrap_close_dev(usbh);
+		usb_close(usbh);
 	printf("Please replug the adapter to restore normal operation\n");
 		return 0;
 	}
 	printf("Reprogramming to DUART28%c configuration\n", newconf);
 	update_eeprom(usbh, newconf);
-	usbwrap_close_dev(usbh);
+	usb_close(usbh);
 	printf("EEPROM changed, replug the adapter to take effect\n");
 	return 0;
 }