]> git.zerfleddert.de Git - rigol/blobdiff - rigol.c
beginning of png
[rigol] / rigol.c
diff --git a/rigol.c b/rigol.c
index e7497ac65444fa4b9c10eaaf99e09ceced8968a8..389253f7bddcc4b9412bf545a93d068c55937c76 100644 (file)
--- a/rigol.c
+++ b/rigol.c
@@ -23,6 +23,8 @@ rmmod uhci_hcd; modprobe uhci_hcd
 #include <readline/readline.h>
 #include <readline/history.h>
 
+#include "png.h"
+
 
 //This routine locates a scope by VID/PID and returns an opened handle to it.
 usb_dev_handle *find_scope() {
@@ -304,8 +306,10 @@ void do_get_screen(struct usb_dev_handle *sc)
        unsigned char lut[256][3];
        time_t lt;
        char filename[256];
+       unsigned char *png;
        int i;
        int l;
+       int fd;
        FILE *fp;
        pid_t display;
 
@@ -353,6 +357,12 @@ void do_get_screen(struct usb_dev_handle *sc)
                default:
                        break;
        }
+
+       strftime(filename, sizeof(filename), "screen_%Y%m%d-%H%M%S.png", localtime(&lt));
+       fd=open(filename, O_CREAT|O_WRONLY, 0644);
+       png = lcd2png(screen, &i);
+       write(fd, png, i);
+       close(fd);
 }
 
 void child_reaper(int sig)
Impressum, Datenschutz