diff duart28/main.c @ 29:a7393d00996a

fc-duart28-conf: implement check-eeprom
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 09 Sep 2023 19:13:35 +0000
parents 2413a54a1bfc
children 530ec3792de8
line wrap: on
line diff
--- a/duart28/main.c	Sat Sep 09 17:55:14 2023 +0000
+++ b/duart28/main.c	Sat Sep 09 19:13:35 2023 +0000
@@ -8,6 +8,7 @@
 #include <string.h>
 #include <strings.h>
 #include <usb.h>
+#include "../libuwrap/open_close.h"
 
 extern struct usb_device *find_duart28_usbdev();
 
@@ -23,8 +24,19 @@
 
 oper_check_eeprom()
 {
-	fprintf(stderr, "error: check-eeprom command not yet implemented\n");
-	exit(1);
+	struct usb_device *dev;
+	usb_dev_handle *usbh;
+
+	dev = find_duart28_usbdev();
+	if (!dev) {
+		fprintf(stderr, "error: no DUART28 adapter found\n");
+		exit(1);
+	}
+	usbh = usbwrap_open_dev(dev, 1);
+	read_eeprom(usbh);
+	usbwrap_close_dev(usbh);
+	analyze_eeprom();
+	return 0;
 }
 
 oper_program(newconf)